Skip to content

Recompiler: simplify rotate and FFT swizzles in direct DXIL - #2161

Open
wasonidas wants to merge 1 commit into
xcl-dev:mainfrom
wasonidas:xcl/direct-swizzle-rotate-fft-f5c5bdf
Open

wasonidas wants to merge 1 commit into
xcl-dev:mainfrom
wasonidas:xcl/direct-swizzle-rotate-fft-f5c5bdf

Conversation

@wasonidas

Copy link
Copy Markdown

Part of #1269. Direct DXIL now computes the source lanes for rotate and FFT DS_SWIZZLE_B32 with bit operations and lane arithmetic. The emitted shaders are smaller and take less time to translate in the synthetic benchmark.

What is in it

  • lower_mem.rs computes rotate source lanes and uses bit reversal for FFT. The calculation preserves each wave64 half.
  • core_tests.rs checks emitted DXIL and compares GPU output lane by lane with the CPU oracle.

Tested

  • Windows 11 build 26300, Ryzen 7 9800X3D, GeForce RTX 5080 driver 32.0.16.2124, integrated Radeon driver 32.0.21042.62, Rust 1.100.0 MSVC and SDK DXC 1.9.2602.17.
  • cargo test --release -p xcl --lib gpu::dxil::swizzle_bench_tmp::swizzle_synthetic_bench -- --nocapture --exact --test-threads=1 used four runs and 50 samples per shape per run. Byte size fell 30.22–40.85% and median translation time fell 35.70–42.35% across rotate, FFT and mixed shapes. The bit/quad control emitted the same number of bytes and selects.
  • Main 6ea813a and clean head 0c7665c built with cargo build --release -p xcl.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture counts are passed / failed / ignored / internal skips. Cargo includes internal skips in the passed count.
  • On RTX 5080, main reported 1150 / 4 / 46 / 27 and the candidate reported 1152 / 4 / 46 / 27. Fuzz seeds 70, 545, 1019, 1507 failed with the same diagnostics on both revisions. Both new tests passed.
  • On Integrated Radeon, main reported 1153 / 1 / 46 / 10 and the candidate reported 1155 / 1 / 46 / 10. Fuzz seeds 540 failed with the same diagnostics on both revisions. Both new tests passed.

Regression run

main:

xcl-smoke v1
commit: 6ea813a61f7d324e2fcbeb0c6a068edcd37e818b
gpu: NVIDIA GeForce RTX 5080
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1186 (PresentX 1186)
presents per 2 s (last 3): 12 13 0
device removals: 0
crashes: 0
peak commit: 28459 MB

PR:

xcl-smoke v1
commit: 0c7665c4affbdd368436910d8fd6be20ce9ade41
gpu: NVIDIA GeForce RTX 5080
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1344 (PresentX 1344)
presents per 2 s (last 3): 24 47 39
device removals: 0
crashes: 0
peak commit: 26944 MB

Not tested

  • The 60 s smoke checks title stability. Instruction coverage during the title run, cold driver PSO compilation, and GPU execution time were not measured. GitHub-hosted CI is pending PR creation.

AI use

  • T3 Code / Antigravity (requested gemini-4-neon, medium) implemented the change and tests, and ran the first validation. T3 Code / OpenAI Codex (gpt-6.2-sol) reviewed the diff, independently ran the paired validation and prepared this draft.

Compute rotate and FFT source lanes with arithmetic on the low five bits.
This preserves the wave64 half and removes the 32-entry select chain.

Four paired release runs on synthetic rotate, FFT and mixed kernels cut
DXIL size by 30-41% and median translation time by 36-42%. The RTX 5080
and integrated Radeon suites repeated the baseline fuzz diagnostics.

Part of xcl-dev#1269.
Assisted-by: T3 Code / Antigravity (gemini-4-neon)
Assisted-by: T3 Code / OpenAI Codex (gpt-6.2-sol)
@JJAutoCompare

Copy link
Copy Markdown

Independent Windows x64 + Intel Arc A770 test report on commit 0c7665c4affbdd368436910d8fd6be20ce9ade41.

Environment

  • OS: Windows 11 Enterprise Evaluation x64 (build 26200.9974, Session 0)
  • CPU: AMD Ryzen 7 3800X
  • GPU: Intel Arc A770 16 GiB (driver 32.0.101.9175, Tiled Resources Tier 4, Resource Heap Tier 1, DoublePrecisionFloatShaderOps=0)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5 (01b62ad47)

Command
Executed under serialized Arc A770 GPU mutex (XCL_ADAPTER=A770) with pre/post-mutex executable SHA-256 verified (2939D617B118A1D897505245A91890F088BFADC390856E611437353D2BDC0ACD):

xcl-97fdf2b9ff8e1482.exe --exact --nocapture --test-threads=1 `
  gpu::dxil::core_tests::ds_swizzle_rotate_and_fft_emit_compact_dxil `
  gpu::dxil::core_tests::gpu_direct_ds_swizzle_rotate_fft_matches_oracle

Results

  • Passed: 2, Failed: 0, Ignored: 0, Skipped: 0 (0.37s, exit code 0)
  • Both targeted ds_swizzle rotate/FFT tests (including the Arc A770 GPU oracle test) passed without SKIPPED output.

Not tested

  • Full workspace suite and game smoke run.

AI use

  • Verified and published with T3 Code / Antigravity (gemini-4-neon).

@futurepro62

futurepro62 commented Nov 25, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 0c7665c (on its base 6ea813a).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1144 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: ds_swizzle_rotate_and_fft_emit_compact_dxil, gpu_direct_ds_swizzle_rotate_fft_matches_oracle.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1155 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 568e7db too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@luckyteagirl

Copy link
Copy Markdown

Independent RX 6800M check on exact head 0c7665c4affbdd368436910d8fd6be20ce9ade41 (PR base 568e7db7729c8fa6c8f0f4b32d798faaf11462bb).

Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M, driver 30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Clean detached worktree. XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=wave64, XCL_DIRECT_DXIL=1, and XCL_DXC_DIR pointed at the matching DXC/DXIL binaries.

Command: cargo test --locked -p xcl --lib -j 2 swizzle_rotate -- --test-threads=1 --show-output

Result: 2 passed, 0 failed, 0 ignored, 0 SKIPPED lines. ds_swizzle_rotate_and_fft_emit_compact_dxil passed its emitted-DXIL checks. gpu_direct_ds_swizzle_rotate_fft_matches_oracle passed GPU-to-CPU lane parity for the listed rotate, FFT, bit-mode, and quad controls. The test code runs wave32, split wave64, and native wave64 on an adapter that exposes both wave widths; all variants completed.

Scope: Focused debug-build tests only. I did not run the full workspace suite, paired main tests, a title smoke comparison, or the synthetic translation benchmark on this PR head.

AI use: OpenAI Codex ran the tests, inspected the test branches and clean revision, checked the log, and prepared this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants