Shaders: encoding-gated fast scans, zero-alloc wave::simulate, and dense range::relative_bounds #2941
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2941
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2941"
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?
@RVZO6 on GitHub · 2026-11-26 00:57 UTC · original
RVZO6:rvzo/wave-range-fast→main· +530 −161 · 3 files · 1 commits · openSummary
Eliminates per-instruction opcode name scans and per-VALU
Vec<Sym>heap allocations in whole-wave section detection/simulation and relative-move range analysis (100% identical outputs):emit/wave.rs—sections(): gates detection oninst.machine.encoding == Encoding::Sop1and the 4s_{or,nand}_saveexec_b{32,64}opcodes (0x25, 0x3D, 0x29, 0x41) instead of string-matchinginst.name()on every instruction of every block across all shaders.emit/wave.rs—simulate(): replaces per-operand and per-resultVec<Sym>clones (~6 heap allocations / ~9 KB per VALU op in wave64) with borrowedLanes<'a>, stack[Sym; 64]buffers, a flatVec<Sym>arena withEntry::Same(Sym)fast path for uniform results, andFxMap(preservingf3578e3f16 inline float constants).range.rs—relative()&relative_bounds(): gatesrelative()onEncoding::Vop1/ VOP3-encoded VOP1 (0x180..0x200) opcodes0x42..=0x44 | 0x48 | 0x68; replacesHashMap/HashSet(defs,memo,busy) with denseVectables indexed byValue.0; replaces heapVecs inedge_hi()andop_hi()with stack arrays.Measured (
--release bench_wave_sections_and_simulate, median of 3 runs on63bcca4)63bcca4)simulate(20 wave64 sections)scan(2,000 plain insts, no sections)Verification
emit::wave::tests::saveexec_opcode_fast_path_matches_namesandrange::tests::relative_opcode_fast_path_matches_names).windows-latestMSVC + WARP SM 6.6 CI (clippy,xtask policy, full workspace tests): https://github.com/RVZO6/VIctory/actions/runs/45730729035Not run: the title; any hardware GPU.
AI-assisted: T3 Code (Antigravity, gemini-4-neon).
33ba3c643dtoc58177e08e@fuzeofficlal on GitHub · 2026-11-26 01:08 UTC · original
Code review and RTX 5090 + WARP + DXIL + release benchmark verification at head
33ba3c643d0amerged cleanly ontomain(63bcca43c6a0;emit/lower.rsuntouched):wave.rs,range.rs):saveexec_all_constonEncoding::Sop1andrelative_opcodeonEncoding::Vop1/Encoding::Vop30x180..0x200) are exhaustively checked against the decoder name tables (saveexec_opcode_fast_path_matches_names,relative_opcode_fast_path_matches_names).wave::simulate(Entry::{Same, Slab}+ singlearena+ stack buffers +FxMap) preservesv_add_f16inline constant handling and partial-write fallback toold.get(l).Vecrange::relative_boundsguards out-of-range value indices (idx >= self.defs.len() -> u32::MAX,.get(c.0 as usize).copied().flatten(),src.len() > 3 -> u32::MAX).dxil.dll10.0.26100.0,VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:191 files ok;cargo clippy(default +--all-features): 0 warningsrange:: wave:: structure::tests emit::lower::tests: 58/58 passed (2 ignored) on both RTX 5090 and WARP--releasebench_wave_sections_and_simulate:scan(2000 insts) = 0.59 us,simulate(20 wave64 sections) = 90.57 us.LGTM.
@Marvisak on GitHub · 2026-11-26 04:27 UTC · original · edited 2026-11-26 07:23 UTC
Automated triage for the maintainers.
Merge candidate. Both requested changes are in
c58177e:emit/wave.rsnow uses the sharedstructure::Fx.v_movrel*/v_swaprelopcode constants are derived at compile time fromgfx10::opcodes::{SOP1, VOP1}, so they cannot drift.I re-read the rewritten
simulate:Entry::Samemaps to the sameShapethatper_lanegives for uniform lanes, partial writes still takeold, andv_readlanekeeps its out-of-range guard. The outputs look unchanged. The gain is in translation time, not per frame, which is for the maintainer to weigh against the size of the rewrite.CI: passing.
Generated by Claude Code
@RVZO6 on GitHub · 2026-11-26 05:42 UTC · original
Addressed both code-cleanliness items in
c58177e:pub(crate) struct Fxfromstructure.rsinemit/wave.rsinstead of duplicating the hasher.saveexec_all_const(SOP1) andrelative_opcode(VOP1) constants at compile time directly fromcrate::gfx10::opcodes::{SOP1, VOP1}so they cannot drift from the opcode tables.Verified green on
windows-latestMSVC + WARP SM 6.6 CI (clippy default +--all-features,xtask policy, full workspace tests): https://github.com/RVZO6/VIctory/actions/runs/45762903919AI-assisted: T3 Code (Antigravity, gemini-4-neon)
@Dukestar69 on GitHub · 2026-11-26 07:48 UTC · original · approved these changes
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-shader range::: 4 passed, 0 failed (includingrelative_opcode_fast_path_matches_names).cargo test -p victory-shader wave::: 8 passed, 0 failed (includingsaveexec_opcode_fast_path_matches_names).cargo test -p victory-shader resource::tests: 35 passed, 0 failed.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).
@fuzeofficlal on GitHub · 2026-11-26 09:48 UTC · original · approved these changes
I checked the encoding gates against the decoder tables, including the VOP3 aliases (
SOP1andVOP1/VOP30x180..0x200), and verifiedgit merge-treeagainst#2942merges cleanly onstructure.rs. Thewave::simulaterewrite preserves partial-write merging (old.get(l)), the out-of-rangev_readlane_b32result,v_add_f16inline float constants, and full-mask reduction recognition, whilerange::relative_boundscontinues to treat missing and out-of-range values as unbounded.Verified locally on Windows 11 x64 (
c58177e0):cargo run --locked -p xtask -- policy: passed (191 files ok)cargo clippy -p victory-shader --all-targets --locked -- -D warnings(default and--all-features): cleancargo test -p victory-shader --lib --locked wave::/range::/structure::tests: 8 / 4 / 13 passed, 0 failed (2 ignored benchmarks)(Minor nit:
rustfmt --edition 2024 --checkflags three line-wrapping diffs incrates/victory-shader/src/emit/wave.rsat lines 536, 1267, 1347.)LGTM.
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.