Shaders: track s_add_u32 with src_scc in address high halves (#815) #2383
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2385"
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-25T12:26:03Z.
Summary
Tracks
s_add_u32(and zero-high-bases_mov_b32) readingsrc_scc(Operand::Const(253)) in 64-bit address high halves (Tracer::high_halfandTracer::carriedincrates/victory-shader/src/resource.rs), and removessccfromLower::operand's unsupported special-operand message (crates/victory-shader/src/emit/lower.rs, which already lowersOperand::Const(253)viascc_in).In the native compute pipeline measurements on
mainreported in #815 (#issuecomment-7160878577world-run breakdown), 31 distinct compute programs fail translation with"an address into a descriptor heap with an untracked high half"when adding thes_add_u32low-half carry into the high dword vias_add_u32 hi, 0, src_sccrather thans_addc_u32 hi, 0, 0.Details
ir::add_regs(crates/victory-shader/src/ir.rs:1068) already recordsReg::Sccininst.readsforOperand::Const(253).Tracer::add_sccverifiesinst.writes.first()?.1 == vandinst.read(Reg::Scc).is_some(), returning the non-carry termxfors_add_u32 v, x, src_scc/s_add_u32 v, src_scc, xandTerm::Const(0)fors_mov_b32 v, src_scc.Tracer::high_halfacceptsself.add_scc(v) == Some(want)alongsides_addc_u32(supporting descriptor tables/heaps wherewant = Term::Const(0)as well as 64-bit root descriptors ands_getpc_b64code tables wherewant = Term::Value(base_hi)), while rejectings_mov_b32 hi, src_sccwhenbase_hiis non-zero.Tracer::carriedrecurses throughadd_sccalongsides_addc_u32.Verification
resource::tests::add_scc_carries_into_address_high_halves: covers table/heap (s_add_u32in both operand orders ands_mov_b32), root descriptors,s_getpc_b64code tables, and negative cases (adding an arbitrary SGPR to a heap high half stays refused;s_mov_b32 hi, src_sccon a root descriptor dropsbase_hiand falls back to title memory).emit::valu_tests::add_scc_carry_in_table_and_code_addresses_runs_on_host: validates DXIL withdxil.dlland executes on both hardware GPU andWARP.cargo clippy -p victory-shader --lib --tests --all-features --locked -- -D warnings&cargo xtask policypass.Refs #815
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T12:31:08Z.
Review: APPROVED
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:s_add_u32withsrc_scccarry into address high halves (#815) passes all resource tracking and live GPU VALU tests.cargo test -p victory-shader resource::tests: 34/34 passed (includingadd_scc_carries_into_address_high_halves).cargo test -p victory-shader src_scc: 1/1 passed on RTX 5090, 1/1 passed on WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T12:41:44Z.
Review: APPROVED
Tested locally: merged into main
940d32f69b,cargo test -p victory-shader --lockedon macOS arm64 — 145 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — s_add_u32 with src_scc tracked in address high halves.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T14:58:19Z.
Automated triage for the maintainers.
Merge candidate.
d996f08is the same change as the earlier reviewed head, now as one commit on currentmain, and it merges cleanly. The resource tracer (Tracer::high_half/carriedincrates/victory-shader/src/resource.rs, via a newadd_scc) accepts an address high half built ass_add_u32 hi, x, src_scc(either operand order) ors_mov_b32 hi, src_scc, the carry form the title's compute programs use instead ofs_addc_u32.mainalready reads SCC for operand 253 (ir.rs) and lowers it as 0/1 (Lower::operand,scc_in), so only the tracer was missing and the error message's "scc" was stale. The check is as lenient as the existings_addc_u32one, which also does not tie the carry to the low add. I re-checked the test words (0x8007FD80iss_add_u32 s7, 0, src_scc,0xBE8703FDiss_mov_b32 s7, src_scc). The tests cover tables, root descriptors,s_getpc_b64code tables and two refusals, plus a GPU readback on hardware and WARP.CI:
checkpassing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T15:41:49Z.
Independent local validation for Victory PR #2385 (Windows, Rust 1.100.0/MSVC, head
2b68ca3, no game data):cargo test --locked -p victory-shader --lib-> 249 passed, 0 failed, 3 ignored, exit 0 (138.91s, shared target);git diff --checkclean. CPU-only regression run; synthetic s_add_u32/src_scc address-high-half scenario not replayed. AI-assisted (Hy4 flash). GPU/driver N/A for CPU tests.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.