Recompiler: reuse repeated s_buffer_load_dword* loads in direct DXIL #2246

Open
ramon-victor wants to merge 1 commit from upstream-pr/2256 into main
ramon-victor commented 2026-11-25 11:34:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ramon-victor on 2026-11-25T11:34:44Z.


Extends the direct DXIL scalar load reuse pass (gpu::dxil::reload) to follow s_buffer_load_dword* in addition to s_load_dword*, so repeated non-coherent constant-buffer loads reuse their earlier post-bounds-check values instead of re-emitting buffer bounds checks, window selection, and dx.op.rawBufferLoad calls.

Part of #1269.

What is in it

  • crates/xcl/src/gpu/dxil/reload.rs: extend Key with a buffer: bool flag so s_load_dword* and s_buffer_load_dword* cannot alias; match S_BUFFER_LOAD_DWORD..DWORDX16 (excluding GLC/DLC coherent loads, requiring sbase <= 121 for the 4-SGPR descriptor, and tracking all four sbase..sbase+4 descriptor registers in reads() as well as rejecting loads whose SDATA overlaps any descriptor or offset register). Add unit tests for 4-SGPR invalidation, self-overwrite/GLC exclusion, non-aliasing, rawBufferLoad count reduction, and a wave32 GPU execution test checking repeated load reuse (including OOB zeroing) and fresh reload after a global store.
  • crates/xcl/src/gpu/dxil/lower_mem.rs: check self.reload at the top of Lw::smem before branching on s_buffer_load* so available s_buffer_load_dword* repeats read their saved SSA variables directly.

On a seeded 600-program sample (xcl shaders <archive> --direct --sample 600 --seed 3 --max-bytes 40000 --validate --threads 8, 573 programs within the cap), all 573/573 validate cleanly (0 validator failures):

  • Total emitted DXIL: 42,232,344 B -> 42,202,120 B (-30,224 B, -0.07%)
  • Translation time p95: 302.6 ms -> 292.3 ms

Tested

  • Hardware and toolchain: NVIDIA GeForce RTX 3070 (8 GiB, driver 621.24, wave32), AMD Ryzen 7 5700X, Windows 11 Pro 26300, rustc 1.99.0 (x86_64-pc-windows-msvc), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0).
  • cargo test -p xcl --lib gpu::dxil::reload::tests (debug): 9 passed; 0 failed (including s_buffer_load_reuses_and_tracks_four_sgpr_base, the_translator_emits_a_repeated_s_buffer_load_once, and gpu_repeated_s_buffer_load_matches_fresh_load on the RTX 3070).
  • .\scripts\test.ps1 (debug, full workspace): 1246 passed; 0 failed; 46 ignored (25 GPU sub-checks skipped on this wave32 adapter: 21 no wave64, 1 no heap windows, 3 per-lane #1426 refusals).
  • cargo build --release -p xcl + direct DXIL validation sweep on 573 sampled retail shader programs: 573/573 translated and dxil.dll-validated (0 failures).

Regression run

xcl-smoke v1
commit: f087b998d0d51a9f11bbfa0761967a63e778edd9
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14467 MB
xcl-smoke v1
commit: 69b0bf635f778ff79ccfca4025328ddee044e2bb
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1619 (PresentX 1619)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14479 MB

Not tested

  • Native wave64 GPU hardware (AMD/Intel): RTX 3070 only supports wave32, so native wave64 tests skip on this adapter.
  • Sample-gated tests (XCL_SAMPLE_* env vars unset).

AI use

  • Antigravity (Gemini 4 Neon): analyzed reload.rs and lower_mem.rs, implemented s_buffer_load_dword* reuse and unit/GPU tests, ran the workspace test suite, retail shader validation sweep, and 60 s smoke regression run.
<!-- greyfinch-sync:ivall/xcl:issue:5490545586 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256). Originally posted by [ramon-victor](https://github.com/ramon-victor) on 2026-11-25T11:34:44Z. --- Extends the direct DXIL scalar load reuse pass (`gpu::dxil::reload`) to follow `s_buffer_load_dword*` in addition to `s_load_dword*`, so repeated non-coherent constant-buffer loads reuse their earlier post-bounds-check values instead of re-emitting buffer bounds checks, window selection, and `dx.op.rawBufferLoad` calls. Part of #1269. **What is in it** - `crates/xcl/src/gpu/dxil/reload.rs`: extend `Key` with a `buffer: bool` flag so `s_load_dword*` and `s_buffer_load_dword*` cannot alias; match `S_BUFFER_LOAD_DWORD`..`DWORDX16` (excluding `GLC`/`DLC` coherent loads, requiring `sbase <= 121` for the 4-SGPR descriptor, and tracking all four `sbase..sbase+4` descriptor registers in `reads()` as well as rejecting loads whose `SDATA` overlaps any descriptor or offset register). Add unit tests for 4-SGPR invalidation, self-overwrite/GLC exclusion, non-aliasing, `rawBufferLoad` count reduction, and a wave32 GPU execution test checking repeated load reuse (including OOB zeroing) and fresh reload after a global store. - `crates/xcl/src/gpu/dxil/lower_mem.rs`: check `self.reload` at the top of `Lw::smem` before branching on `s_buffer_load*` so available `s_buffer_load_dword*` repeats read their saved SSA variables directly. On a seeded 600-program sample (`xcl shaders <archive> --direct --sample 600 --seed 3 --max-bytes 40000 --validate --threads 8`, 573 programs within the cap), all 573/573 validate cleanly (`0` validator failures): - Total emitted DXIL: `42,232,344 B -> 42,202,120 B` (`-30,224 B`, `-0.07%`) - Translation time p95: `302.6 ms -> 292.3 ms` **Tested** - Hardware and toolchain: NVIDIA GeForce RTX 3070 (8 GiB, driver `621.24`, wave32), AMD Ryzen 7 5700X, Windows 11 Pro `26300`, `rustc 1.99.0` (`x86_64-pc-windows-msvc`), DXC/DXIL `1.8.2502.11` (Windows SDK `10.0.26100.0`). - `cargo test -p xcl --lib gpu::dxil::reload::tests` (debug): `9 passed; 0 failed` (including `s_buffer_load_reuses_and_tracks_four_sgpr_base`, `the_translator_emits_a_repeated_s_buffer_load_once`, and `gpu_repeated_s_buffer_load_matches_fresh_load` on the RTX 3070). - `.\scripts\test.ps1` (debug, full workspace): `1246 passed; 0 failed; 46 ignored` (25 GPU sub-checks skipped on this wave32 adapter: 21 `no wave64`, 1 `no heap windows`, 3 per-lane `#1426` refusals). - `cargo build --release -p xcl` + direct DXIL validation sweep on 573 sampled retail shader programs: `573/573` translated and `dxil.dll`-validated (`0` failures). **Regression run** ``` xcl-smoke v1 commit: f087b998d0d51a9f11bbfa0761967a63e778edd9 gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14467 MB ``` ``` xcl-smoke v1 commit: 69b0bf635f778ff79ccfca4025328ddee044e2bb gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1619 (PresentX 1619) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14479 MB ``` **Not tested** - Native wave64 GPU hardware (AMD/Intel): RTX 3070 only supports wave32, so native wave64 tests skip on this adapter. - Sample-gated tests (`XCL_SAMPLE_*` env vars unset). **AI use** - Antigravity (Gemini 4 Neon): analyzed `reload.rs` and `lower_mem.rs`, implemented `s_buffer_load_dword*` reuse and unit/GPU tests, ran the workspace test suite, retail shader validation sweep, and 60 s smoke regression run.
itsSio commented 2026-11-25 12:06:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by itsSio on 2026-11-25T11:43:48Z.


Tested

Independent Windows verification on clean 69b0bf635f778ff79ccfca4025328ddee044e2bb. Windows 11 Pro 26200 and x64 MSVC on both PCs, unoptimized dev/test with debug info off. cargo build --workspace --locked and cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture both exited 0 on both PCs.

GPU / driver CPU, RAM, toolchain Passed / failed / ignored Runtime SKIPPED
RTX 5080 / 32.0.16.1088 Ryzen 7 9800X3D, 32 GiB; Rust 1.97.0, DXC/DXIL 1.9.2609.5 1246 / 0 / 46 25
RTX 2080 SUPER / 32.0.16.1088 Ryzen 5 5600X, 16 GiB; Rust 1.99.1, DXC/DXIL 1.8.2502.11 1246 / 0 / 46 27

Both logged 20 native-wave64 skips, three per-lane f16/f32 refusals, unavailable driver-cache control and unavailable heap windows. The RTX 2080 SUPER also logged two skips for the missing D3D12 debug layer.

cargo test -p xcl --lib --locked gpu::dxil::reload::tests -- --test-threads=1 --nocapture: 9 / 0 / 0, no runtime skips, on both RTX cards and the Radeon RDNA2 iGPU (32.0.21043.5001, same Ryzen 7 system and toolchain). This includes the Direct DXIL load-reuse GPU test: the reused load matched the first load and the load after a store saw the updated value. That fixture explicitly uses wave32, including on Radeon.

Wave64 follow-up (test-only overlay): In separate scratch checkouts at the same head, I changed only the existing #[cfg(test)] fixture: use wave64_programs_supported(), request direct_kernel_full(&code, true), initialize all 64 lanes, and print the adapter and split_wave64() result. All shader instructions and result assertions were unchanged. The modified reload.rs was byte-identical on both PCs (SHA-256 08422f00d39710c94bd0404562fcbab6d50114ee2c4fd53b970231b0ef19e880). No runtime code changed; the clean-head results above are separate.

cargo test --locked -p xcl --lib gpu::dxil::reload::tests::gpu_repeated_s_buffer_load_matches_fresh_load_wave64_probe -- --exact --test-threads=1 --nocapture, with the same per-PC hardware and toolchains above: 1 passed / 0 failed / 0 ignored / 0 skipped on the Radeon RDNA2 iGPU (native wave64, split_wave64=false) and on each RTX card (split wave64, split_wave64=true). The modified fixture passed the same expected-value, bounds and post-store reload assertions in both wave64 forms.

Not tested

Full AMD workspace, Intel, retail smoke or shader samples, and performance.

AI use

Ran via Samaritan:

  • OpenCode with OpenAI GPT-6.2 Sol (openai/gpt-6.2-sol): ran the Windows checks, prepared and ran the test-only wave64 overlay, verified the logs and wave modes, and wrote this report. No subagents contributed to this check.
<!-- greyfinch-sync:ivall/xcl:comment:7161423532 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256#issuecomment-7161423532). Originally posted by [itsSio](https://github.com/itsSio) on 2026-11-25T11:43:48Z. --- **Tested** Independent Windows verification on clean `69b0bf635f778ff79ccfca4025328ddee044e2bb`. Windows 11 Pro 26200 and x64 MSVC on both PCs, unoptimized dev/test with debug info off. `cargo build --workspace --locked` and `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture` both exited 0 on both PCs. | GPU / driver | CPU, RAM, toolchain | Passed / failed / ignored | Runtime `SKIPPED` | | --- | --- | ---: | ---: | | RTX 5080 / `32.0.16.1088` | Ryzen 7 9800X3D, 32 GiB; Rust 1.97.0, DXC/DXIL 1.9.2609.5 | **1246 / 0 / 46** | 25 | | RTX 2080 SUPER / `32.0.16.1088` | Ryzen 5 5600X, 16 GiB; Rust 1.99.1, DXC/DXIL 1.8.2502.11 | **1246 / 0 / 46** | 27 | Both logged 20 native-wave64 skips, three per-lane f16/f32 refusals, unavailable driver-cache control and unavailable heap windows. The RTX 2080 SUPER also logged two skips for the missing D3D12 debug layer. `cargo test -p xcl --lib --locked gpu::dxil::reload::tests -- --test-threads=1 --nocapture`: **9 / 0 / 0**, no runtime skips, on both RTX cards and the Radeon RDNA2 iGPU (`32.0.21043.5001`, same Ryzen 7 system and toolchain). This includes the Direct DXIL load-reuse GPU test: the reused load matched the first load and the load after a store saw the updated value. That fixture explicitly uses wave32, including on Radeon. **Wave64 follow-up (test-only overlay):** In separate scratch checkouts at the same head, I changed only the existing `#[cfg(test)]` fixture: use `wave64_programs_supported()`, request `direct_kernel_full(&code, true)`, initialize all 64 lanes, and print the adapter and `split_wave64()` result. All shader instructions and result assertions were unchanged. The modified `reload.rs` was byte-identical on both PCs (SHA-256 `08422f00d39710c94bd0404562fcbab6d50114ee2c4fd53b970231b0ef19e880`). No runtime code changed; the clean-head results above are separate. `cargo test --locked -p xcl --lib gpu::dxil::reload::tests::gpu_repeated_s_buffer_load_matches_fresh_load_wave64_probe -- --exact --test-threads=1 --nocapture`, with the same per-PC hardware and toolchains above: **1 passed / 0 failed / 0 ignored / 0 skipped** on the Radeon RDNA2 iGPU (native wave64, `split_wave64=false`) and on each RTX card (split wave64, `split_wave64=true`). The modified fixture passed the same expected-value, bounds and post-store reload assertions in both wave64 forms. **Not tested** Full AMD workspace, Intel, retail smoke or shader samples, and performance. **AI use** Ran via Samaritan: - OpenCode with OpenAI GPT-6.2 Sol (`openai/gpt-6.2-sol`): ran the Windows checks, prepared and ran the test-only wave64 overlay, verified the logs and wave modes, and wrote this report. No subagents contributed to this check.
nnonno91 commented 2026-11-25 16:12:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T15:24:45Z.


Independent Windows check of 69b0bf635f778ff79ccfca4025328ddee044e2bb. Repeated shader loads returned the original value, and the load after a store read the updated value on both adapters.

Tested

  • Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, Radeon integrated graphics (32.0.21042.62), RTX 5090 (32.0.16.1742), Rust 1.100.0 x64 MSVC, Windows SDK DXC/DXIL 1.8.2502.11. Unoptimized test profile.
  • Clean head, cargo test --locked -p xcl --lib gpu::dxil::reload::tests -- --nocapture --test-threads=1 on each selected adapter: 9 passed, 0 failed, 0 ignored, no logged skips per adapter. The stock GPU test uses wave32.
  • Temporarily adapted the GPU fixture to translate for wave64 and initialize all 64 lanes. cargo test --locked -p xcl --lib gpu_repeated_s_buffer_load_matches_fresh_load -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, no logged skips per adapter. The logs identified native wave64 on Radeon and split wave64 on RTX 5090. The fixture also confirmed that the out-of-bounds fourth word returned zero before and after reuse. Restored the clean checkout.

Not tested

Parent revision, performance, retail titles, or the full workspace suite.

AI use

OpenAI Codex (GPT-6.2 Sol) prepared and ran the tests, verified the results, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7166801445 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256#issuecomment-7166801445). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-25T15:24:45Z. --- Independent Windows check of `69b0bf635f778ff79ccfca4025328ddee044e2bb`. Repeated shader loads returned the original value, and the load after a store read the updated value on both adapters. **Tested** - Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, Radeon integrated graphics (32.0.21042.62), RTX 5090 (32.0.16.1742), Rust 1.100.0 x64 MSVC, Windows SDK DXC/DXIL 1.8.2502.11. Unoptimized test profile. - Clean head, `cargo test --locked -p xcl --lib gpu::dxil::reload::tests -- --nocapture --test-threads=1` on each selected adapter: 9 passed, 0 failed, 0 ignored, no logged skips per adapter. The stock GPU test uses wave32. - Temporarily adapted the GPU fixture to translate for wave64 and initialize all 64 lanes. `cargo test --locked -p xcl --lib gpu_repeated_s_buffer_load_matches_fresh_load -- --nocapture --test-threads=1`: 1 passed, 0 failed, 0 ignored, no logged skips per adapter. The logs identified native wave64 on Radeon and split wave64 on RTX 5090. The fixture also confirmed that the out-of-bounds fourth word returned zero before and after reuse. Restored the clean checkout. **Not tested** Parent revision, performance, retail titles, or the full workspace suite. **AI use** OpenAI Codex (GPT-6.2 Sol) prepared and ran the tests, verified the results, and wrote this report.
DavidM1911 commented 2026-11-25 17:07:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T16:53:27Z.


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:7168686611 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256#issuecomment-7168686611). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T16:53:27Z. --- 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!
luckyteagirl commented 2026-11-26 09:07:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:07:52Z.

Review: COMMENTED


On 69b0bf6, this PR extends available-load reuse to S_BUFFER_LOAD_DWORD*, but reload::changes still misses VOPC SDWA's SD=1, SDST SGPR write. For example, two identical S_BUFFER_LOAD_DWORD instructions using descriptor s[4:7], separated by V_CMP_EQ_U32 SDWA writing s4, can reuse the first load's value for the second even though the descriptor base changed. The new buffer-load key makes this instruction family subject to the existing missed invalidation; the base emits two loads.

#2479 fixes the SDWA invalidation for the same analysis. Could this PR be stacked/rebased on that fix, or include it before buffer-load reuse is merged? Extending its CPU analysis fixture to a changed buffer descriptor would pin down this new instruction family. Source review only; I did not run the synthetic program.

<!-- greyfinch-sync:ivall/xcl:review:6071218420 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256#pullrequestreview-6071218420). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T09:07:52Z. **Review:** COMMENTED --- On `69b0bf6`, this PR extends available-load reuse to `S_BUFFER_LOAD_DWORD*`, but `reload::changes` still misses `VOPC` SDWA's `SD=1, SDST` SGPR write. For example, two identical `S_BUFFER_LOAD_DWORD` instructions using descriptor `s[4:7]`, separated by `V_CMP_EQ_U32` SDWA writing `s4`, can reuse the first load's value for the second even though the descriptor base changed. The new buffer-load key makes this instruction family subject to the existing missed invalidation; the base emits two loads. #2479 fixes the SDWA invalidation for the same analysis. Could this PR be stacked/rebased on that fix, or include it before buffer-load reuse is merged? Extending its CPU analysis fixture to a changed buffer descriptor would pin down this new instruction family. Source review only; I did not run the synthetic program.
Decodere commented 2026-11-27 04:45:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T04:45:23Z.


Independent desktop NVIDIA verification of PR #2256 at head 69b0bf635f778ff79ccfca4025328ddee044e2bb (1 commit; exact parent & merge-base: 426a5a745db4d5e4b037449ede0b70cb342f5192, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (69b0bf63)

Command Result
cargo test --release -p xcl --lib s_buffer_load_reuses_and_tracks_four_sgpr_base -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1202 filtered out × 3 (0.00s × 3, 0 skipped)
cargo test --release -p xcl --lib the_translator_emits_a_repeated_s_buffer_load_once -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1202 filtered out × 3 (0.01s × 3, 0 skipped)
cargo test --release -p xcl --lib gpu_repeated_s_buffer_load_matches_fresh_load -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1202 filtered out × 3 (0.21s, 0.19s, 0.18s, 0 skipped; live RTX 4060 execution)
cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4 (3 consecutive runs) 150 passed; 0 failed; 3 ignored; 1050 filtered out × 3 (3.27s, 3.18s, 3.29s, 0 skipped)
cargo build --release -p xcl Clean build (1m 09s, exit 0, 0 new warnings)

Paired quiet 60 s retail smoke (title: 29640639)

Exact parent & merge-base (426a5a745db4d5e4b037449ede0b70cb342f5192, same machine):

xcl-smoke v1
commit: 426a5a745db4d5e4b037449ede0b70cb342f5192
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1591 (PresentX 1591)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14477 MB

PR #2256 (69b0bf635f778ff79ccfca4025328ddee044e2bb):

xcl-smoke v1
commit: 69b0bf635f778ff79ccfca4025328ddee044e2bb
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1575 (PresentX 1575)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14460 MB

Runtime log observations (xcl.log)

  • 9202 log lines, 0 [ERROR] / device-removal / panic lines (dxil_cache: 460 hits, 0 misses, 0 compilation failures; 228 background pipelines, 0 failures).
  • Final draw/memory telemetry in log: 19441 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample 14460 MB committed by the process; video memory 6116 MB local, 4683 MB non-local.

Limits of coverage

  • Repeated s_buffer_load_dword* reuse, 4-SGPR descriptor-base invalidation tracking, single-load emission, and live RTX 4060 equivalence against fresh loads were directly verified via all 3 new tests (3/3 each, 0 skipped) and gpu::dxil:: (150/150 × 3).
  • The 60 s retail smoke confirms zero runtime regression on title: 29640639 (single-run frame/commit delta vs. parent reflects normal startup variance, not this PR); direct-DXIL shader size or compile-time savings on cold retail shader caches were not separately profiled.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7210068864 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256#issuecomment-7210068864). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T04:45:23Z. --- Independent desktop NVIDIA verification of **PR #2256** at head `69b0bf635f778ff79ccfca4025328ddee044e2bb` (`1` commit; exact parent & merge-base: `426a5a745db4d5e4b037449ede0b70cb342f5192`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted release tests & build (`69b0bf63`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib s_buffer_load_reuses_and_tracks_four_sgpr_base -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1202 filtered out` × 3 (`0.00s` × 3, `0` skipped) | | `cargo test --release -p xcl --lib the_translator_emits_a_repeated_s_buffer_load_once -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1202 filtered out` × 3 (`0.01s` × 3, `0` skipped) | | `cargo test --release -p xcl --lib gpu_repeated_s_buffer_load_matches_fresh_load -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1202 filtered out` × 3 (`0.21s`, `0.19s`, `0.18s`, `0` skipped; live RTX 4060 execution) | | `cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4` (3 consecutive runs) | `150 passed; 0 failed; 3 ignored; 1050 filtered out` × 3 (`3.27s`, `3.18s`, `3.29s`, `0` skipped) | | `cargo build --release -p xcl` | Clean build (`1m 09s`, exit `0`, `0` new warnings) | ### Paired quiet 60 s retail smoke (`title: 29640639`) Exact parent & merge-base (`426a5a745db4d5e4b037449ede0b70cb342f5192`, same machine): ``` xcl-smoke v1 commit: 426a5a745db4d5e4b037449ede0b70cb342f5192 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1591 (PresentX 1591) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14477 MB ``` PR #2256 (`69b0bf635f778ff79ccfca4025328ddee044e2bb`): ``` xcl-smoke v1 commit: 69b0bf635f778ff79ccfca4025328ddee044e2bb gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1575 (PresentX 1575) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14460 MB ``` ### Runtime log observations (`xcl.log`) - `9202` log lines, `0` `[ERROR]` / device-removal / panic lines (`dxil_cache`: `460` hits, `0` misses, `0` compilation failures; `228` background pipelines, `0` failures). - Final draw/memory telemetry in log: `19441 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped)`; last memory sample `14460 MB committed by the process; video memory 6116 MB local, 4683 MB non-local`. ### Limits of coverage - Repeated `s_buffer_load_dword*` reuse, 4-SGPR descriptor-base invalidation tracking, single-load emission, and live RTX 4060 equivalence against fresh loads were directly verified via all 3 new tests (`3/3` each, `0` skipped) and `gpu::dxil::` (`150/150` × 3). - The 60 s retail smoke confirms zero runtime regression on `title: 29640639` (single-run frame/commit delta vs. parent reflects normal startup variance, not this PR); direct-DXIL shader size or compile-time savings on cold retail shader caches were not separately profiled. *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
ClosetPie107 commented 2026-11-27 12:51:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T12:51:44Z.


Independent test report under Wine/Proton (not native Windows) for head 69b0bf63.

Setup

  • AMD Radeon RX 9070 (RDNA4, RADV GFX1201, Mesa 26.3.1, wave64), Ryzen 5 9600X, CachyOS Linux 7.3.5
  • Proton Experimental experimental-11.0-20261112, vkd3d-proton master ec207194 with a local patch dropping the lpVtbl checks in d3d12_command_allocator_from_iface / d3d12_command_list_from_iface, DXC 1.9.2609.5, Rust 1.96.0, x86_64-pc-windows-gnu
  • Head merged onto main 83b00818, test commit 80882b0d

Tests (debug, XCL_REQUIRE_GPU=wave64, --test-threads=1)

  • gpu::dxil::reload::: 9 passed, 0 failed (main: 6 passed, 0 failed), including gpu_repeated_s_buffer_load_matches_fresh_load on this wave64 GPU
  • cargo test --workspace --no-fail-fast -- --test-threads=4, lib binary: 1323 passed, 9 failed, 27 ignored (main the same run: 1320 passed, 9 failed, 27 ignored). The failures are all among main's.

Retail title, 300 s (release, XCL_DIRECT_DXIL=1; XCL_PREPARE=1 XCL_PSO_PRELOAD=1 XCL_PSO_WAIT_MS=50 XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=1024 VKD3D_CONFIG=ignore_shared_fence, A pressed every 10 s)

  • The direct translator's cache id changes with this PR, so the first run from the warm snapshot re-translates every program: the preparation was not done after 20 minutes (no presents; any cold cache does this here). A second run on the same cache finished the preparation at ~140 s and then ran: exit 0, no crash, no device removal, 2,138 presents. main, 4 runs from the snapshot: all exit 0, 0 crashes, 1,892–2,122 presents.

Not tested

  • Native Windows, NVIDIA/Intel, wave32 GPUs
  • A comparison of the emitted DXIL size or translation time

AI use

  • Claude Code (Claude Opus 5.5) wrote the test scripts, ran the tests and runs on this machine and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7218764018 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256#issuecomment-7218764018). Originally posted by [ClosetPie107](https://github.com/ClosetPie107) on 2026-11-27T12:51:44Z. --- Independent test report under Wine/Proton (not native Windows) for head `69b0bf63`. **Setup** - AMD Radeon RX 9070 (RDNA4, RADV GFX1201, Mesa 26.3.1, wave64), Ryzen 5 9600X, CachyOS Linux 7.3.5 - Proton Experimental `experimental-11.0-20261112`, vkd3d-proton master `ec207194` with a local patch dropping the `lpVtbl` checks in `d3d12_command_allocator_from_iface` / `d3d12_command_list_from_iface`, DXC `1.9.2609.5`, Rust 1.96.0, `x86_64-pc-windows-gnu` - Head merged onto `main` `83b00818`, test commit `80882b0d` **Tests** (debug, `XCL_REQUIRE_GPU=wave64`, `--test-threads=1`) - `gpu::dxil::reload::`: 9 passed, 0 failed (`main`: 6 passed, 0 failed), including `gpu_repeated_s_buffer_load_matches_fresh_load` on this wave64 GPU - `cargo test --workspace --no-fail-fast -- --test-threads=4`, lib binary: 1323 passed, 9 failed, 27 ignored (`main` the same run: 1320 passed, 9 failed, 27 ignored). The failures are all among `main`'s. **Retail title, 300 s** (release, `XCL_DIRECT_DXIL=1`; `XCL_PREPARE=1 XCL_PSO_PRELOAD=1 XCL_PSO_WAIT_MS=50 XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=1024 VKD3D_CONFIG=ignore_shared_fence`, `A` pressed every 10 s) - The direct translator's cache id changes with this PR, so the first run from the warm snapshot re-translates every program: the preparation was not done after 20 minutes (no presents; any cold cache does this here). A second run on the same cache finished the preparation at ~140 s and then ran: exit 0, no crash, no device removal, 2,138 presents. `main`, 4 runs from the snapshot: all exit 0, 0 crashes, 1,892–2,122 presents. **Not tested** - Native Windows, NVIDIA/Intel, wave32 GPUs - A comparison of the emitted DXIL size or translation time **AI use** - Claude Code (Claude Opus 5.5) wrote the test scripts, ran the tests and runs on this machine and wrote this report.
Foniass commented 2026-12-01 07:41:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:41:21Z.


Triage (#1607) – head 69b0bf6

No open or merged PR extends the reload analysis to s_buffer_load_dword*. Main still keys only S_LOAD_DWORD* in reload.rs::key. When you rebase, main has added reload.rs::dep_mask, which still assumes a 2-SGPR base (k.0, k.0 + 1, k.1). It has to cover the 4 descriptor SGPRs and the shifted key layout (buffer, sbase, soff, ...), or writes to sbase+2/+3 will not kill a buffer load's availability. The reuse path in lower_mem.rs skips buffer_window the same way the s_load path already skips window_at.
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:7304361424 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2256#issuecomment-7304361424). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:41:21Z. --- **Triage (#1607)** – head 69b0bf6 No open or merged PR extends the `reload` analysis to `s_buffer_load_dword*`. Main still keys only `S_LOAD_DWORD*` in `reload.rs::key`. When you rebase, main has added `reload.rs::dep_mask`, which still assumes a 2-SGPR base (`k.0`, `k.0 + 1`, `k.1`). It has to cover the 4 descriptor SGPRs and the shifted key layout `(buffer, sbase, soff, ...)`, or writes to sbase+2/+3 will not kill a buffer load's availability. The reuse path in `lower_mem.rs` skips `buffer_window` the same way the `s_load` path already skips `window_at`. 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/2256:upstream-pr/2256'
git switch 'upstream-pr/2256'

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/2256'
git switch 'upstream-pr/2256'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2256'
git switch 'upstream-pr/2256'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2256'
git switch 'main'
git merge --squash 'upstream-pr/2256'
git switch 'main'
git merge --ff-only 'upstream-pr/2256'
git switch 'main'
git merge 'upstream-pr/2256'
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!2246
No description provided.