Recompiler: skip scalar-load analysis for direct compact emission #2766
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!2766
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2766"
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?
@KOLESNiii on GitHub · 2026-11-26 11:15 UTC · original
KOLESNiii:recomp/skip-reload-compact→main· +3 −2 · 1 files · 1 commits · openThe direct DXIL backend ran
reload::analyzefor every compute and kernel entry, including those it then emits in the compact form. Only the plain block loop reads the result, and that loop runs only whenplan.is_none(). Compact emission lowers its blocks without the analysis, so on that path the fixed-point pass over the whole CFG was thrown away. The call is now guarded withplan.is_none(). Fixes #2746.What is in it
crates/xcl/src/gpu/dxil/kernel.rs: runreload::analyzeonly when there is no compact plan (one line, plus the comment above it).Tested
AMD Ryzen 5 3600XT, NVIDIA GeForce RTX 2070 SUPER (driver 32.0.16.2140), Windows 11 build 26300, rustc 1.100.0.
cargo test --workspace -- --test-threads=4(debug): 1435 passed, 0 failed, 47 ignored. 25SKIPPED: 21no wave64, 1no heap windows, 3 others.Probe (a throwaway in-crate
#[cfg(test)]module, not part of this PR), release build, medians of 5 passes. Synthetic wave32 kernels with 28,673 instructions and 8,193 reachable blocks, 16 / 128 / 256 distincts_load_dwordx4offsets. For each program, automatic selection and forced compact (translate_full_as(.., true)) give the same bytes.main(b49be183)reload::analyzealone takes 114 / 816 / 1,614 ms on these programs, the difference between the two columns. Full numbers are in #2746.The smoke title translates two compute shaders in the compact form (14,377 and 13,890 blocks), in both runs.
Regression run
The frame counts differ, but the runs also differ in timing: according to the log timestamps, the main run reached the two compact shaders at about 43 s and this PR's run at about 17 s. I did not look into why, and I do not attribute the frame difference to this change.
Not tested
reload::tests::the_translator_emits_a_repeated_load_once.AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_015csBcd63KUE2T1kW2P15nC
@MatyEjsr on GitHub · 2026-11-26 12:17 UTC · original · edited 2026-11-26 12:30 UTC
Independent verification of PR #2766 at exact head
f276e58d0fd307e0654aae45fe664eee956f0818(cleanly based on currentmainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, mergeable with no conflicts) on Windows 11 / NVIDIA RTX 3090, including direct DXIL translation timings and byte-identity checks on real retail compact compute shaders.Code check
reloadreferences acrosscrates/xcl/src/gpu/dxil/:reloadsinkernel.rsis read only insidefor &b in cfg.rpo.iter().filter(|_| plan.is_none()), whilecompact::emitandcompact::emit_with_nestleavelw.reloadatNone. Guardingreload::analyze(&cfg)withplan.is_none()eliminates dead CFG work on compact emission with zero semantic change.Tested
rustc 1.100.0(0ef1bc386 2026-11-09), DXC1.9.2602.17.cargo test --workspace -j 8 -- --test-threads=8(debug): 1435 passed, 0 failed, 47 ignored.SKIPPED(28): 21no wave64(dispatch_chain_native_wave64_builds_whole,gpu::recomp::lower/lower_dxil/testswave64 variants), 3 per-lanef16/f32refused for#1426, 2no d3d12SDKLayers.dll(e2e.rs), 1no heap windows(gpu_compute_e2e::heap_window_out_of_memory_falls_back_to_the_switch_form), 1no D3D12 debug layer(texture_states::uploads_start_from_each_subresources_state).--test-threads=1):cargo test -p xcl --lib gpu::dxil::reload::tests: 6 passed, 0 failed, 0 ignored, 0SKIPPED(includingthe_translator_emits_a_repeated_load_once).cargo test -p xcl --lib gpu::dxil::compact: 13 passed, 0 failed, 0 ignored, 0SKIPPED.XCL_DIRECT_DXIL=1andXCL_DIRECT_DXIL=allcargo test -p xcl --test gpu_compute_e2e: 7 passed, 0 failed, 0 ignored, 1SKIPPED(no heap windows) in both modes.mainb49be183vs PR #2766f276e58d, release builds,--direct --validate):--sample 256 --seed 1 --validate --threads 8, default 16384 B cap; 41 over cap skipped): 215/215 translated and validated, 215/215.direct.dxiloutputs 100% byte-identical (0diffs).--threads 1):mainb49be183medianf276e58dmedian95cc13288a27a96e1ea6ec47667ec444(identical)56c0cd3b82a00c6e3bb11a22d84eb633(identical)Regression run
c1cc91a4, shared DXIL cache):main:PR #2766 head:
Not tested
#1426refused f16/f32 per-lane, missing D3D12 debug layer, andXCL_HEAP_WINDOWS=1).AI use
github-bot referenced this pull request2026-11-26 13:02:36 +00:00
@thehollowedone on GitHub · 2026-11-26 13:40 UTC · original
Independent Windows/NVIDIA check of #2766 head
f276e58, based onmainb49be183. I tested a clean detached checkout of the exact head.Source check: the changed
reload::analyzeresult is read by the plain block loop, which executes only whenplan.is_none(). Compact emission runs onSome(plan), and its lowering does not setlw.reload. The guard leaves the plain path's analysis in place and removes work the compact path does not consume.Tested: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GiB (NVIDIA 621.35), rustc 1.99.1 MSVC, DXC 1.8.2502.11;
XCL_ADAPTER=3080, writable localXCL_DXIL_CACHE.cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib gpu::dxil::reload::tests -- --nocapture --test-threads=1: 6 passed, 0 failed, 0 ignored.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,435 passed, 0 failed, 47 ignored across 37 targets. There were 25 GPUSKIPPEDnotices (21 no wave64, three refused per-lane cases, one no heap windows); those are not GPU coverage. The suite log identifies the real RTX 3080 Ti backend.Not tested: independent translation timing or byte-for-byte output comparison for a compact shader, a retail title smoke run, AMD wave64, and the skipped cases. This report verifies this revision's build and regression suite; it does not independently establish the reported translation speedup.
AI use: Codex (GPT-6.2 Sol) checked the source path, ran the tests, and drafted this report.
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.