Shaders: reset branch targets per FSSM program and avoid merging across data blocks #1497
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1507"
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?
Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T17:04:26Z.
In
gpu/xbox.rs, FSSM segment grouping accumulatedtargetsacross every program without resetting when a new program started, and merged subsequent segments intof.programs.last_mut()without checking for an intervening data block:lenover the raw constant data while also keeping it inf.data_blocks.This resets
targets = ownwhenever a new program is pushed ontof.programs, and prevents merging a segment into the preceding program across an intervening data block.What is in it
crates/xcl/src/gpu/xbox.rs: resettargetsper program, guard against merging across interveningdata_blocks, and add unit testbranch_target_from_earlier_program_does_not_merge_into_later_program_or_across_data(verified failing before the fix).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 771 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib gpu::xbox: 10 passed, 0 failed (branch_target_from_earlier_program_does_not_merge_into_later_program_or_across_datafailed before the fix)Regression run
main:
PR:
Not tested
AI use
gpu/xbox.rs, wrote the fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:44Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by Belox17 on 2026-11-24T20:02:54Z.
Test report for
0344d91con NVIDIA (RTX 3060 Ti): passes, and the test fails without the fixTested
0344d91cas is (baseb7aa9f3), clean tree.branch_target_from_earlier_program_does_not_merge_into_later_program_or_across_data) withcargo test -p xcl --lib <name>: 1 passed.cargo test --workspace -- --test-threads=4on the head: 771 passed, 0 failed, 41 ignored; its baseb7aa9f3on the same machine: 770 passed, 0 failed, 41 ignored. SKIPPED on both:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).mainc160d86e(clean merge): 859 passed, 0 failed, 42 ignored;mainalone: 858 passed, 0 failed, 42 ignored, the same three SKIPPED as above.gpu/xbox.rsreverted (test kept), the test fails:stale target from Program 0 must not merge Seg 2 into Program 1: [Program { offset: 776, len: 8 }, Program { offset: 784, len: 16 }], left2, right3.Not tested
AI use: Claude Code (Claude Opus 5.5) ran the commands on this machine and wrote this report from those runs.
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T17:09:50Z.
amd-win test report for
0344d91c(exact head0344d91cab27388b13da065be1dbbc32f5741740) on AMD Radeon RX 7800 XTTested
main; the merged tree was not tested). Merges cleanly intoorigin/main55d64c27(git merge-tree)cargo test -p xcl --lib branch_target_from_earlier_program: 1 passed (the new test);cargo test -p xcl --lib xbox::tests: 9 passed, 0 failedcargo test --workspace -- --test-threads=4: 771 passed, 0 failed, 41 ignored; no SKIPPED lines printedRegression run (own test title
tests/testtitle, 60 s, release; same title and time for both. The test title exits with code 2 by design and shows no frames, socrashes: 1is its normal exit and is the same on both)PR head:
main(b7aa9f3):Not tested
mainAI use
oni-swr. No code was changed.Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T12:30:12Z.
Independent desktop NVIDIA verification of PR #1507 at head
0344d91cab27388b13da065be1dbbc32f5741740(1commit; exact parent & merge-base:b7aa9f3bd212088e0d927439284dc5ed325ce3c7, 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 tests & build (
0344d91c)cargo test --release -p xcl --lib branch_target_from_earlier_program_does_not_merge_into_later_program_or_across_data -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 743 filtered out× 3 (0.00s,0.00s,0.00s,0skipped)cargo test --release -p xcl --lib gpu::xbox:: -- --nocapture(3 consecutive runs)10 passed; 0 failed; 0 ignored; 734 filtered out× 3 (0.00s,0.00s,0.00s,0skipped)cargo build --release -p xcl1m 04s, exit0,0new warnings inxbox.rs)Paired quiet 60 s retail smoke (
title: 29640639)(Note:
scripts/smoke.ps1atb7aa9f3bpredates9683e7a6and printed the local folder basename ontitle:; replaced below with the standard9683e7a6title hash29640639, with all measured fields verbatim.)Exact parent & merge-base (
b7aa9f3bd212088e0d927439284dc5ed325ce3c7):PR #1507 (
0344d91cab27388b13da065be1dbbc32f5741740):Limits of coverage
branch_target_from_earlier_program_does_not_merge_into_later_program_or_across_dataand all10/10gpu::xbox::shader-container splitting tests (0skipped) passed3/3.0device removals,0crashes); single-run frame/commit delta vs. parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T03:30:48Z.
merge-check claim
head:
0344d91cabImported from ivall/xcl. Originally posted by throny on 2026-11-28T03:57:11Z.
merge-check
base:
e429936chead:
0344d91cabmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2127 passed, 9 failed, 48 ignored (26 SKIPPED lines). Note on the base: main at
e429936citself fails 9 tests on this GPU that passed at753e8b1aa few hours earlier (three dispatch_chain tests in gpu::dxil::module::split, gpu_heap_flat_reads_match_guarded_and_root_output, gpu_compute_mode_dispatch_abi, gpu_float_cas_uses_ieee_equality, and three e2e title tests). The same 9 fail with this PR merged, nothing else does; I am finding the merge that introduced them and will post it on #3041. Base alone: 2126 passed, 9 failed, 48 ignored.review: nothing blocking. One thing that deserves a check on a real title: the new rule stops a code segment that follows a data block from merging into the program before it, even when that program branches into the segment. Only the first program of a container is translated, so if a first program ever has an exit placed after constant data, that exit would now become a separate program and the first one would branch outside itself (on main it merged, with the data decoded as code). Whether a retail title has that layout I could not check. Resetting the branch targets acts only after the first program has ended. No new indexing into file data; the test covers both cases.
performance: none per frame; only shaders whose program extents change are re-translated.
verdict: safe to merge (a count over a title's containers of first programs whose extent changes would settle the one open point)
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T04:22:07Z.
Tested
Exact
0344d91cab27388b13da065be1dbbc32f5741740on native Windows 11 25H2 build 26200.9974, Ryzen 7 3800X, Rust 1.100.1 MSVC x64 debug. I reran the pinned libtest built from a verified Git archive with one private#[cfg(test)]fixture inserted. The original source matched the Git blobs after removing the fixture.I used
<libtest.exe> --exact <test> --nocapture --test-threads=1separately for these three tests undergpu::xbox::tests.independent_fssm_programs_keep_their_own_branch_continuationsverified two programs in one valid synthetic FSSM. The branches targeted code offsets0x0cand0x24, after each program's firsts_endpgm. The parser and listing kept the programs separate at FSSM spans0x308 + 20 Band0x31c + 24 B. The trailing counted data was listed separately at0x338 + 16 B.branch_target_after_endpgm_belongs_to_the_programandcounted_data_may_contain_endpgm_wordsboth passed.3 passed, 0 failed, 0 ignored, 0 runtime skips. All three native processes exited 0.
Not tested
Malformed inputs, control flow across data blocks, the base or merged tree, GPU execution, retail or smoke runs, performance, and the full suite.
AI use
T3 Code through the Codex harness (
gpt-6.2-sol) verified the fixture provenance and executable, reran the tests, and wrote this report.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T13:36:52Z.
merge-check
base: e13d6250
head: 0344d91c
merge: clean noncommitting merge;
git diff --checkcleanbuild:
cargo build --offline --locked -j 4 --workspace-> oktests:
cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4-> 2,130 passed, 11 failed, 48 ignored; 25 GPU skip notices, 39 targets. The exact-base run on this same machine gave 2,129 passed, the same 11 failed, 48 ignored and 25 skip notices. The failures on both trees weredispatch_chain_oversized_loop_matches_whole,dispatch_chain_wave32_live_loops,dispatch_chain_wave64_live_loops_and_exchange,direct_msaa_loads_precede_get_dimensions,gpu_heap_flat_reads_match_guarded_and_root_output,console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk,gpu_compute_mode_dispatch_abi,gpu_float_cas_uses_ieee_equality, and the threetest_title_*e2e tests. The added FSSM regression passed.review: no new blocker in the one-file diff. Branch targets now follow the active program, and a recorded data block prevents merging segments across it. The known boundary remains: a first program branching across an intervening data block is not represented as one executable program. The PR fixture demonstrates that limit, but the base also fails to decode the intervening data as instructions; retail incidence was not measured here.
performance: shader-container parsing changes at load/translation time; no per-frame path changed. I did not benchmark startup or a title run.
verdict: safe to merge from this independent merge/build/suite/code check, with the existing baseline failures and the cross-data limitation above visible for the maintainer.
Hardware: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11. AI use: Codex (GPT-6.2 Sol) ran the merge, build and suites and checked the diff; Codex (GPT-6.2 Astra) independently traced the FSSM parser and translation path.