Repository navigation
Conversation
|
Reviewed: mechanical perf cleanup — |
|
Independent verification of #2664 (IR: inline PR head Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, Tests/clippy vs baseline. Equivalence. Full diff read. Perf (release; Findings: no bugs. Nit only: Limits: no physical GPU (WARP only), no game files; the 3 WARP-limited tests above are therefore not verified on hardware. Benchmarks are synthetic, release mode, one machine, two back-to-back rounds each for base and combined; they say nothing about real-title shaders. AI-assisted: independent verification by Claude Code / Claude Sonnet 5.5, run on behalf of oni-swr. Claims for #1633. |
|
Composition check: #2662 + #2664 + #2665 together Heads: #2662 Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1,
Limits: no physical GPU, no game files; synthetic benchmarks only. AI-assisted: independent verification by Claude Code / Claude Sonnet 5.5, run on behalf of oni-swr. Claims for #1633. |
|
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + Verification (
|
|
Automated triage for the maintainers. Verdict: merge candidate. I re-reviewed the rebased head
I checked that every entry in CI: Generated by Claude Code |
…isak#2664) Port of upstream Marvisak#2664: Exit::succs() returns an inline Succs ([usize; 2] + len, Deref/IntoIterator, no alloc) with successors() kept as a compat wrapper for the structure/resource/lower users; all six hot ir.rs call sites use it (reverse_postorder, link, irreducible_edge, split_irreducible, multi_entry_loop, liveness; the loop walk also stops cloning the preds vec). effects() builds (Vec<(Reg, Value)>) directly with NONE placeholders instead of Vec<Reg> + a renaming map pass, and read-set dedup uses a RegSet bitset instead of a Vec::contains scan. The per-decode VOP3B.contains hoist in fields.rs moves to the one arm that needs it; valu_dwords' split().collect() was already gone here, and the PR's differential test for it is added. Correctness: exit_succs_matches_successors, members_bit_scan_matches_linear_scan (this tree's members lacked the PR's padding-bits guard for the all-set word; adopted the PR's version) and effects_dedup_preserves_first_occurrence_order prove the rewrites; full shader suite green. Microbench (release, this machine, committed ignored bench bench_ir_build, base measured with the same bench on the parent): ir::build valu_cfg (2048 insts, 128 blocks) 2264.8 -> 1738.8 us/run (-23%); movrel (64 insts, 128 VGPRs) 470.5 -> 121.3 us/run (-74%). The relative-VGPR path gains most (range expansion + dedup no longer allocate per dword).
…fects dedup Eliminate hot per-instruction and CFG Vec heap allocations in gfx10::fields and ir::build: - gfx10/fields.rs: zero-alloc valu_dwords + VOP3B scoping - ir.rs: stack Exit::succs() small array instead of Vec<usize> per CFG visit - ir.rs: O(1) RegSet deduplication in effects() preserving first-occurrence order (Note: RegSet::members() bit-scan already landed on main in 63bcca4 and was dropped from this PR during rebase.) Assisted-by: T3 Code (Antigravity, gemini-4-neon)
|
Rebased onto current |
e6ab345 to
02fb20d
Compare
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64:
cargo test -p victory-shader --lib ir::tests: 11 passed, 0 failed, 1 ignored (including newexit_succs_matches_successorsandeffects_dedup_preserves_first_occurrence_order).cargo test -p victory-shader --lib gfx10::fields::tests: 1 passed, 0 failed (valu_dwords_matches_split_reference_for_all_valu_opcodes).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).
…n/CFG Vec allocations and O(1) effects dedup
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed at 02fb20dff69a7ed6f16c5cefa91f65c89e885608 — APPROVE.
Verification
cargo xtask policy(191 files ok) andcargo clippy -p victory-shader --all-targets --all-features -- -D warningspassed cleanly (with no newrustfmtissues introduced).- Verified
Succs([usize; 2]) matchesExit's exact 0/1/2-successor invariant and preserves[taken, not_taken]order across all CFG callers, whilepreds,phis,reads, andwritesremain growableVecs with no fixed-capacity truncation risk for multi-dword memory ops or wide relative VGPR ranges. - Verified
RegSet([u64; 7], 448 bits) covers all 385 register indices (128SGPR +SCC+256VGPR), and because allreadscarry placeholderNONEduringeffects(),Reg-keyed deduplication preserves the exact first-occurrence order of the prior(Reg, Value)Vec::containscheck. - Passed
gfx10::(17/17),ir::(11/11, 1 benchmark ignored),structure::(13/13, 1 benchmark ignored), andemit::lower::tests(33/33).
Non-blocking test notes
exit_succs_matches_successors(crates/victory-shader/src/ir.rs:1528) comparessuccs()againstsuccessors()(which delegates tosuccs()); asserting literal expected slices (including a branch with identical targets) would make it self-contained.effects_dedup_preserves_first_occurrence_order(crates/victory-shader/src/ir.rs:1550) projects toReg; adding a wave64 relative move reachingv255would also cover the upper end of theRegSetbitset and(Reg, Value)pairs.
Claimed in #1633: #1633 (comment)
Summary
Eliminates hot per-instruction and per-CFG-edge heap allocations and
O(REGS)/O(n²)scans during GFX10 decoding and SSA IR construction (crates/victory-shader/src/gfx10/fields.rs,crates/victory-shader/src/ir.rs,+319/-53), producing identical SSA IR:gfx10/fields.rs(valu_dwords): parses suffix widths directly withoutsplit('_').collect::<Vec<_>>()and only checks VOP3B forEncoding::Vop3.Exit::succs(): adds zero-allocSuccs { to: [usize; 2], len }used acrossreverse_postorder,link,irreducible_edge,split_irreducible,multi_entry_loop(also borrowingpredswithout cloning), andliveness, keepingpub Exit::successors()intact.RegSet::members(): iterates only set bits viatrailing_zeros()/w &= w - 1instead of scanning allREGSslots.effects()dedup: replacesVec::containsO(n²)dedup with a stackRegSetbitset and writes(Reg, NONE)directly without a secondVecallocation per instruction.Measured (
--release ir::tests::bench_ir_build)main)valu_cfg(2,048 insts, 128 blocks)2,310.3 µs/run1,966.9 µs/runmovrel(64 insts, 128 VGPRs)602.0 µs/run139.3 µs/runNot a duplicate of
gfx10/fields.rsvalu_dwordsorir.rsExit::succs/RegSet/effects.Verification
windows-latestMSVC + WARP SM 6.6 CI (both clippy-D warningsprofiles,xtaskpolicy 6/6,victory-shader281/281 including unit tests verifyingvalu_dwords,RegSet::members, andExit::succs): https://github.com/RVZO6/VIctory/actions/runs/45666985023AI-assisted: T3 Code (Antigravity, gemini-4-neon)