Recompiler: compact form splits out repeated memory ops and dead SGPR stores #3261

Merged
Foniass merged 2 commits from upstream-pr/3261 into main 2026-11-29 22:50:34 +00:00
Foniass commented 2026-11-29 02:13:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T02:13:13Z.


Stacked on #3250; only the top commit (16f2f5c1) belongs here.

Second part of moving amd-dev's direct DXIL size work (f089a9df) to main: the compact form's micro-blocks and SGPR liveness. This is where the NVIDIA driver's compile time goes down. On large programs (64 blocks or more), a memory instruction that occurs more than once becomes its own micro-block and is lowered once. Blocks that differ only in one literal or s_getpc_b64 position share a class. Successors can come from a target pool. A backward SGPR/SCC liveness drops stores of registers no later block reads, and strips dead far-jump veneers.

What is in it

  • crates/xcl/src/gpu/dxil/compact.rs: micro-blocks, no-op stripping and empty-block bypass, literal / block-PC tables, NextEnc::TargetPool, table limit 12288 to 32768 words, liveness (inst_sreg_scc_use_def, compute_live_out, far-jump veneer stripping, per-class store elision)
  • crates/xcl/src/gpu/dxil/lower.rs, kernel.rs: compact_lit / compact_blk_pc for the parameterized literal and s_getpc_b64
  • the fix of 33d1222d (open as #2604, which cannot land on main without this code): s_cmov* / s_addk / s_mulk / s_bitset* read their destination, wave32 VALU mask writes define one SGPR
  • new here, a fix to the ported code: SDWA sources with S1 set are SGPR uses (the port only handled S0), so an SGPR read through SDWA VSRC1 no longer has its store dropped. Test: sdwa_sgpr_sources_are_uses (fails without the fix)
  • new tests: repeated_loads_split_into_micro_blocks_and_literals_into_a_table and gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form (a 200-copy program with a repeated s_load, a per-copy literal and early outs; compact against plain on the GPU)

Why one commit, and why over 800 lines
On an RTX 5070 Ti, the micro-blocks without the liveness make the retail title's largest compute program (95cc13288a27a96e) a pipeline the NVIDIA driver refuses with E_OUTOFMEMORY. With the liveness it builds. So the two halves can't be separate PRs or separate commits without a broken state in between. Of the 890 changed lines, about 200 are tests.

Tested

  • NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), release builds for the measurements
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 16f2f5c1: 2607 passed, 6 failed, 49 ignored
    • 4 failures are gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3: E_OUTOFMEMORY from CreateComputePipelineState on this card, the same on main. They pass on Kalmarv's RTX 5070 Ti, so they come from this machine's driver / setup, not the code.
    • 2 were the e2e tests test_title_runs_and_game_folder_is_untouched and incomplete_discovered_corpus_blocks_headless_title_entry, because the test title was not built in that worktree; after cargo build --workspace, cargo test -p xcl --test e2e: 5 passed, 0 failed
    • SKIPPED GPU tests: 30, almost all no wave64; also two_pass_binds_set_the_shared_view_heap (no heap windows) and pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache); the new GPU compact test ran
  • Retail title, every program translated (xcl shaders --direct --sample 0 --max-bytes 0) with #3250 and with this PR: 16307 programs, 5 change (only large ones take the micro-block form):
    • 95cc13288a27a96e: 784 KB to 251 KB
    • 56c0cd3b82a00c6e: 449 KB to 291 KB
    • 958400d2caf07244: 405 KB to 253 KB
    • two 75 KB programs: byte-different, the same size
  • The driver builds all 5 (--precompile --only cs --pipelines --records <the 5>): 5 made, 0 refused
  • Cold driver build of the 6 largest compute pipelines of the title, 1 thread, fresh caches: 49.3 s with #3250, 26.0 s with this change (the before numbers are on #3250)

Regression run

The PR's run used -StartupTimeoutSeconds 3600: new DXIL means the title's shader preparation rebuilds its pipelines before the timed minute.

main:

xcl-smoke v1
commit: b10cc4c6766adc947c2054ada4a2af98be15108d
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1565 (PresentX 1565)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16026 MB

this PR:

xcl-smoke v1
commit: 16f2f5c106e11760eca77a0ada31ba7eee04804b
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1550 (PresentX 1550)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15985 MB

Not tested

  • AMD GPUs and wave64 hardware
  • Whether the image looks the same (frame counts only)
  • Other titles; on this one only 5 programs take the new form
  • Kernel mode (tests only): when the loop budget runs out at a loop header, a register whose store was dropped because that header overwrites it would be dumped stale. Compute shaders have nothing live at the end, so the runtime is not affected.

AI use

  • Claude Code with Claude Opus 5.5: split this part out of f089a9df, merged in 33d1222d, found and fixed the SDWA S1 gap, wrote the new tests, found the A-without-B refusal on NVIDIA, ran the tests, measurements and smoke runs above, wrote this description
  • The original code is from amd-dev's f089a9df (raylitebull, from 46aecbf7, written with Antigravity (Gemini 4 Neon High)) and 33d1222d (Alp Pesen, Antigravity (Gemini 4 Neon))

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5546719377 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T02:13:13Z. --- Stacked on #3250; only the top commit (`16f2f5c1`) belongs here. Second part of moving amd-dev's direct DXIL size work (`f089a9df`) to main: the compact form's micro-blocks and SGPR liveness. This is where the NVIDIA driver's compile time goes down. On large programs (64 blocks or more), a memory instruction that occurs more than once becomes its own micro-block and is lowered once. Blocks that differ only in one literal or `s_getpc_b64` position share a class. Successors can come from a target pool. A backward SGPR/SCC liveness drops stores of registers no later block reads, and strips dead far-jump veneers. **What is in it** - `crates/xcl/src/gpu/dxil/compact.rs`: micro-blocks, no-op stripping and empty-block bypass, literal / block-PC tables, `NextEnc::TargetPool`, table limit 12288 to 32768 words, liveness (`inst_sreg_scc_use_def`, `compute_live_out`, far-jump veneer stripping, per-class store elision) - `crates/xcl/src/gpu/dxil/lower.rs`, `kernel.rs`: `compact_lit` / `compact_blk_pc` for the parameterized literal and `s_getpc_b64` - the fix of `33d1222d` (open as #2604, which cannot land on main without this code): `s_cmov*` / `s_addk` / `s_mulk` / `s_bitset*` read their destination, wave32 VALU mask writes define one SGPR - **new here, a fix to the ported code:** SDWA sources with `S1` set are SGPR uses (the port only handled `S0`), so an SGPR read through SDWA `VSRC1` no longer has its store dropped. Test: `sdwa_sgpr_sources_are_uses` (fails without the fix) - new tests: `repeated_loads_split_into_micro_blocks_and_literals_into_a_table` and `gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form` (a 200-copy program with a repeated `s_load`, a per-copy literal and early outs; compact against plain on the GPU) **Why one commit, and why over 800 lines** On an RTX 5070 Ti, the micro-blocks without the liveness make the retail title's largest compute program (`95cc13288a27a96e`) a pipeline the NVIDIA driver refuses with `E_OUTOFMEMORY`. With the liveness it builds. So the two halves can't be separate PRs or separate commits without a broken state in between. Of the 890 changed lines, about 200 are tests. **Tested** - NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), release builds for the measurements - `cargo test --workspace --no-fail-fast -- --test-threads=4` on 16f2f5c1: 2607 passed, 6 failed, 49 ignored - 4 failures are `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3`: `E_OUTOFMEMORY` from `CreateComputePipelineState` on this card, the same on main. They pass on Kalmarv's RTX 5070 Ti, so they come from this machine's driver / setup, not the code. - 2 were the e2e tests `test_title_runs_and_game_folder_is_untouched` and `incomplete_discovered_corpus_blocks_headless_title_entry`, because the test title was not built in that worktree; after `cargo build --workspace`, `cargo test -p xcl --test e2e`: 5 passed, 0 failed - SKIPPED GPU tests: 30, almost all `no wave64`; also `two_pass_binds_set_the_shared_view_heap` (no heap windows) and `pso_measurement_compiles_an_exact_synthetic_record` (cannot disable the driver cache); the new GPU compact test ran - Retail title, every program translated (`xcl shaders --direct --sample 0 --max-bytes 0`) with #3250 and with this PR: 16307 programs, **5 change** (only large ones take the micro-block form): - `95cc13288a27a96e`: 784 KB to 251 KB - `56c0cd3b82a00c6e`: 449 KB to 291 KB - `958400d2caf07244`: 405 KB to 253 KB - two 75 KB programs: byte-different, the same size - The driver builds all 5 (`--precompile --only cs --pipelines --records <the 5>`): 5 made, 0 refused - Cold driver build of the 6 largest compute pipelines of the title, 1 thread, fresh caches: 49.3 s with #3250, 26.0 s with this change (the before numbers are on #3250) **Regression run** The PR's run used `-StartupTimeoutSeconds 3600`: new DXIL means the title's shader preparation rebuilds its pipelines before the timed minute. main: ``` xcl-smoke v1 commit: b10cc4c6766adc947c2054ada4a2af98be15108d gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1565 (PresentX 1565) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16026 MB ``` this PR: ``` xcl-smoke v1 commit: 16f2f5c106e11760eca77a0ada31ba7eee04804b gpu: NVIDIA GeForce RTX 5070 Ti title: 3cb1d8e0 seconds: 60 exit: 0x0 frames shown: 1550 (PresentX 1550) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 15985 MB ``` **Not tested** - AMD GPUs and wave64 hardware - Whether the image looks the same (frame counts only) - Other titles; on this one only 5 programs take the new form - Kernel mode (tests only): when the loop budget runs out at a loop header, a register whose store was dropped because that header overwrites it would be dumped stale. Compute shaders have nothing live at the end, so the runtime is not affected. **AI use** - Claude Code with Claude Opus 5.5: split this part out of `f089a9df`, merged in `33d1222d`, found and fixed the SDWA `S1` gap, wrote the new tests, found the A-without-B refusal on NVIDIA, ran the tests, measurements and smoke runs above, wrote this description - The original code is from amd-dev's `f089a9df` (raylitebull, from `46aecbf7`, written with Antigravity (Gemini 4 Neon High)) and `33d1222d` (Alp Pesen, Antigravity (Gemini 4 Neon)) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Kalmarv commented 2026-11-29 03:23:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T03:23:02Z.


merge-check
base: fa204595a4
head: 16f2f5c106
merge: clean (stacked on #3250, merges cleanly onto main and with the 7-PR stack).
build: cargo build --workspace -> ok; cargo build --release -p xcl -> ok.
tests: tested in the clean 7-PR stack (#3250+#3261+#3263+#3264+#3265+#3266+#3268) on main fa204595: cargo test --workspace --no-fail-fast -- --test-threads=4 (DXC 1.9.2609.5; -p xcl --lib rerun skipping the 2 known main #3187 uma_driver mixed-window tests a_refused_gpu_upload_segment_becomes_custom and mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment) -> 2620 passed, 0 failed, 49 ignored (2481 lib + 139 integration, 25 SKIPPED notices; all 4 fuzz_validate_and_gpu_0..3 passed); failing: none. 150 s xcl-smoke (ea3b5e4d, XCL_PREPARE=0, RTX 5070 Ti) on the combined 8-PR stack: exit: 0x0, 2096 frames shown, 0 device removals, 0 crashes, 0 display System events, 32049 MB peak commit.
review: none (diff reviewed: micro-block splitting for repeated memory ops on >=64-block programs, literal/PC table sharing, target pool, backward SGPR/SCC liveness with conservative s_movrel*/s_cmov*/SDWA S0+S1 uses; kernel-mode ABI keeps all registers live).
performance: positive: shrinks large compact-form CS DXIL and pipeline compile time; no runtime regression in 150 s smoke (2096 frames, 32049 MB peak commit).
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (wave32 only), Windows 11, DXC 1.9.2609.5 via XCL_DXC_DIR; Antigravity (Gemini 3.5 Pro) ran the merges, builds, workspace test suites, 150 s title smokes, diff reviews, and drafted this check.

<!-- greyfinch-sync:ivall/xcl:comment:7250014411 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261#issuecomment-7250014411). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-29T03:23:02Z. --- merge-check base: fa204595a488c60c6c5f905244f0172072c9c2a9 head: 16f2f5c106e11760eca77a0ada31ba7eee04804b merge: clean (stacked on #3250, merges cleanly onto main and with the 7-PR stack). build: cargo build --workspace -> ok; cargo build --release -p xcl -> ok. tests: tested in the clean 7-PR stack (#3250+#3261+#3263+#3264+#3265+#3266+#3268) on main `fa204595`: `cargo test --workspace --no-fail-fast -- --test-threads=4` (DXC 1.9.2609.5; `-p xcl --lib` rerun skipping the 2 known `main` #3187 `uma_driver` mixed-window tests `a_refused_gpu_upload_segment_becomes_custom` and `mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment`) -> 2620 passed, 0 failed, 49 ignored (2481 lib + 139 integration, 25 SKIPPED notices; all 4 `fuzz_validate_and_gpu_0..3` passed); failing: none. 150 s `xcl-smoke` (`ea3b5e4d`, `XCL_PREPARE=0`, RTX 5070 Ti) on the combined 8-PR stack: `exit: 0x0`, `2096` frames shown, `0` device removals, `0` crashes, `0` display System events, `32049 MB` peak commit. review: none (diff reviewed: micro-block splitting for repeated memory ops on >=64-block programs, literal/PC table sharing, target pool, backward SGPR/SCC liveness with conservative `s_movrel*`/`s_cmov*`/SDWA S0+S1 uses; kernel-mode ABI keeps all registers live). performance: positive: shrinks large compact-form CS DXIL and pipeline compile time; no runtime regression in 150 s smoke (2096 frames, 32049 MB peak commit). verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (wave32 only), Windows 11, DXC 1.9.2609.5 via XCL_DXC_DIR; Antigravity (Gemini 3.5 Pro) ran the merges, builds, workspace test suites, 150 s title smokes, diff reviews, and drafted this check.
moombathepilot commented 2026-11-29 18:28:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by moombathepilot on 2026-11-29T18:28:14Z.


merge-check

base: 0fe06eb0f0

head: 16f2f5c106

merge: clean. The trial merge includes #3250 (e13ccd7fff), the PR head’s parent. No later stack slices were added.

build: cargo build --workspace -> ok. cargo build --release -p xcl also passed on main, the exact PR head, and the trial merge.

tests: cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture -> 2,740 passed, 3 failed, 49 ignored. 12 SKIPPED notices: 6 unsupported per-lane f16/f32 cases, 2 no heap windows, 3 missing D3D12 debug layer, and 1 driver cache could not be disabled.

  • New failure: gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form at compact_tests.rs:180. The compact shader returned (50, 0, 1, 5) instead of (50, 10045, 1, 5). It reproduced in isolated reruns with XCL_SPLIT_WAVE64=0 and =1 using cargo test -p xcl --lib gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form -- --exact --nocapture --test-threads=1. This fixture is new in the PR and is absent on main.
  • Existing failures: fuzz_validate_and_gpu_1 (seed 722) and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (two-pass state release) match earlier targeted runs on this exact unmodified main commit and machine.
  • The new CPU micro-block planning and SDWA liveness tests passed.

review: Read the compact-form changes and the stacked bitcode prerequisite. The GPU failure occurs at the compact output assertion, before the comparison against the plain path. The isolated runs report 401 blocks of 4 kinds. The cause of the missing SGPR 1 accumulation is unconfirmed. git diff --cached --check passed.

performance: 60-second scripts/smoke.ps1 -Game <folder> -Seconds 60 -StartupTimeoutSeconds 300 runs on title 817b32af, with XCL_PREPARE=0, networking off and no input. All three exited 0 with zero crashes and zero device removals.

Build Frames shown Peak commit
main 1596 15103 MB
trial merge 416bb94f973c458462eb1d339811486273786902 1644 16336 MB
exact PR head 1610 16873 MB

These are startup smoke results. Gameplay and visual parity were not checked. The cold PSO check with XCL_DIRECT_DXIL=1 and --measure-pso 95cc13288a27a96e --repeat 1 exited 2 because D3D12 could not disable the driver cache (0x887A002D), so cold compile time was not measured.

verdict: not yet: the new compact-form GPU test returns the wrong scalar accumulator on RX 7800 XT in both native and forced split wave64.

hardware / tool and model: Radeon RX 7800 XT (32.0.32029.2010), Ryzen 7 5700X3D, Windows 11 Home build 26300, Rust 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17. Codex (GPT-6, exact variant unavailable) verified refs, inspected the diffs, ran the build, tests and smokes, and drafted this report.

Reviewed by the posting user before submission.

<!-- greyfinch-sync:ivall/xcl:comment:7260507889 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261#issuecomment-7260507889). Originally posted by [moombathepilot](https://github.com/moombathepilot) on 2026-11-29T18:28:14Z. --- merge-check base: 0fe06eb0f05459007ebfffc67bb9983acb3a832d head: 16f2f5c106e11760eca77a0ada31ba7eee04804b merge: clean. The trial merge includes #3250 (e13ccd7fff4d29f7382e56d0df44a65154710a5f), the PR head’s parent. No later stack slices were added. build: `cargo build --workspace` -> ok. `cargo build --release -p xcl` also passed on main, the exact PR head, and the trial merge. tests: `cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture` -> **2,740 passed, 3 failed, 49 ignored**. 12 `SKIPPED` notices: 6 unsupported per-lane f16/f32 cases, 2 no heap windows, 3 missing D3D12 debug layer, and 1 driver cache could not be disabled. - **New failure:** `gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form` at `compact_tests.rs:180`. The compact shader returned `(50, 0, 1, 5)` instead of `(50, 10045, 1, 5)`. It reproduced in isolated reruns with `XCL_SPLIT_WAVE64=0` and `=1` using `cargo test -p xcl --lib gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form -- --exact --nocapture --test-threads=1`. This fixture is new in the PR and is absent on main. - **Existing failures:** `fuzz_validate_and_gpu_1` (seed 722) and `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` (two-pass state release) match earlier targeted runs on this exact unmodified main commit and machine. - The new CPU micro-block planning and SDWA liveness tests passed. review: Read the compact-form changes and the stacked bitcode prerequisite. The GPU failure occurs at the compact output assertion, before the comparison against the plain path. The isolated runs report 401 blocks of 4 kinds. The cause of the missing SGPR 1 accumulation is unconfirmed. `git diff --cached --check` passed. performance: 60-second `scripts/smoke.ps1 -Game <folder> -Seconds 60 -StartupTimeoutSeconds 300` runs on title `817b32af`, with `XCL_PREPARE=0`, networking off and no input. All three exited 0 with zero crashes and zero device removals. | Build | Frames shown | Peak commit | | --- | ---: | ---: | | main | 1596 | 15103 MB | | trial merge `416bb94f973c458462eb1d339811486273786902` | 1644 | 16336 MB | | exact PR head | 1610 | 16873 MB | These are startup smoke results. Gameplay and visual parity were not checked. The cold PSO check with `XCL_DIRECT_DXIL=1` and `--measure-pso 95cc13288a27a96e --repeat 1` exited 2 because D3D12 could not disable the driver cache (`0x887A002D`), so cold compile time was not measured. verdict: not yet: the new compact-form GPU test returns the wrong scalar accumulator on RX 7800 XT in both native and forced split wave64. hardware / tool and model: Radeon RX 7800 XT (32.0.32029.2010), Ryzen 7 5700X3D, Windows 11 Home build 26300, Rust 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17. Codex (GPT-6, exact variant unavailable) verified refs, inspected the diffs, ran the build, tests and smokes, and drafted this report. Reviewed by the posting user before submission.
KOLESNiii commented 2026-11-29 22:39:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-29T22:39:21Z.

Review: COMMENTED


Static review of 16f2f5c1 for the stack in the #3041 comparison.

Wave32 liveness can drop a live SGPR store. inst_sreg_scc_use_def treats the destination of S_AND_SAVEEXEC_B64 s[4:5], ??? as a two-register definition. Wave32 lowering writes only s4. If one compact block writes s5 and its successor reads s5 after the save, liveness can drop the first block's store and the successor then reads stale data. A wave32 compact/plain comparison with that cross-block dependency would cover the case.

Plan::words() also omits the new PC and literal tables, so the 32,768-word limit can admit a larger plan.

Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.

<!-- greyfinch-sync:ivall/xcl:review:6105175077 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261#pullrequestreview-6105175077). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-29T22:39:21Z. **Review:** COMMENTED --- Static review of `16f2f5c1` for the stack in the [#3041 comparison](https://github.com/xcl-dev/xcl/issues/3041#issuecomment-7263214809). **Wave32 liveness can drop a live SGPR store.** [`inst_sreg_scc_use_def`](https://github.com/xcl-dev/xcl/blob/16f2f5c1/crates/xcl/src/gpu/dxil/compact.rs#L70-L85) treats the destination of `S_AND_SAVEEXEC_B64 s[4:5], ???` as a two-register definition. [Wave32 lowering](https://github.com/xcl-dev/xcl/blob/16f2f5c1/crates/xcl/src/gpu/dxil/lower.rs#L1365-L1375) writes only `s4`. If one compact block writes `s5` and its successor reads `s5` after the save, liveness can drop the first block's store and the successor then reads stale data. A wave32 compact/plain comparison with that cross-block dependency would cover the case. [`Plan::words()`](https://github.com/xcl-dev/xcl/blob/16f2f5c1/crates/xcl/src/gpu/dxil/compact.rs#L241-L267) also omits the new PC and literal tables, so the 32,768-word limit can admit a larger plan. Review assisted by Codex (GPT-6, exact variant unavailable). No new build or GPU run for this review.
Foniass commented 2026-11-29 23:17:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T23:17:35Z.


Thanks for the RX 7800 XT run. It caught a real bug that NVIDIA can't show. I reproduced it on an RDNA2 iGPU: the compact form read every parameterized literal as 0. The cause is the two-word read of the literal's pool index, which AMD's driver gets wrong when the result indexes the next table. The same DXIL is right on NVIDIA. This PR was merged before the fix, so the fix is #3473. A rerun of gpu::dxil::compact_tests on that branch on your card would confirm it on RDNA3.

(Claude Code, Claude Opus 5.5, for Foniass)

<!-- greyfinch-sync:ivall/xcl:comment:7264348703 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261#issuecomment-7264348703). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T23:17:35Z. --- Thanks for the RX 7800 XT run. It caught a real bug that NVIDIA can't show. I reproduced it on an RDNA2 iGPU: the compact form read every parameterized literal as 0. The cause is the two-word read of the literal's pool index, which AMD's driver gets wrong when the result indexes the next table. The same DXIL is right on NVIDIA. This PR was merged before the fix, so the fix is #3473. A rerun of `gpu::dxil::compact_tests` on that branch on your card would confirm it on RDNA3. (Claude Code, Claude Opus 5.5, for Foniass)
KDenKC commented 2026-11-30 08:24:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-30T08:24:15Z.


@Prime1997 @Foniass: a regression on main from this PR (16f2f5c1), confirmed on two NVIDIA cards.

What happens. The title's largest compute program, 95cc13288a27a96e (the one this PR shrinks from 784 KB to 251 KB), never finishes its Dispatch in the new compact form, and the device is removed at the first world frames. BBareth found it first on an RTX 5070 Ti (#505, comment 7271589972). On our RTX 5090 32 GB, on main d52ff48c (plus #3094 and #3281, which do nothing without their switches, and here ran with them off):

[   57.962] D3D12.X: driver compile start #1816: compute PSO, 228708 B DXIL, record 95cc13288a27a96e, driver blob supplied
[  119.439] activity (2 s): 22 presents, 100 submits, 14100 draws, 9552 dispatches
[  119.461] D3D12.X: split command list (type 2) around mid-list Wait after Write64 (#4)
[  119.720] D3D12 device removed: 0x887a0006 The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application.
[  119.721] DRED device state: 7

The same tree with only 16f2f5c1 reverted:

[   42.320] D3D12.X: driver compile start #1833: compute PSO, 612824 B DXIL, record 95cc13288a27a96e, driver blob supplied
[  107.387] activity (2 s): 13 presents, 101 submits, 18566 draws, 14678 dispatches
[  261.836] D3D12.X: split command list (type 2) around mid-list Wait after Write64 (#256)
[  375.570] activity (2 s): 15 presents, 282 submits, 74697 draws, 72234 dispatches
  • main: removed in the world in 2 of 2 runs (with and without other switches). With 16f2f5c1 reverted: the world in 2 of 2 runs, 268 s and 246 s in it, 0 removals.
  • DRED stops at the same place on both cards: operation 93 of 393 of one list, the Dispatch after cs 95cc13288a27a96e is bound.
  • Building just that program plain (the compact table limit back to 12,288 words) or skipping it (XCL_SKIP_CS=95cc13288a27a96e) also avoids it.
  • Not the shader-code heap of #2403: every run here uses the same NVIDIA profile (2 GiB, keyed by the exe name each run uses), and these removals are 0x887a0006 with DRED state 7 at a known Dispatch, not a silent 0x887a0005.

Why it was easy to miss. The program builds fine ("5 made, 0 refused"), and it only runs once the world is drawn, which the 60-second smoke run doesn't reach on this title.

A suggestion for translator changes. A change in gpu/dxil or gpu/recomp changes the translated programs, so every tester rebuilds their shader cache to pick it up, and again for any fix. And as this PR shows, such a change can pass every current check (the suite, a driver build of each changed program, the 60-second smoke run) and still stop main from loading the world. So for PRs that touch the translator, it's probably worth asking for a full run that confirms the title still enters the world, not only the smoke run. It's an expensive check, but a failure here is far more expensive: this one stops the world from loading for anyone running current main on NVIDIA (two cards so far), and the fix costs every tester another full shader-cache rebuild, which takes hours. A number of cards in this thread already get into the world, so the check is within reach, and it would have caught this before everyone paid for it.

It may also help if translator changes come from, or are checked by, someone who can load the world themselves.

Meanwhile we run main with 16f2f5c1 reverted locally, and say so in our reports, until a fix lands. Before this merge, our runs on an older main reached the prologue's first interior scene every time (0 device removals in the 16 runs that reached the world), and that's the baseline we're working from on the room's lighting.

Related: #505, #2403.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.

<!-- greyfinch-sync:ivall/xcl:comment:7272865912 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261#issuecomment-7272865912). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-30T08:24:15Z. --- @Prime1997 @Foniass: a regression on `main` from this PR (`16f2f5c1`), confirmed on two NVIDIA cards. **What happens.** The title's largest compute program, `95cc13288a27a96e` (the one this PR shrinks from 784 KB to 251 KB), never finishes its Dispatch in the new compact form, and the device is removed at the first world frames. BBareth found it first on an RTX 5070 Ti (#505, comment 7271589972). On our RTX 5090 32 GB, on `main` `d52ff48c` (plus #3094 and #3281, which do nothing without their switches, and here ran with them off): ``` [ 57.962] D3D12.X: driver compile start #1816: compute PSO, 228708 B DXIL, record 95cc13288a27a96e, driver blob supplied [ 119.439] activity (2 s): 22 presents, 100 submits, 14100 draws, 9552 dispatches [ 119.461] D3D12.X: split command list (type 2) around mid-list Wait after Write64 (#4) [ 119.720] D3D12 device removed: 0x887a0006 The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application. [ 119.721] DRED device state: 7 ``` The same tree with only `16f2f5c1` reverted: ``` [ 42.320] D3D12.X: driver compile start #1833: compute PSO, 612824 B DXIL, record 95cc13288a27a96e, driver blob supplied [ 107.387] activity (2 s): 13 presents, 101 submits, 18566 draws, 14678 dispatches [ 261.836] D3D12.X: split command list (type 2) around mid-list Wait after Write64 (#256) [ 375.570] activity (2 s): 15 presents, 282 submits, 74697 draws, 72234 dispatches ``` - `main`: removed in the world in 2 of 2 runs (with and without other switches). With `16f2f5c1` reverted: the world in 2 of 2 runs, 268 s and 246 s in it, 0 removals. - DRED stops at the same place on both cards: operation 93 of 393 of one list, the Dispatch after `cs 95cc13288a27a96e` is bound. - Building just that program plain (the compact table limit back to 12,288 words) or skipping it (`XCL_SKIP_CS=95cc13288a27a96e`) also avoids it. - Not the shader-code heap of #2403: every run here uses the same NVIDIA profile (2 GiB, keyed by the exe name each run uses), and these removals are `0x887a0006` with DRED state 7 at a known Dispatch, not a silent `0x887a0005`. **Why it was easy to miss.** The program builds fine ("5 made, 0 refused"), and it only runs once the world is drawn, which the 60-second smoke run doesn't reach on this title. **A suggestion for translator changes.** A change in `gpu/dxil` or `gpu/recomp` changes the translated programs, so every tester rebuilds their shader cache to pick it up, and again for any fix. And as this PR shows, such a change can pass every current check (the suite, a driver build of each changed program, the 60-second smoke run) and still stop `main` from loading the world. So for PRs that touch the translator, it's probably worth asking for a full run that confirms the title still enters the world, not only the smoke run. It's an expensive check, but a failure here is far more expensive: this one stops the world from loading for anyone running current `main` on NVIDIA (two cards so far), and the fix costs every tester another full shader-cache rebuild, which takes hours. A number of cards in this thread already get into the world, so the check is within reach, and it would have caught this before everyone paid for it. It may also help if translator changes come from, or are checked by, someone who can load the world themselves. **Meanwhile** we run `main` with `16f2f5c1` reverted locally, and say so in our reports, until a fix lands. Before this merge, our runs on an older `main` reached the prologue's first interior scene every time (0 device removals in the 16 runs that reached the world), and that's the baseline we're working from on the room's lighting. Related: #505, #2403. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.
KDenKC commented 2026-11-30 18:16:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-30T18:16:53Z.


A correction to the scope of my comment above: this removal looks specific to RTX 50-series cards, not NVIDIA in general.

throny ran main with #3261 on an RTX 4080 (#505, comment 7287561824): the record 95cc13288a27a96e was built in the same compact form that hangs here (228,708 B and 237,860 B of DXIL) and both runs stayed in the world for about 13 and 18 minutes after it without a removal, and none of their 20-odd runs on main since lost the device. The two cards where it removes the device are both Blackwell (BBareth's RTX 5070 Ti and our RTX 5090).

So the same compact program runs on Ada and never finishes on Blackwell, which may help find the fault (a difference in how the two driver generations compile it). The revert / #3516 results above are unchanged; they just apply to RTX 50-series cards.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.

<!-- greyfinch-sync:ivall/xcl:comment:7287614232 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261#issuecomment-7287614232). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-30T18:16:53Z. --- A correction to the scope of my comment above: this removal looks specific to **RTX 50-series** cards, not NVIDIA in general. throny ran `main` with #3261 on an RTX 4080 (#505, comment 7287561824): the record `95cc13288a27a96e` was built in the same compact form that hangs here (228,708 B and 237,860 B of DXIL) and both runs stayed in the world for about 13 and 18 minutes after it without a removal, and none of their 20-odd runs on `main` since lost the device. The two cards where it removes the device are both Blackwell (BBareth's RTX 5070 Ti and our RTX 5090). So the same compact program runs on Ada and never finishes on Blackwell, which may help find the fault (a difference in how the two driver generations compile it). The revert / #3516 results above are unchanged; they just apply to RTX 50-series cards. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.
KDenKC commented 2026-11-30 18:16:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-30T18:16:55Z.


A narrowing from throny (#505, 7287561824): on an RTX 4080 (Ada, 621.40) this compact form of 95cc13288a27a96e is built and runs 13-18 minutes in the world without a removal, over 20-odd runs on main. The two cards where it hangs, BBareth's RTX 5070 Ti and our RTX 5090, are both Blackwell. So this looks Blackwell-specific (the driver's code for that architecture), not wrong on every card.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.

<!-- greyfinch-sync:ivall/xcl:comment:7287615078 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3261#issuecomment-7287615078). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-30T18:16:55Z. --- A narrowing from throny (#505, 7287561824): on an RTX 4080 (Ada, 621.40) this compact form of `95cc13288a27a96e` is built and runs 13-18 minutes in the world without a removal, over 20-odd runs on `main`. The two cards where it hangs, BBareth's RTX 5070 Ti and our RTX 5090, are both Blackwell. So this looks Blackwell-specific (the driver's code for that architecture), not wrong on every card. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.
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!3261
No description provided.