Shaders: require EXEC coverage when tracing VALU address operands #2921
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2923"
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 Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:13:06Z.
Problem
In
crates/victory-shader/src/resource.rs,Tracer::lane_valuealready callsTracer::runs(site, known)to verify that every lane reaching a consumer actually executed each guarded VALU write. However,vorigin,vadd,carried(v_add_co_ci_u32),lane_term, andsumfollowed guardedv_mov_b32/v_add_co_u32/v_add_nc_u32/v_add_co_ci_u32definitions without checkinglanes.guards.When a shader updates a VGPR offset (or high-half address carry) under narrowed
EXEC(e.g.v_cmp_*+s_and_saveexec_b32), restoresEXEC, and executes aglobal_load_*/global_store_*/global_atomic_*:flat_addressfolded the guarded add/move into a staticAddress::offsetfor every lane, so lanes skipped whileEXEC == 0silently read or wrote at the wrong offset.v_add_co_ci_u32high-half carry afterEXECrestore was still attributed to the root parameter instead of falling back toMEMORY.Changes
Tracer::site_knownandTracer::runs_valueincrates/victory-shader/src/resource.rs, threading lane conditions (known: &[(Bool, bool)]) and guard tracking (unguarded: &mut bool) throughvorigin,vterm,vadd,sum/sum_tracked,carried,flat_address,address,traced_address,smem_address,lane_term,fetched, andwaterfall.Tracer::sumsmemoization to sums traced without encountering anyEXECguard (local == true), preventing guarded and unguarded uses of the same SSAValue(or its ancestors) from poisoning each other regardless of visit order while still allowing unguarded siblings to cache.emit/lower.rsuntouched.Verification
All tests use synthetic GFX10 encodings (no external files):
crates/victory-shader/src/resource.rs:a_guarded_move_is_folded_only_for_lanes_that_run_it(same guard folds,s_xor_b32else-arm and post-restore copy stay dynamic)sums_with_guarded_terms_are_not_cached_in_either_order(checks both visit orders and verifiesTracer::sumsstays unpopulated for guarded ancestors)a_guarded_high_half_carry_requires_exec_coverage(guardedv_add_co_ci_u32folds inside guard and falls back toMEMORYafter restore)emit::synthetic_tests::global_stores_keep_each_lanes_offset_after_exec_is_restored: verified with Windows SDK 10.0.26100.0dxil.dll, NVIDIA GeForce RTX 5090 (hardware), and D3D12 WARP (VICTORY_WARP=1).cargo test --locked -p victory-shader --lib -- resource::tests emit::lower::tests emit::flow_tests emit::waterfall_tests global_stores_keep_each_lanes_offset_after_exec_is_restored: 78/78 passed on RTX 5090, andglobal_stores_keep_each_lanes_offset_after_exec_is_restoredpassed on WARP.cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default and--all-features) andcargo xtask policy(191 files ok): clean.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T00:27:38Z.
Review: COMMENTED
Scoped review: requiring EXEC coverage for VALU address operands is the same discipline the descriptor tracking needed — an address operand produced under a mask the store doesn't honor is undefined input. The test's divergent-add-then-restore case is exactly the shape that distinguishes real per-lane tracking from mask-blind analysis. LGTM.
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T01:08:59Z.
Independent verification on Windows 11 26100, AMD Radeon RX 7900 XTX (RDNA3, driver 32.0.32029.2010), Rust 1.100.0, Windows SDK 10.0.26100.0 (
dxil.dll):All three new
resource::testspass, andglobal_stores_keep_each_lanes_offset_after_exec_is_restoredruns on both backends:hardware: verified narrowed and restored EXEC storesVICTORY_WARP=1:WARP: verified narrowed and restored EXEC storesDXIL validation ran with the SDK's
dxil.dll(Validator::default_pathselects10.0.26100.0\x64\dxil.dll).cargo clippy --locked -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.No game files. AI-assisted.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:22:52Z.
Automated triage for the maintainers.
Merge candidate. This fixes a real hole in
victory-shader/src/resource.rs:vorigin,vadd,carriedandsumfollowedv_mov_b32/v_add_*/v_add_co_ci_u32definitions written under narrowed EXEC without theruns()coverage checklane_valuealready makes, so lanes that skipped the write got a wrong static offset. The newsite_known/runs_valuethreading throughflat_address,address,traced_address,smem_address,lane_termandwaterfallreads correctly, and restricting thesumscache to unguarded traces is right. The end-to-end test's expected values follow from EXEC semantics. Note for the maintainer: the descriptor-from-memory path now passes an emptyknown, which is more conservative and can fall back to MEMORY where it used to resolve to a root parameter.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T05:33:45Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):resource.rs(including high-half carries and uncached guarded-term sums) prevents narrowed-EXEC updates from leaking across lanes after EXEC is restored.cargo test -p victory-shader resource::tests: 38 passed, 0 failed (including the new EXEC-coverage tests).cargo test -p victory-shader --test resource_tracking: 3 passed, 0 failed.cargo test -p victory-shader global_stores_keep_each_lanes_offset_after_exec_is_restored -- --test-threads=1(RTX 5090 & WARP): 1 passed, 0 failed on both.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.