Recompiler: compute programs follow S# constants across blocks too #2935
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!2935
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2935"
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?
@pvfreis on GitHub · 2026-11-27 01:02 UTC · original
pvfreis:recompiler/compute-s-sharp-across-blocks-nvidia-dev→nvidia-dev· +226 −8 · 3 files · 1 commits · draftIn kernel and compute programs, an S# set before a branch and sampled after it falls back to sampler-heap entry 0 (point, wrap, mip 0).
82e4a9bbfollows S# constants across blocks in vertex and pixel programs only; this extends that to kernel and compute programs, in both translators. Mesh and geometry programs stay block by block. Plan: #2835.Part of #2835. Overlaps #2572 (this branch's PR, which carries
82e4a9bb), #1573 (rewrites the same loop onmain) and #811 (onmain:sgpr_usesdoes not see the SGPR an SDWA compare writes, so a constant in it is kept; with this change that reaches compute programs across blocks too).Draft, opened early so the compute part is not done twice. The two
xcl-smokeblocks are not in yet. Test reports on other cards are welcome, AMD in particular.Why compute was left out, and what we know.
fbfac4d0followed the constants in every program.82e4a9bblimited that to vertex and pixel programs; its message says compute programs read this way gaveExecuteIndirect2,055 counts out of range in 75 s on a retail title, and the device hung after 140 s. The cause is still unknown, and this change could bring it back. What we have:fbfac4d0also followed.mainform of this change (before d3602331a'ss_bfm_b32and 64-bit literal cases) finds the same static samplers in compute programs as fbfac4d0's function: no difference in 60 programs, or in the 269 programs of a 1-in-10 sample of its shader pack. With d3602331a's cases it can find more; that was not counted.nvidia-devaf2cecc4(befored3602331a) with this change, RTX 3060: no out-of-range line from theExecuteIndirectguard (the log does not show how many it checked) and no device removal. No present after 282 s; our memory guard stopped the run at 450 s. The same tree without the change, one run: no out-of-range line, no device removal, no present after 282 s, stopped at 465 s. One run each, so this does not rule the hang out.ecc0bb57, four runs each: one burst of counts out of range with this change (63) and one without it (24), with the same two float triples in the same three programs, no device removal (last bullet under Tested). So the burst shows on this branch without the change too.E_INVALIDARG, both translators).What is in it (one commit,
cc893099)gpu/recomp/mod.rs,gpu/dxil/kernel.rs:followis on for kernel and compute programs.s_movreldands_movrelsd_2(writes to SDST + an offset from M0, a register the operands do not name) forget every known constant, in every program.gpu/dxil/kernel.rs: the direct translator handsconstant_samplersevery Cfg block's start. Before, a block that is only ans_branchors_endpgmhad none, andconstant_samplerstakes a block's way on from its last instruction, sos_cbranch X; s_branch Yread as one block lost the way to X and a constant set on one path only could stay. For vertex and pixel programs on the direct path (XCL_DIRECT_DXIL=all) this also follows programs that branch to such a block, which fell back to block by block before.gpu/recomp/tests.rs:static_sampler_set_before_a_branch_is_a_constant_after_itnow expects the kernel to find the sampler after the branch.s_load, ans_movreldors_movrelsd_2that reaches the S# through M0, or an S# from memory, the program keeps the heap lookup.s_bfm_b32/ 64-bit literal S#, set before a branch in a kernel.s_branch(the direct translator's case above): no static sampler, both translators.Tested
cargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4at26ab11f0(the same tree ascc893099: only the commit message changed), in a non-interactive session at Low integrity:xcllib 1699 passed, 2 failed, 28 ignored; across the workspace 7 tests fail. They fail atecc0bb57without the change too, in the same session: the twotexture_uploadoverflow tests,split_compute_prefers_the_offline_whole_pipeline(#2854),async_compute_pso_registers_real_pso_and_not_standin,two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs,console_ms_in_as_slot_and_ms_with_as_are_refused_cleanlyand the e2etest_title_runs_and_game_folder_is_untouched. SKIPPED on this card: the wave64 forms (no wave64), two heap-window tests (no heap windows), three per-lane f16 / conversion forms (refused by the per-lane form).ecc0bb57, same session), four tests fail and the rest is as at the head:s_sharp_set_before_a_branch_is_a_static_sampler_after_it(no static sampler, heap lookup kept),gpu_s_sharp_set_before_a_branch(1.5, heap entry 0 linear, where the S# gives 2),s_sharp_from_s_bfm_and_a_64_bit_literal_move_before_a_branch_is_a_constant_in_a_kernel, and 82e4a9bb's test with its kernel check.s_movreld/s_movrelsd_2line,s_sharp_set_before_a_branch_is_a_static_sampler_after_itfails on exactly those two cases (kernel and compute, both translators: a static sampler where M0 overwrote the S#).kernel.rs, the same test fails only onother_words_past_a_lone_branch, direct translator, kernel and compute (a static sampler where one path set other words).af2cecc4+ the first form of this change, before the rebase; not a smoke block).b2a4ef48(this change without the block-start line inkernel.rs; the runs did not use the direct translator: noXCL_DIRECT_DXIL, and no direct-DXIL fallback in the logs) and its baseecc0bb57, four runs each, RTX 3060, release,XCL_PREPARE=0,XCL_NETWORK=0, empty DXIL cache, stopped at 600 s. All eight stop presenting after 86 to 98 s and go on submitting in batches. One run with the change logged 63ExecuteIndirectcounts out of range, all within 1 ms at 182 s, at 63 argument addresses; one run of the base logged 24, all at 200.8 s. Both bursts are in the same programs (1ada4908,9387face,4401d482; the first also51788b20,a6724f20) and repeat the same two float triples (465.0 x 1000.0 x 1 is one: 30 of the 63, 20 of the 24); the rest are other data that are not counts. The other six runs logged none. No device removal in any. The five compute programs dispatched with those arguments get the same static samplers with and without the change (a decode of 2,682 of the 2,737 compute programs the first run with the change used; 459 of them get more static samplers with the change).Regression run
mainand headxcl-smokeblocks are not in.Not tested
xcl-smokeruns; any title run at this head (the four in-title runs with the change are atb2a4ef48).AI use
🤖 Generated with Claude Code
@ettehn on GitHub · 2026-11-27 01:10 UTC · original
Independent Windows negative/positive control on RTX 5070 Ti Laptop (621.24), Windows 11 26200.9974, Rust 1.97.1 MSVC, DXC/DXIL 1.8.2502.11, debug,
XCL_ADAPTER=NVIDIAand separate XCL caches.cargo test --offline --locked -p xcl -j 4 --lib -- s_sharp static_sampler --test-threads=1 --nocaptureat cleanb2a4ef48passed 9/9, no ignores or capability skips. At exact parentecc0bb57with only the PR's test-file diff applied, the same command gave 5 passed / 4 failed, with the four failures listed in the PR description.The GPU negative control returned 1.5 (linear heap entry) on both sides of each tested uniform and divergent branch for both translators. The head passed the corresponding 2.0 point-sampler assertions. The translation-only controls also confirmed heap lookup remains for a descriptor overwritten through
s_movreldors_movrelsd_2. This covers synthetic shaders on a second wave32 NVIDIA generation. It leaves retailExecuteIndirect, device-removal behavior and AMD untested. OpenAI Codex (6.2sol) assisted with verification.@SzczepanGrela on GitHub · 2026-11-27 01:48 UTC · original · edited 2026-11-27 03:45 UTC
Updated RX 9070 / RADV / Wine report for head
26ab11f0587b720e4ee98e9e62d5b3e705eb85d2, compared with previous headb2a4ef48c586fb430ea341df922cb41cf6267a04. The lone-branch correction passes the tested native wave32/wave64 sampling cases; the previous head reproduces an incorrect static sampler in direct DXIL.Tested
26.3.1-arch3.5, Ryzen 7 7700, CachyOS7.3.0-5-cachyos. Windows GNU release executables, Rust1.97.1, GE-Proton11-12 / Wine 11.0 Staging, native DXGI/D3D12 through vkd3d-proton8293130ebe370b1+(local asserts-disabled build), DXC/DXIL1.9.2602.17. Actual adapter LUID00000000:000003efchecked.kernel.rsblock-start collection. The PR targetsnvidia-devatecc0bb57976b1bc94854199ddf4f915fd00e0a59; this comparison is between the two PR revisions, not integration ontomain.cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.Run through Wine:
No selected tests were ignored or skipped. Captures verify all 44 kernel/compute translation records per run. On the previous head, the sole failing test identifies
other_words_past_a_lone_branchin direct-DXIL kernel and compute forms. The updated head retains heap lookup there. Other positive/conservative translation cases remain correct. The original 16 native-wave64 GPU branch readbacks per run remain correct on both revisions, with identical shader containers.Additional owned filter
gpu::recomp::tests::workflow_sampler_lone_branch_readback --exact --nocapture --test-threads=1, three fresh processes per revision, eight dispatches each: native wave32/wave64, HLSL/direct DXIL, both uniform branch outcomes. An owned 4x4 RGBA32F texture is sampled at(0.5, 0.125). Heap entry 0 is point, entry 1 linear. S# word 3 starts at 0;s0 == 0selects 1, whiles0 == 1passes through a block containing only an unconditional branch and preserves 0.s0 == 0cases return point[2,0,2,1]instead of linear[1.5,0,1.5,1], on all 32/64 lanes respectively. The two other direct cases and all four HLSL cases are correct. The fixture collects all eight cases before reporting 0 passed / 1 failed.Across the repeated checks: 112 captured GPU dispatches, 88 native wave64, 25,600 RGBA words, all independently checked. The previous head has the expected 576 differing words; the updated head has zero. A separate decoder checks the owned encoded program, branch targets, inputs and selected heap index. Readbacks repeat byte-for-byte within each revision. DXIL wave metadata, unchanged original GPU controls and HLSL containers were checked independently.
Inherited
XCL_*cleared;XCL_NETWORK=0, RX 9070 selected,XCL_REQUIRE_GPU=wave64,XCL_DXC_THREADS=1; private enabled caches per process.Not tested
Retail or smoke runs, the reported ExecuteIndirect/device-hang symptom, performance, full suite, native Windows, integration onto
main, or GPU execution of the translation-only guestMode::Computecontrols. GPU execution here uses synthetic kernel fixtures.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the revision change, wrote the owned test-only fixture and captures, ran comparisons, independently verified source/executable provenance, program paths and all captured words, and drafted this report. Publication authorized by the account owner.
b2a4ef48c5to26ab11f058github-bot referenced this pull request2026-11-27 03:07:25 +00:00
@andrewDoing on GitHub · 2026-11-27 03:05 UTC · original
I checked the new lone-branch case on exact updated head
26ab11f0587b720e4ee98e9e62d5b3e705eb85d2and the previous headb2a4ef48with only the new test case overlaid. The updated head passed the focused test (1/1). The prior head failed it with two mismatches: direct-DXIL kernel and compute forms incorrectly treated the sampler as static forother_words_past_a_lone_branch. The HLSL controls matched on both revisions.Both builds used separate output directories; neither test reported a skip. This is a native Windows CPU translation test, not a GPU rendering or GTA VI run.
AI use: OpenAI Codex with GPT-6.2 Astra ran the comparison; Codex coordinated and prepared this report.
@andrewDoing on GitHub · 2026-11-27 03:08 UTC · original
Follow-up to my metadata comparison: I exercised the same lone-branch topology with a native GPU sampling fixture, using the previous head
b2a4ef48and updated head26ab11f0587b720e4ee98e9e62d5b3e705eb85d2, each with the identical test-only overlay and separate caches.On the previous head, the direct-DXIL
s0=1path returned point-filtered[2,0,2,1]on all 64 lanes where the selected linear sampler expected[1.5,0,1.5,1]. The other branch and both HLSL runs matched their expectations. On the updated head, all four dispatches matched every lane without reported skips.This is a synthetic native kernel readback, not a guest compute-ABI test or GTA VI title run. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the paired fixtures; Codex coordinated and prepared this follow-up.
26ab11f058tocc8930997d@LocranKing on GitHub · 2026-11-27 12:21 UTC · original
Tested PR #2935 (
cc893099) on Windows 11 (Ryzen 5 5500, 32 GB RAM, NVIDIA GeForce RTX 3060 Ti 8 GB, driver32.0.16.2140).Unit test
cargo test --locked -p xcl --lib -- s_sharp_from_s_bfm --nocaptureoncc893099:gpu::recomp::tests::s_sharp_from_s_bfm_and_a_64_bit_literal_move_before_a_branch_is_a_constant_in_a_kernel— ok (1 passed, 0 failed)Smoke run scope & outcome (
180 s,lockhart)Using a frozen
nvidia-devDXIL cache (XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1,XCL_TEXTURE_LEVEL_PAGES=1,XCL_PREPARE_GRAPHICS=0,XCL_DRED=1):exit: 0x0,0crashes,0device removals,5021frames (PresentX 5021,presents per 2 s (last 3): 60 60 60), peak commit15032 MB, peak local VRAM4835 MB, peak non-local4048 MB.#2935invalidated/re-translated compute shaders during startup preparation, first guesttimer: finesthappened at411.240 s, after the scripted18:A..82:Abutton presses finished — so this run remained in splash/menus and did not exercise the open world.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.