Recompiler: shadow v_writelane spill slots in split-wave64 #911

Open
zondy1i wants to merge 1 commit from upstream-pr/917 into main
zondy1i commented 2026-11-24 08:13:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by zondy1i on 2026-11-24T08:13:24Z.


��In split-wave64 mode (two hardware wave32 halves per console wave64), SGPR spill reloads (v_writelane_b32 �! v_readlane_b32 with a constant lane) previously went through xcl_x_rla_uniform and emitted a full cross-half exchange (bounded spin loop, barriers, and atomics), even though both halves already hold identical SGPRs (x64_masks keeps v_writelane_b32's scalar source whole-live).

This adds a conservative forward must-analysis (upper_lanes::analyze_spills) for split-wave64 Kernel, Compute, and Mesh programs so constant-lane spill reloads read a scalar shadow xcl_sh<v>_<l> directly without exchanging across halves, reducing DXIL size and NVIDIA driver (nvgpucomp64.dll) pipeline compile time. Native wave64 HLSL is unchanged.

What is in it

  • crates/xcl/src/gpu/recomp/upper_lanes.rs: add analyze_spills (tracks constant-lane v_writelane_b32 slots 0..63 across the CFG; invalidates on any VGPR write, dynamic-lane v_writelane_b32, v_movrel/v_swaprel, LOOP_GUARD exits, or indirect jumps) + unit tests.
  • crates/xcl/src/gpu/recomp/mod.rs: run analyze_spills for split-wave64 Kernel/Compute/Mesh programs.
  • crates/xcl/src/gpu/recomp/emit.rs: emit direct xcl_sh<v>_<l> reads for shadowed v_readlane_b32 in x64() mode without declaring VS/PS-only xcl_hw32.
  • crates/xcl/src/gpu/recomp/tests.rs: add gpu_split_wave64_writelane_spill_shadows GPU test covering lower- and upper-half spill reloads alongside a non-spill cross-half read.

Measured on three spill-heavy retail wave64 compute shaders (RTX 3060 Ti, DXC 1.9.2609.5, before �! after):

  • Compute shader #1: rla_u 259 �! 9, DXC 9231 �! 4869 ms, DXIL 394692 �! 293800 B (-25.6%), PSO 9118 �! 6334 ms (-30.5%)
  • Compute shader #2: rla_u 311 �! 17, DXC 14047 �! 7720 ms, DXIL 506376 �! 386384 B (-23.7%), PSO 11848 �! 9305 ms (-21.5%)
  • Compute shader #3: rla_u 506 �! 323, DXC 30955 �! 24472 ms, DXIL 1200072 �! 1113164 B (-7.2%), PSO 30468 �! 27233 ms (-10.6%)

Tested

  • Hardware: NVIDIA GeForce RTX 3060 Ti 8 GB (driver 32.0.16.2101), Ryzen 5 7500F, 64 GB RAM, Windows 11 Build 26300, DXC 1.9.2609.5, Rust 1.100.0 (x86_64-pc-windows-msvc), debug + release.
  • cargo test --workspace -- --test-threads=1: 718 passed, 0 failed, 41 ignored (2 SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)).
  • Note: under --test-threads=4 on commit 1ec4c98, pre-existing hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels failed intermittently (cascading 2 PoisonErrors in unrelated d3d12x tests); all recomp tests pass under both --test-threads=4 and --test-threads=1.

Regression run

main:

xcl-smoke v1
commit: 80f4819098e921f2e1ab371144d4832f68ffedd6
gpu: NVIDIA GeForce RTX 3060 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1622 (PresentX 1622)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16539 MB

PR:

xcl-smoke v1
commit: 709abd7fe1a546668c8631b2e691e58d71e3e233
gpu: NVIDIA GeForce RTX 3060 Ti
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1614 (PresentX 1615)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15644 MB

Not tested

  • Native wave64 GPU (AMD RDNA): hardware not available here (split_wave64 is false there so emitted HLSL is unchanged).
  • Retail gameplay past menus (smoke run covers boot through menus; world-loading compute shaders were benchmarked offline via DXC + CreateComputePipelineState).

AI use

  • Antigravity (Gemini 4 Neon): analyzed DXIL/corpus spill patterns, wrote the implementation, unit/GPU tests, and PR description; all tests, benchmarks, and smoke runs were executed locally on the hardware above and the diff was reviewed line by line.
<!-- greyfinch-sync:ivall/xcl:issue:5468500554 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917). Originally posted by [zondy1i](https://github.com/zondy1i) on 2026-11-24T08:13:24Z. --- ��In split-wave64 mode (two hardware wave32 halves per console wave64), SGPR spill reloads (`v_writelane_b32` �! `v_readlane_b32` with a constant lane) previously went through `xcl_x_rla_uniform` and emitted a full cross-half exchange (bounded spin loop, barriers, and atomics), even though both halves already hold identical SGPRs (`x64_masks` keeps `v_writelane_b32`'s scalar source whole-live). This adds a conservative forward must-analysis (`upper_lanes::analyze_spills`) for split-wave64 `Kernel`, `Compute`, and `Mesh` programs so constant-lane spill reloads read a scalar shadow `xcl_sh<v>_<l>` directly without exchanging across halves, reducing DXIL size and NVIDIA driver (`nvgpucomp64.dll`) pipeline compile time. Native wave64 HLSL is unchanged. **What is in it** - `crates/xcl/src/gpu/recomp/upper_lanes.rs`: add `analyze_spills` (tracks constant-lane `v_writelane_b32` slots `0..63` across the CFG; invalidates on any VGPR write, dynamic-lane `v_writelane_b32`, `v_movrel`/`v_swaprel`, `LOOP_GUARD` exits, or indirect jumps) + unit tests. - `crates/xcl/src/gpu/recomp/mod.rs`: run `analyze_spills` for split-wave64 `Kernel`/`Compute`/`Mesh` programs. - `crates/xcl/src/gpu/recomp/emit.rs`: emit direct `xcl_sh<v>_<l>` reads for shadowed `v_readlane_b32` in `x64()` mode without declaring VS/PS-only `xcl_hw32`. - `crates/xcl/src/gpu/recomp/tests.rs`: add `gpu_split_wave64_writelane_spill_shadows` GPU test covering lower- and upper-half spill reloads alongside a non-spill cross-half read. Measured on three spill-heavy retail wave64 compute shaders (RTX 3060 Ti, DXC 1.9.2609.5, before �! after): - Compute shader #1: `rla_u` 259 �! 9, DXC 9231 �! 4869 ms, DXIL 394692 �! 293800 B (-25.6%), PSO 9118 �! 6334 ms (-30.5%) - Compute shader #2: `rla_u` 311 �! 17, DXC 14047 �! 7720 ms, DXIL 506376 �! 386384 B (-23.7%), PSO 11848 �! 9305 ms (-21.5%) - Compute shader #3: `rla_u` 506 �! 323, DXC 30955 �! 24472 ms, DXIL 1200072 �! 1113164 B (-7.2%), PSO 30468 �! 27233 ms (-10.6%) **Tested** - Hardware: NVIDIA GeForce RTX 3060 Ti 8 GB (driver 32.0.16.2101), Ryzen 5 7500F, 64 GB RAM, Windows 11 Build 26300, DXC 1.9.2609.5, Rust 1.100.0 (`x86_64-pc-windows-msvc`), debug + release. - `cargo test --workspace -- --test-threads=1`: 718 passed, 0 failed, 41 ignored (2 SKIPPED GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64), `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` (no wave64)). - Note: under `--test-threads=4` on commit `1ec4c98`, pre-existing `hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels` failed intermittently (cascading 2 `PoisonError`s in unrelated `d3d12x` tests); all `recomp` tests pass under both `--test-threads=4` and `--test-threads=1`. **Regression run** main: ``` xcl-smoke v1 commit: 80f4819098e921f2e1ab371144d4832f68ffedd6 gpu: NVIDIA GeForce RTX 3060 Ti title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1622 (PresentX 1622) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16539 MB ``` PR: ``` xcl-smoke v1 commit: 709abd7fe1a546668c8631b2e691e58d71e3e233 gpu: NVIDIA GeForce RTX 3060 Ti title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1614 (PresentX 1615) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15644 MB ``` **Not tested** - Native wave64 GPU (AMD RDNA): hardware not available here (`split_wave64` is false there so emitted HLSL is unchanged). - Retail gameplay past menus (smoke run covers boot through menus; world-loading compute shaders were benchmarked offline via DXC + `CreateComputePipelineState`). **AI use** - Antigravity (Gemini 4 Neon): analyzed DXIL/corpus spill patterns, wrote the implementation, unit/GPU tests, and PR description; all tests, benchmarks, and smoke runs were executed locally on the hardware above and the diff was reviewed line by line.
Diskuss commented 2026-11-24 09:07:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Diskuss on 2026-11-24T08:19:12Z.


Tested on AMD Radeon RX 9070 XT (RDNA4) at 32976332072567e6fe9a7cc621e9cedce509ea2f

Hardware: RX 9070 XT (RDNA4, driver 32.0.32015.7029), Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, Rust 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17, debug build.

Tested

  • cargo build --workspace: succeeded (1 existing warning in the xcl lib).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 718 passed, 0 failed, 41 ignored (summed over all test result: lines).
  • The PR's three named tests all ran and passed in that run:
    • gpu_split_wave64_writelane_spill_shadows: ok
    • spills_follow_writelane_for_both_halves: ok
    • spills_stay_conservative_across_overwrites_branches_and_loops: ok
  • SKIPPED lines: 0
  • Device removal: none
  • Compared with main (1ec4c98: 715 passed, 0 failed, 41 ignored, 0 SKIPPED): +3 passed, which matches the 3 new tests; failed and ignored are unchanged.

Not tested: retail title / scripts/smoke.ps1 (no game files), release build, wave32-only GPUs.

Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.

Correction (hidden skips): "0 SKIPPED" above means no SKIPPED line appeared in the normal run. A later -- --nocapture run on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools / d3d12SDKLayers.dll). libtest captures their output, so they show as ok: e2e::test_title_draws_with_a_root_signature_under_the_debug_layer and texture_states::uploads_start_from_each_subresources_state. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.

<!-- greyfinch-sync:ivall/xcl:comment:7125989837 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/917#issuecomment-7125989837). Originally posted by [Diskuss](https://github.com/Diskuss) on 2026-11-24T08:19:12Z. --- **Tested on AMD Radeon RX 9070 XT (RDNA4) at `32976332072567e6fe9a7cc621e9cedce509ea2f`** Hardware: RX 9070 XT (RDNA4, driver 32.0.32015.7029), Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, Rust 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17, debug build. **Tested** - `cargo build --workspace`: succeeded (1 existing warning in the `xcl` lib). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 718 passed, 0 failed, 41 ignored (summed over all `test result:` lines). - The PR's three named tests all ran and passed in that run: - `gpu_split_wave64_writelane_spill_shadows`: ok - `spills_follow_writelane_for_both_halves`: ok - `spills_stay_conservative_across_overwrites_branches_and_loops`: ok - SKIPPED lines: 0 - Device removal: none - Compared with main (1ec4c98: 715 passed, 0 failed, 41 ignored, 0 SKIPPED): +3 passed, which matches the 3 new tests; failed and ignored are unchanged. **Not tested**: retail title / `scripts/smoke.ps1` (no game files), release build, wave32-only GPUs. Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine. **Correction (hidden skips):** "0 SKIPPED" above means no `SKIPPED` line appeared in the normal run. A later `-- --nocapture` run on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools / `d3d12SDKLayers.dll`). libtest captures their output, so they show as `ok`: `e2e::test_title_draws_with_a_root_signature_under_the_debug_layer` and `texture_states::uploads_start_from_each_subresources_state`. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.
IvyNotFound commented 2026-11-24 09:07:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by IvyNotFound on 2026-11-24T08:55:51Z.


Tested on NVIDIA RTX 5080 (Blackwell, wave32) at 32976332072567e6fe9a7cc621e9cedce509ea2f

Tested

  • GPU: NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), split wave64 path; CPU: AMD Ryzen 7 7800X3D
  • Windows 11 25H2 (build 26200.9974), rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), debug build
  • Game data: XCL_SAMPLE_RPF (retail shaders.rpf), XCL_SAMPLE_DLLS, XCL_SAMPLE_TTPF, XCL_SAMPLE_BVH4
  • cargo build --workspace: succeeded (the existing fetch_update deprecation warning only)
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 715 passed, 3 failed, 41 ignored; SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware
  • The PR's tests pass: gpu_split_wave64_writelane_spill_shadows (ran, no SKIPPED line), upper_lanes::tests::spill_slots_come_from_their_shadow, spills_follow_writelane_for_both_halves, spills_stay_conservative_across_overwrites_branches_and_loops; the existing gpu_wave64_vs_spill_slots_and_identity and gpu_wave64_ps_spill_slots pass too
  • gpu_pso_e2e with the pack: 7 passed (including retail_es_gs_voxelize_geometry_mode and the retail mesh / GS pipelines)
  • The 3 failures are the #718 flake you note in the description: placed_title_textures_share_vram_and_preserve_pixels (cubemap extra_pages must be reused at same va), then transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory on the PoisonError. The same three failed the same way on main 09940bb on this machine. cargo test -p xcl --lib -- --test-threads=4 title_textures::tests vram::tests at this head, three runs: 20 passed, 0 failed each time.

Not tested

  • scripts/smoke.ps1 / the retail title, and the compile-time or DXIL-size numbers (not measured here)
  • release build; native wave64 (AMD)

AI use

  • Claude Code, Claude Opus 5.5: ran the build and the tests and wrote this report. The numbers come from that run.
<!-- greyfinch-sync:ivall/xcl:comment:7126740879 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/917#issuecomment-7126740879). Originally posted by [IvyNotFound](https://github.com/IvyNotFound) on 2026-11-24T08:55:51Z. --- **Tested on NVIDIA RTX 5080 (Blackwell, wave32) at `32976332072567e6fe9a7cc621e9cedce509ea2f`** **Tested** - GPU: NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), split wave64 path; CPU: AMD Ryzen 7 7800X3D - Windows 11 25H2 (build 26200.9974), rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), debug build - Game data: `XCL_SAMPLE_RPF` (retail `shaders.rpf`), `XCL_SAMPLE_DLLS`, `XCL_SAMPLE_TTPF`, `XCL_SAMPLE_BVH4` - `cargo build --workspace`: succeeded (the existing `fetch_update` deprecation warning only) - `cargo test --workspace --no-fail-fast -- --test-threads=4`: **715 passed, 3 failed, 41 ignored**; `SKIPPED` (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` - The PR's tests pass: `gpu_split_wave64_writelane_spill_shadows` (ran, no `SKIPPED` line), `upper_lanes::tests::spill_slots_come_from_their_shadow`, `spills_follow_writelane_for_both_halves`, `spills_stay_conservative_across_overwrites_branches_and_loops`; the existing `gpu_wave64_vs_spill_slots_and_identity` and `gpu_wave64_ps_spill_slots` pass too - `gpu_pso_e2e` with the pack: 7 passed (including `retail_es_gs_voxelize_geometry_mode` and the retail mesh / GS pipelines) - The 3 failures are the #718 flake you note in the description: `placed_title_textures_share_vram_and_preserve_pixels` (`cubemap extra_pages must be reused at same va`), then `transitions_apply_when_their_list_is_submitted` and `d32s8_targets_take_their_own_size_of_video_memory` on the `PoisonError`. The same three failed the same way on `main` `09940bb` on this machine. `cargo test -p xcl --lib -- --test-threads=4 title_textures::tests vram::tests` at this head, three runs: 20 passed, 0 failed each time. **Not tested** - `scripts/smoke.ps1` / the retail title, and the compile-time or DXIL-size numbers (not measured here) - release build; native wave64 (AMD) **AI use** - Claude Code, Claude Opus 5.5: ran the build and the tests and wrote this report. The numbers come from that run.
DarkPanda69 commented 2026-11-24 10:04:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-24T09:43:38Z.


AMD run with native 64-lane waves, plus NVIDIA. Updated for head 709abd7 (first run was on 3297633, same result).

Tested: pass, head 709abd7 applied on main aaa0936, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
cargo test -p xcl --lib -- gpu:: --test-threads=4:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 587 passed, 2 failed, 22 ignored. gpu_split_wave64_writelane_spill_shadows ok. The 2 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and _3, which fail the same way on main without this PR on this card.
  • NVIDIA RTX 3060, driver 32.0.16.1088, split wave64: 589 passed, 0 failed, 22 ignored. gpu_split_wave64_writelane_spill_shadows ok.

Not tested: retail gameplay.

Note: these runs check that the translated HLSL matches the test's reference model, in 64-lane and in 32-lane waves. They cannot show that the model matches the hardware.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7127805066 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7127805066). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-24T09:43:38Z. --- AMD run with native 64-lane waves, plus NVIDIA. Updated for head `709abd7` (first run was on `3297633`, same result). **Tested:** pass, head `709abd7` applied on `main` `aaa0936`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17. `cargo test -p xcl --lib -- gpu:: --test-threads=4`: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 587 passed, 2 failed, 22 ignored. `gpu_split_wave64_writelane_spill_shadows` ok. The 2 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `_3`, which fail the same way on `main` without this PR on this card. - NVIDIA RTX 3060, driver 32.0.16.1088, split wave64: 589 passed, 0 failed, 22 ignored. `gpu_split_wave64_writelane_spill_shadows` ok. **Not tested:** retail gameplay. Note: these runs check that the translated HLSL matches the test's reference model, in 64-lane and in 32-lane waves. They cannot show that the model matches the hardware. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
SlopTart commented 2026-11-24 11:05:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T10:37:21Z.


Linux / AMD RDNA3 datapoint.

Merged state: head 3297633 onto main 6efdabc, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 723 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. writelane spill-slot shadowing in split-wave64 green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7129024924 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/917#issuecomment-7129024924). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T10:37:21Z. --- Linux / AMD RDNA3 datapoint. **Merged state:** head `3297633` onto main `6efdabc`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **723 passed, 7 failed, 41 ignored**; failures are the known Wine-lane set from my #42 rows. writelane spill-slot shadowing in split-wave64 green. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
pvfreis commented 2026-11-24 14:36:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T14:36:42Z.

Review: COMMENTED


Review of 3297633 (merge base 1ec4c98; it merges cleanly into current main), by reading the code; nothing was built or run here. I checked that analyze_spills drops a VGPR's shadowed slots on every write rdna2::vgpr_uses lists (VALU, VMEM/DS loads, returning atomics, MIMG data registers), on a dynamic-lane v_writelane and on v_movrel*/v_swaprel*, gives up on indirect jumps, and that both halves still write the real VGPR lane. No defect found.

Questions for the author

  • In the GPU test, the "vector write" case reads v11, which no v_writelane wrote. Could it also spill to a slot, overwrite that VGPR with a VALU op, and read the slot from the upper half? Then a stale shadow would be caught on the GPU, not only by the analysis unit tests.
  • How were the DXC/PSO times and the rla_u counts taken (command, number of runs, cold or warm cache), so someone else can repeat them?

Review by Claude Code (written by Claude Opus 5.5, second read by Claude Fable 5.2); each point checked by a person before posting.

<!-- greyfinch-sync:ivall/xcl:review:6041220041 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#pullrequestreview-6041220041). Originally posted by [pvfreis](https://github.com/pvfreis) on 2026-11-24T14:36:42Z. **Review:** COMMENTED --- Review of `3297633` (merge base `1ec4c98`; it merges cleanly into current `main`), by reading the code; nothing was built or run here. I checked that `analyze_spills` drops a VGPR's shadowed slots on every write `rdna2::vgpr_uses` lists (VALU, VMEM/DS loads, returning atomics, MIMG data registers), on a dynamic-lane `v_writelane` and on `v_movrel*`/`v_swaprel*`, gives up on indirect jumps, and that both halves still write the real VGPR lane. No defect found. **Questions for the author** - In the GPU test, the "vector write" case reads v11, which no `v_writelane` wrote. Could it also spill to a slot, overwrite that VGPR with a VALU op, and read the slot from the upper half? Then a stale shadow would be caught on the GPU, not only by the analysis unit tests. - How were the DXC/PSO times and the `rla_u` counts taken (command, number of runs, cold or warm cache), so someone else can repeat them? Review by Claude Code (written by Claude Opus 5.5, second read by Claude Fable 5.2); each point checked by a person before posting.
zondy1i commented 2026-11-24 15:06:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by zondy1i on 2026-11-24T14:48:15Z.


Thanks for the code review! Answering both questions:

  1. Overwriting a previously spilled VGPR in the GPU test: Good point — gpu_split_wave64_writelane_spill_shadows currently tests vector invalidation on v11 (not previously spilled), while VALU overwrite of a spilled VGPR is covered by the analysis unit tests in upper_lanes.rs. I left 3297633 untouched for now to avoid invalidating the existing independent hardware PASS runs on this head, but happy to add a spill-then-VALU-overwrite-then-read case directly to the GPU test if desired.
  2. Measurement methodology:
    • The xcl_x_rla_uniform counts come from a one-off local Rust scan over all 10,490 wave64 CS/MS shaders in a retail shader corpus, calling recomp::translate with split-wave64 options and counting xcl_x_rla_uniform( occurrences before vs. after this PR.
    • The DXC and D3D12 PSO times come from a one-off local Rust benchmark calling recomp::translate -> dxc::compile -> ID3D12Device::CreateComputePipelineState (with recomp::pso::abi_root_signature_with) on a cold DXIL/PSO cache on Windows 11 + RTX 3060 Ti (single cold build per shader for base vs. PR).

AI use: Antigravity (Gemini 4 Neon) helped draft this reply from the code and measurement logs.

<!-- greyfinch-sync:ivall/xcl:comment:7134973361 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/917#issuecomment-7134973361). Originally posted by [zondy1i](https://github.com/zondy1i) on 2026-11-24T14:48:15Z. --- Thanks for the code review! Answering both questions: 1. **Overwriting a previously spilled VGPR in the GPU test:** Good point — `gpu_split_wave64_writelane_spill_shadows` currently tests vector invalidation on `v11` (not previously spilled), while VALU overwrite of a spilled VGPR is covered by the analysis unit tests in `upper_lanes.rs`. I left `3297633` untouched for now to avoid invalidating the existing independent hardware PASS runs on this head, but happy to add a spill-then-VALU-overwrite-then-read case directly to the GPU test if desired. 2. **Measurement methodology:** - The `xcl_x_rla_uniform` counts come from a one-off local Rust scan over all 10,490 wave64 CS/MS shaders in a retail shader corpus, calling `recomp::translate` with split-wave64 options and counting `xcl_x_rla_uniform(` occurrences before vs. after this PR. - The DXC and D3D12 PSO times come from a one-off local Rust benchmark calling `recomp::translate` -> `dxc::compile` -> `ID3D12Device::CreateComputePipelineState` (with `recomp::pso::abi_root_signature_with`) on a cold DXIL/PSO cache on Windows 11 + RTX 3060 Ti (single cold build per shader for base vs. PR). AI use: Antigravity (Gemini 4 Neon) helped draft this reply from the code and measurement logs.
pvfreis commented 2026-11-24 15:06:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pvfreis on 2026-11-24T14:57:51Z.


Thanks. I'd add the spill, VALU overwrite, read case to the GPU test: it is the one way a stale shadow gives a wrong value without failing anything, and the analysis unit tests don't run the emitted HLSL. It changes only the test, so the existing runs stay meaningful for the code.

On the numbers: the scan and the benchmark could live in the tree as an #[ignore] test that reads the shader pack from an XCL_SAMPLE_* variable, as the other game-data tests do (CONTRIBUTING, "Tests on game data"), so others can repeat them on their own GPUs.

Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7135235009 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/917#issuecomment-7135235009). Originally posted by [pvfreis](https://github.com/pvfreis) on 2026-11-24T14:57:51Z. --- Thanks. I'd add the spill, VALU overwrite, read case to the GPU test: it is the one way a stale shadow gives a wrong value without failing anything, and the analysis unit tests don't run the emitted HLSL. It changes only the test, so the existing runs stay meaningful for the code. On the numbers: the scan and the benchmark could live in the tree as an `#[ignore]` test that reads the shader pack from an `XCL_SAMPLE_*` variable, as the other game-data tests do (CONTRIBUTING, "Tests on game data"), so others can repeat them on their own GPUs. Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.
DavidM1911 commented 2026-11-25 10:10:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T09:31:02Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7158436208 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7158436208). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T09:31:02Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
thehollowedone commented 2026-11-25 23:09:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T22:50:19Z.


Independent RTX 3080 Ti check of #917 head 709abd7. Windows 11 build 26300, RTX 3080 Ti / driver 621.35, Ryzen 7 9800X3D, rustc 1.99.1, DXC 1.8.2502.11. The PR checkout was clean.

  • cargo test --offline --locked -p xcl --lib gpu_split_wave64_writelane_spill_shadows -- --test-threads=1 --nocapture, with XCL_D3D12_DEBUG=1: 1 passed, 0 failed, no skip. This is the stock GPU regression containing the spill, vector overwrite, and reload case.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 on the exact head, without the optional debug setting: 1,105 passed, 0 failed, 46 ignored across 20 test binaries; 23 explicit SKIPPED notices (19 no native wave64, 3 unsupported f16 forms, 1 no heap windows). The spill-shadow GPU test ran and passed.

I also made a clean, uncommitted merge of that same head into current main e1d84b7 in a disposable checkout. It merged without conflicts. The focused GPU test again passed 1/0 with no skip under XCL_D3D12_DEBUG=1. The full workspace suite on that merged tree passed 1,426/0/46 across 37 binaries, with 25 explicit SKIPPED notices (21 no native wave64, 3 unsupported f16 forms, 1 no heap windows). The merged-tree counts are integration evidence, not counts from the PR commit itself.

Not tested: retail smoke on this machine, cold DXC/PSO compile-time improvement, or native AMD wave64. AI use: Codex (GPT-6; exact variant unavailable) ran the tests and drafted this report; GPT-6.2 Astra Low reviewed the current diff.

<!-- greyfinch-sync:ivall/xcl:comment:7176845132 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7176845132). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-25T22:50:19Z. --- Independent RTX 3080 Ti check of [#917 head `709abd7`](https://github.com/xcl-dev/xcl/commit/709abd7fe1a546668c8631b2e691e58d71e3e233). Windows 11 build 26300, RTX 3080 Ti / driver 621.35, Ryzen 7 9800X3D, rustc 1.99.1, DXC 1.8.2502.11. The PR checkout was clean. - `cargo test --offline --locked -p xcl --lib gpu_split_wave64_writelane_spill_shadows -- --test-threads=1 --nocapture`, with `XCL_D3D12_DEBUG=1`: **1 passed, 0 failed, no skip**. This is the stock GPU regression containing the spill, vector overwrite, and reload case. - `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4` on the exact head, without the optional debug setting: **1,105 passed, 0 failed, 46 ignored** across 20 test binaries; **23 explicit `SKIPPED` notices** (19 no native wave64, 3 unsupported f16 forms, 1 no heap windows). The spill-shadow GPU test ran and passed. I also made a **clean, uncommitted merge** of that same head into [current `main` `e1d84b7`](https://github.com/xcl-dev/xcl/commit/e1d84b7d9153f86a97d2ec5d209d196046fc0bea) in a disposable checkout. It merged without conflicts. The focused GPU test again passed **1/0 with no skip** under `XCL_D3D12_DEBUG=1`. The full workspace suite on that merged tree passed **1,426/0/46** across 37 binaries, with **25 explicit `SKIPPED` notices** (21 no native wave64, 3 unsupported f16 forms, 1 no heap windows). The merged-tree counts are integration evidence, not counts from the PR commit itself. Not tested: retail smoke on this machine, cold DXC/PSO compile-time improvement, or native AMD wave64. AI use: Codex (GPT-6; exact variant unavailable) ran the tests and drafted this report; GPT-6.2 Astra Low reviewed the current diff.
JJAutoCompare commented 2026-11-26 22:49:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-26T22:49:03Z.


Tested

Independent run at clean PR head 709abd7fe1a546668c8631b2e691e58d71e3e233 on Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 x64 26200.9974, Rust/Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, debug test profile.

Prebuilt with cargo test --locked -p xcl --lib --no-run --message-format=json outside the GPU mutex. Ran <test-exe> gpu::recomp::tests::gpu_split_wave64_writelane_spill_shadows --exact --nocapture --test-threads=1 under the Arc mutex with XCL_ADAPTER=A770.

1 passed, 0 failed, 0 ignored and 0 GPU skips (3.71 s). HLSL/DXC split-wave64 readback matched both spill slots (0x11223344 and 0x55667788), the post-overwrite cross-half read (152), and the untouched control lane (0xDEAD0006).

Not tested

Branch-join behavior, native wave64, the workspace suite and retail smoke.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the original verification and summarized the saved results.

<!-- greyfinch-sync:ivall/xcl:comment:7205010152 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7205010152). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-26T22:49:03Z. --- **Tested** Independent run at clean PR head `709abd7fe1a546668c8631b2e691e58d71e3e233` on Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 x64 26200.9974, Rust/Cargo 1.100.0 MSVC, DXC/DXIL 1.9.2609.5, debug test profile. Prebuilt with `cargo test --locked -p xcl --lib --no-run --message-format=json` outside the GPU mutex. Ran `<test-exe> gpu::recomp::tests::gpu_split_wave64_writelane_spill_shadows --exact --nocapture --test-threads=1` under the Arc mutex with `XCL_ADAPTER=A770`. 1 passed, 0 failed, 0 ignored and 0 GPU skips (3.71 s). HLSL/DXC split-wave64 readback matched both spill slots (`0x11223344` and `0x55667788`), the post-overwrite cross-half read (`152`), and the untouched control lane (`0xDEAD0006`). **Not tested** Branch-join behavior, native wave64, the workspace suite and retail smoke. **AI use** T3 Code / Codex (gpt-6.2-sol) ran the original verification and summarized the saved results.
throny commented 2026-11-27 21:10:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-27T21:10:53Z.


merge-check claim
head: 709abd7fe1

<!-- greyfinch-sync:ivall/xcl:comment:7228209287 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7228209287). Originally posted by [throny](https://github.com/throny) on 2026-11-27T21:10:53Z. --- merge-check claim head: 709abd7fe1a546668c8631b2e691e58d71e3e233
throny commented 2026-11-27 21:27:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-27T21:27:14Z.


merge-check
base: 6089122a
head: 709abd7fe1
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1468 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1465 passed, 0 failed, 47 ignored
review: none. The spill analysis is a must-analysis (intersection at joins): a slot is dropped on any write to its register, on a dynamic-lane writelane and on movrel / swaprel; loop exits are handled and indirect jumps give up. Lane operands are masked. The case asked for in the thread (spill, overwrite, read) is in the GPU test.
performance: it changes a translator source: every tester re-translates all shaders once. Only split-wave64 programs that use writelane change: fewer cross-half exchanges at run time (reasoned).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7228457373 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7228457373). Originally posted by [throny](https://github.com/throny) on 2026-11-27T21:27:14Z. --- merge-check base: 6089122a head: 709abd7fe1a546668c8631b2e691e58d71e3e233 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1468 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1465 passed, 0 failed, 47 ignored review: none. The spill analysis is a must-analysis (intersection at joins): a slot is dropped on any write to its register, on a dynamic-lane writelane and on movrel / swaprel; loop exits are handled and indirect jumps give up. Lane operands are masked. The case asked for in the thread (spill, overwrite, read) is in the GPU test. performance: it changes a translator source: every tester re-translates all shaders once. Only split-wave64 programs that use writelane change: fewer cross-half exchanges at run time (reasoned). verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
thehollowedone commented 2026-11-27 22:24:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T22:24:53Z.


merge-check
base: 2c717a043c (main)
head: 709abd7fe1
merge: clean, uncommitted trial merge
build: cargo build --workspace --locked -> ok
tests: cargo test --workspace --locked --no-fail-fast -- --test-threads=4 -> 1,468 passed, 1 failed, 47 ignored; 25 GPU SKIPPED notices. All three new spill tests passed, including gpu_split_wave64_writelane_spill_shadows on the RTX 3080 Ti without a skip. The only failure, console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, is the same failure on clean main 2c717a04 with the same command and machine (1,465 passed, 1 failed, 47 ignored, 25 skips; paired baseline report).
review: No actionable finding in the four-file diff. The forward must-analysis intersects spill slots at joins, clears them on ordinary VGPR writes or dynamic-lane writes, and accounts for loop exits and indirect control flow. Only a proven constant-lane v_readlane_b32 uses the scalar shadow; the overwritten VGPR case still takes the cross-half exchange. The GPU test checks both halves and the overwritten case by readback.
performance: Proven spill reloads avoid a cross-half exchange in split wave64. The PR's three-shader timings suggest smaller DXIL and faster compile/PSO creation, but I did not repeat those measurements. The new analysis runs during translation; its CPU cost was not measured. Native wave64 lowering is unchanged.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300; RTX 3080 Ti 12 GB, NVIDIA 621.35; Ryzen 7 9800X3D; Rust 1.99.1 MSVC; DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the merge, build and full GPU suite, reviewed the diff and wrote this report; Codex (GPT-6.2 Astra) independently traced the spill analysis and emitter. I did not run a retail smoke on this head.

<!-- greyfinch-sync:ivall/xcl:comment:7229307810 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7229307810). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-27T22:24:53Z. --- merge-check base: 2c717a043c8488938179fca81da4bb9e7913a358 (`main`) head: 709abd7fe1a546668c8631b2e691e58d71e3e233 merge: clean, uncommitted trial merge build: `cargo build --workspace --locked` -> ok tests: `cargo test --workspace --locked --no-fail-fast -- --test-threads=4` -> 1,468 passed, 1 failed, 47 ignored; 25 GPU `SKIPPED` notices. All three new spill tests passed, including `gpu_split_wave64_writelane_spill_shadows` on the RTX 3080 Ti without a skip. The only failure, `console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk`, is the same failure on clean `main` `2c717a04` with the same command and machine (1,465 passed, 1 failed, 47 ignored, 25 skips; [paired baseline report](https://github.com/xcl-dev/xcl/pull/2431#issuecomment-7228968635)). review: No actionable finding in the four-file diff. The forward must-analysis intersects spill slots at joins, clears them on ordinary VGPR writes or dynamic-lane writes, and accounts for loop exits and indirect control flow. Only a proven constant-lane `v_readlane_b32` uses the scalar shadow; the overwritten VGPR case still takes the cross-half exchange. The GPU test checks both halves and the overwritten case by readback. performance: Proven spill reloads avoid a cross-half exchange in split wave64. The PR's three-shader timings suggest smaller DXIL and faster compile/PSO creation, but I did not repeat those measurements. The new analysis runs during translation; its CPU cost was not measured. Native wave64 lowering is unchanged. verdict: safe to merge hardware / tool and model: Windows 11 build 26300; RTX 3080 Ti 12 GB, NVIDIA 621.35; Ryzen 7 9800X3D; Rust 1.99.1 MSVC; DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the merge, build and full GPU suite, reviewed the diff and wrote this report; Codex (GPT-6.2 Astra) independently traced the spill analysis and emitter. I did not run a retail smoke on this head.
Foniass commented 2026-12-01 04:29:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:29:49Z.


Triage (#1607) – head 709abd7

No open or merged PR makes the same change: main's spill-slot shadows (4d64749, upper_lanes::analyze) cover wave64 VS / PS only, #3380 is wave32 graphics, and #944 batches exchanges instead of removing them. analyze_spills gives split-wave64 compute / mesh the shadows. The PR conflicts with main: emit.rs now declares xcl_hw32 and xcl_present for any upper and reads upper-lane shadows through xcl_present, so the self.x64() branches need to be redone against that code when rebasing.

Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300792705 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/917#issuecomment-7300792705). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:29:49Z. --- **Triage (#1607)** – head 709abd7 No open or merged PR makes the same change: main's spill-slot shadows (4d64749, `upper_lanes::analyze`) cover wave64 VS / PS only, #3380 is wave32 graphics, and #944 batches exchanges instead of removing them. `analyze_spills` gives split-wave64 compute / mesh the shadows. The PR conflicts with main: emit.rs now declares `xcl_hw32` and `xcl_present` for any `upper` and reads upper-lane shadows through `xcl_present`, so the `self.x64()` branches need to be redone against that code when rebasing. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/917:upstream-pr/917'
git switch 'upstream-pr/917'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/917'
git switch 'upstream-pr/917'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/917'
git switch 'upstream-pr/917'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/917'
git switch 'main'
git merge --squash 'upstream-pr/917'
git switch 'main'
git merge --ff-only 'upstream-pr/917'
git switch 'main'
git merge 'upstream-pr/917'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!911
No description provided.