Recompiler: use u128 dependency masks for reload invalidation #2761
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2761
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2761"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@amazedturnip on GitHub · 2026-11-26 10:27 UTC · original
amazedturnip:xcl/recompiler-reload-sgpr-dependency-masks-101316→main· +89 −2 · 2 files · 1 commits · openPrecomputes one u128 dependency mask per tracked address in gpu/dxil/reload.rs so fixed-point availability and recording time use a single regs & mask != 0 test instead of a 128-wide per-register scan, with identical emitted reload decisions. New sibling test file pins bitmask agreement with the original reads() scan across base/offset/sentinel shapes and adversarial changes() masks; full 60s retail smoke and the AMD Radeon suite remain green.
Fixes #2747
What is in it
crates/xcl/src/gpu/dxil/reload.rs: precompute oneu128dependency mask per tracked address (dep_mask: base pair + offset register, including the SOFFSET=125 sentinel) and replace the 128-widereads(k, r)scan inside the fixed-pointstepclosure and at recording time with a singleregs & m != 0test. Analysis results, transfer order, memory clobbers and instruction effects are unchanged.crates/xcl/src/gpu/dxil/reload_dep_mask_tests.rs(new sibling test file, declared next to the existingmod tests):dep_mask_agrees_with_reads_for_all_tracked_address_shapeschecks per-register-bit agreement across base/offset-sentinel shapes, andmask_intersection_matches_per_register_scanchecks the mask decision against the per-register scan for every tracked key against adversarialchanges()masks (0, u128::MAX, isolated base/offset bits, sentinel bit, pair bits).Tested
AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64),XCL_ADAPTER=radeon):cargo test --workspace -- --test-threads=4— 1311 passed, 1 failed, 27 ignored (SKIPPED GPU tests: 1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 1 (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 1 (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), 1 (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), 1 (cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)); pre-existing upstream/main failures excluded: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1)Regression run
main:
PR:
Not tested
AI use
@DarkPanda69 on GitHub · 2026-11-26 10:35 UTC · original · edited 2026-11-26 13:39 UTC
Update for head
7cbc651: paired rerun onmainb49be18withXCL_DIRECT_DXIL=1, same cards. On both, the only result changes againstmainaredep_mask_agrees_with_reads_for_all_tracked_address_shapes,mask_intersection_matches_per_register_scanand the newa_write_to_one_slot_base_invalidates_only_that_slot, all ok, with no new skips. RTX 3060: 710 → 713 passed, 0 failed, 24 SKIPPED. RX 9070 XT: 708 → 711 passed, 2 failed (#2115, the same onmain), 6 SKIPPED.NVIDIA wave32 run (listed as untested) on an RTX 3060, plus an RX 9070 XT: both new tests pass, and nothing else changes in the direct-DXIL GPU suite.
Head
fdbf8bfapplied onmainb49be18, debug, Windows 11 Pro 26200,XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4onmainand with the PR, card chosen withXCL_ADAPTER:mainOn both cards, the only result changes against
mainare the newdep_mask_agrees_with_reads_for_all_tracked_address_shapesandmask_intersection_matches_per_register_scan, both ok, with no new skips. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same onmain.Not tested: translation timings on Windows, Intel, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@frenziedcoder on GitHub · 2026-11-26 10:44 UTC · original
Checked "identical emitted reload decisions" on a real shader pack: the direct DXIL of every program in the retail title of #505 is byte-for-byte the same with and without this PR.
xcl shaders <shaders.rpf> --direct --sample 0 --threads 12 --dump DIR, release builds ofmainb49be183and offdbf8bf(this PR on that base), Windows 11, RTX 5080 box (CPU-only translation), DXC 1.8.2502.11:b49be183fdbf8bf.direct.dxiloutputsSo the mask form makes the same reload decisions as the per-register scan on this corpus. End-to-end translation time doesn't move measurably here; the fixed-point step isn't a visible share of whole-program translation on these shaders.
AI use: Claude Code (Claude Opus 5.5) built both trees, ran the dumps on my machine, compared them and wrote this comment. The dumps were deleted afterwards.
@emirduran707 on GitHub · 2026-11-26 10:45 UTC · original
Independent AMD RDNA4 (native wave64) verification of exact PR head
fdbf8bf69a5f518f02b82f6d52ce96df56e57b7aon Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC1.9.2602.17).Tested
cargo build --workspace(debug): passed (0errors).cargo test --workspace --no-fail-fast -- --test-threads=4:1435 passed, 2 failed, 47 ignored(8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1heap_window_out_of_memory_falls_back_to_the_switch_formno heap windows, 1pso_measurement_compiles_an_exact_synthetic_recordWindows Developer Mode off).gpu::dxil::reload::reload_dep_mask_tests::dep_mask_agrees_with_reads_for_all_tracked_address_shapesgpu::dxil::reload::reload_dep_mask_tests::mask_intersection_matches_per_register_scangpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1andfuzz_validate_and_gpu_3) are pre-existing on unmodifiedmainon this RX 9060 XT / driver32.0.31044.16.cargo build --release -p xcl+ 60 s retail-title smoke test (scripts/smoke.ps1, offline):(Compare against
mainb49be183on this machine:1603 frames, 18576 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@CryingLaughing on GitHub · 2026-11-26 11:10 UTC · original
A synthetic case where reload analysis takes a large share of translation time shows where the masks help. The fixture uses 8,199 instructions, 4,097 blocks and 128 tracked addresses. I used the same test-only overlay on parent
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7and exact headfdbf8bf69a5f518f02b82f6d52ce96df56e57b7a, with separate release builds and confirmed different test binary hashes.The large fixture and a second 11-load fixture both produced byte-identical reload-decision traces (36,448 and 137 bytes) and DXIL (99,608 and 3,420 bytes). The focused test was 1 passed, 0 failed, 0 ignored per revision. Both upstream mask tests passed on the head with zero failures or ignores. No capability skips.
Tested on an i5-13600K, Windows 11 25H2 26200.9974, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11. The host has an RTX 4080 with driver 621.01. Translation ran on the CPU.
XCL_DIRECT_COMPACT=0 XCL_DIRECT_SPLIT_INSTRUCTIONS=0 cargo test --release -p xcl --lib --locked -j 2 gpu::dxil::reload_comparison_tests::ordinary_reload_analysis_and_dxil_comparison -- --exact --test-threads=1 --nocapture.These times describe the synthetic input with all 128 addresses in play. The retail pack results above show no measurable overall translation speedup on that corpus.
@KOLESNiii on GitHub · 2026-11-26 11:12 UTC · original
I’m happy with the implementation at
fdbf8bffor #2747. The mask is equivalent to the old scan for every key the analyzer accepts, including theSOFFSET=125sentinel. Both analysis passes share the same transfer function, and slot numbering, memory clobbers, and instruction effects are preserved.I ran the analyzer tests in a standalone Linux harness with
rustc --edition=2024 --testand thegpu::reload::filter. Baselineb49be183passed 5 tests andfdbf8bfpassed 7, with zero failures, ignores, or skips. The harness excluded the Windows DXIL emitter test. I did not run the workspace suite or retail smoke.One test improvement would be to cover two load slots with distinct bases and a write that invalidates only one. All seven current analyzer tests passed when I deliberately reversed the mask vector in the harness. The two-slot fixture passed on the PR and failed with the reversed vector.
AI use was OpenAI Codex (GPT-6, exact serving variant unavailable) for review, the standalone harness, and this comment.
github-bot referenced this pull request2026-11-26 11:35:05 +00:00
fdbf8bf69ato0cff1698dc@amazedturnip on GitHub · 2026-11-26 11:33 UTC · original
Thanks for the careful reports. Added the requested two-slot fixture (
a_write_to_one_slot_base_invalidates_only_that_slot): two loads with distinct bases (s[4:5] vs s[20:21]), a write to the first base's low dword, and assertions that the first slot becomes unavailable while the second stays available (negative control: it fails with the mask deliberately reversed). Analyzer tests: 9 passed. Other review comments were passing test reports; no code changes needed for them.@KOLESNiii on GitHub · 2026-11-26 12:03 UTC · original
Re-review of head
0cff1698dc377edc3678550a5cbabb7881528d1f. The only change sincefdbf8bfis the two-slot test I asked for, and it looks good to me.a_write_to_one_slot_base_invalidates_only_that_slotis correct. The second load's base is s[20:21], neither load writes into the other's address registers, and thes_movto s4 kills only the first slot.by_slot.iter().rev().map(dep_mask)), the new test fails and the other 8 still pass. So the gap I described is covered now.key()limits the base register to 123 or less and the offset register to 124 or less, or the 125 sentinel. So no shift goes past bit 125, anddep_masksets exactly the registersreads()checks.One note on the description: Tested still shows the counts from before the push, run with
--test-threads=2. CONTRIBUTING.md asks for a run with--test-threads=4.Tested
cargo test -p xcl --lib gpu::dxil::reload(debug) at0cff1698: 9 passed, 0 failed, 0 ignored, 0 skippeda_write_to_one_slot_base_invalidates_only_that_slot)scripts/smoke.ps1on a retail game, 60 s, release builds ofmain'sb49be183and this PR's head, both with no uncommitted changes, run on an otherwise idle machine:main:
PR:
The PR's run reached 99.7 % of main's frames and 100.9 % of its peak commit, with no device removals and no crashes.
Not tested
AI use
0cff1698dcto7cbc651399@amazedturnip on GitHub · 2026-11-26 12:22 UTC · original
Addressed the description note: Tested now shows
cargo test --workspace -- --test-threads=4(1311 passed, 1 failed, 27 ignored), run on head0cff1698on the AMD Radeon iGPU with the pre-existing gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 failure excluded. The reload-slice tests at --test-threads=4 are 9 passed, 0 failed. No code changes were needed; all other comments were passing reports.@amazedturnip on GitHub · 2026-11-26 12:32 UTC · original
Correction to the reply above: the head did change, to
7cbc6513, but only because the same commit was signed again.git diff 0cff1698 7cbc6513is empty (same tree), so the re-review of0cff1698covers it. The counts under Tested come fromcargo test --workspace -- --test-threads=4on0cff1698; the PR block under Regression run is from7cbc6513. No further pushes are planned for this PR unless a review asks for one.AI use: Claude Code (Claude Opus 5.5) compared the two heads and wrote this note.
github-bot referenced this pull request2026-11-26 14:05:18 +00:00
@thehollowedone on GitHub · 2026-11-26 15:41 UTC · original
Independent Windows/NVIDIA test of PR head
7cbc6513(parentb49be18). RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC; debug build.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,437 passed, 1 failed, 47 ignored across 37 targets. There were 25 GPUSKIPPEDnotices within Cargo's passing count (21 no wave64, 3 refused per-lane forms, 1 no heap windows). All three reload-mask tests passed, including the two-slot invalidation regression.The sole failure was
console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(cached_only console_mesh hit: "DXIL not compiled yet"). I rancargo test --offline --locked -p xcl --lib console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk -- --test-threads=1on the exact parentb49be18; it failed with the same message (0 passed, 1 failed, 0 ignored), so this run does not attribute that failure to #2761.Not tested: retail title smoke, AMD/Intel hardware, or a measured cold-compile speedup. AI use: Codex (GPT-6.2 Sol) reviewed the two-file patch, ran the tests, checked the parent control, and drafted this report.
@upipibi on GitHub · 2026-11-26 15:53 UTC · original
NVIDIA test report for
7cbc651: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4(head as-is, onb49be18, default translation mode): 1303 passed, 0 failed, 27 ignored. All 9gpu::dxil::reloadtests are ok,the_translator_emits_a_repeated_load_onceamong them. 25 SKIPPED: 21no wave64, 3 wave32 per-lane forms the translator refuses (#1426), 1pso_measurement_compiles_an_exact_synthetic_recordwithout Developer Mode. None is in this PR's files.dep_mask_agrees_with_reads_for_all_tracked_address_shapes,mask_intersection_matches_per_register_scan,a_write_to_one_slot_base_invalidates_only_that_slot,--exact --test-threads=1 --nocapture, 3 runs each: 9/9 passed, 0 SKIPPED.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
@Decodere on GitHub · 2026-11-26 22:02 UTC · original
Independent desktop NVIDIA verification of PR #2761 at head
7cbc6513999534d4479c3ad4801bd6f5991bd678(1commit; exact parent & merge-base:b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
7cbc6513)cargo test --release -p xcl --lib a_write_to_one_slot_base_invalidates_only_that_slot -- --nocapture1 passed; 0 failed; 0 ignored; 1338 filtered out(0.00s)cargo test --release -p xcl --lib dep_mask_agrees_with_reads_for_all_tracked_address_shapes -- --nocapture1 passed; 0 failed; 0 ignored; 1338 filtered out(0.00s)cargo test --release -p xcl --lib mask_intersection_matches_per_register_scan -- --nocapture1 passed; 0 failed; 0 ignored; 1338 filtered out(0.00s)cargo test --release -p xcl --lib gpu::dxil::reload(3 consecutive runs)9 passed; 0 failed; 0 ignored; 1330 filtered out× 3 (0.01s,0.01s,0.01s)cargo test --release -p xcl --lib gpu::dxil::187 passed; 0 failed; 3 ignored; 1149 filtered out(3.55s;dispatch_chain_native_wave64_builds_wholeself-skipped on Wave32-only RTX 4060)cargo test --release -p xcl --lib gpu::recomp::401 passed; 0 failed; 20 ignored; 918 filtered out(4.88s; Wave64-only and#1426-refused subcases self-skipped as expected)cargo build --release -p xcl --bin xcl1m 08s, exit0)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, cached baseline on the same machine):PR #2761 (
7cbc6513999534d4479c3ad4801bd6f5991bd678):Runtime log observations (
xcl.log)9221log lines,0[ERROR]/ device-removal / panic lines.19441 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13982 MB committed by the process; video memory 6115 MB local, 4651 MB non-local.Limits of coverage
u128dependency-mask invalidation path against per-register scanning and address-shape reads was verified via the 3 new reload tests, 3×gpu::dxil::reload,gpu::dxil::(187/0/3),gpu::recomp::(401/0/20), and a paired 60 s warm-cache retail smoke (title: 29640639).reload::analyzespeedup on large shaders was run, and Wave64-only GPU subcases self-skipped on the Wave32-only RTX 4060. Frame-count delta vs. the cached parent smoke (1596vs.1518) reflects normal single-run startup variance and is not attributed to this PR.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
@amazedturnip on GitHub · 2026-11-26 22:08 UTC · original
Thanks for the report. Nothing to change here: the Tested section already lists the
cargo test --workspace -- --test-threads=4run on this commit, and the one workspace failure in thehollowedone's report fails on the parentb49be18too.Edited: the first version of this reply said the description would be rewritten from a new gate run. That did not happen, and nothing in the description was out of date.
AI use: written by a local model (Inkling 2 mini), corrected by Claude Code (Claude Opus 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.