Repository navigation
Conversation
…k reuse in finish(), and FxHash in meet_in() Replace Bools::given()'s O(|b| * |vars(b)|) mutating implies loop with an O(|known|) read-only forced() sweep over reduced OBDD edges, make Bools::implies() read-only without allocating BDD nodes or evicting memo entries, reuse forced(cond[n]) across guards and exits per block in finish(), and switch meet_in()'s refuted set from SipHash to FxHash. Measured on bench_bools (--release): given() drops from 20.43 us -> 0.22 us (93x) at n=8 and 655.25 us -> 0.54 us (1,213x) at n=13. Assisted-by: T3 Code (Antigravity, gemini-4-neon)
|
Reviewed: the read-only |
|
Independent verification of #2662 (BDD PR head Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, Tests/clippy vs baseline. Equivalence. I read the full diff. Perf (release, Findings: no bugs. Observation: since 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 (
|
| Case | 13f91ca |
95f56a53 |
Speedup |
|---|---|---|---|
n=2, nodes=9 |
0.37 µs |
0.12 µs |
3.1x |
n=4, nodes=45 |
1.05 µs |
0.13 µs |
8.1x |
n=8, nodes=765 |
8.91 µs |
0.14 µs |
63.6x |
n=10, nodes=3069 |
29.49 µs |
0.24 µs |
122.9x |
n=12, nodes=12285 |
142.57 µs |
0.25 µs |
570.3x |
n=13, nodes=24573 |
335.56 µs |
0.26 µs |
1,290.6x |
Code Review Notes
- Read-only
implies_in(noBools::nodesgrowth ormemochurn),O(|known|)forced()sweep (TRUE/FALSEedge handling,TERMINAL = u32::MAXordering, append-onlygiven_withsafety withcached_forced), and boundedFxHashrefutedset inmeet_inare strictly equivalent with zerounsafe. Clean and ready to merge.
|
Automated triage for the maintainers. Merge candidate (performance, same output). In
I checked Generated by Claude Code |
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 structure::tests: 15 passed, 0 failed, 1 ignored (including newforced_matches_implies_across_disjunctive_skips_and_random_bddsandread_only_implies_matches_and_not_without_allocating_nodes).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).
…ep, read-only implies(), per-block reuse in finish(), and FxHash in meet_in()
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed at 95f56a53f8ff90f700d74d102ad79538bad68771 — APPROVE.
Verification
cargo xtask policy(191 files ok) andcargo clippy -p victory-shader --all-targets --all-features -- -D warningspassed cleanly.- Verified
forced(), read-onlyimplies()/implies_in(), andgiven_with()semantics against the prior implementation: negations are ordinary OBDD nodes, skipped variables are suppressed viaskip_until <= v(withBool::TRUEedges yieldingTERMINAL),implies()uses a fresh per-querySeen<(Bool, Bool)>without mutatingself.memoor allocating nodes, andfinish()resetslast_guardper block and keyscached_forcedonknownwith no cross-block bleed.meet_in()only performs membership/insertion on itsFxHashSet, remaining order-independent. - Passed
structure::(15/15, 1 benchmark ignored) andemit::lower::tests(33/33).
Non-blocking notes
forced()callsentries.sort_unstable_by_key(crates/victory-shader/src/structure.rs:406), making its worst-case complexityO(|known| log |known|)rather than strictlyO(|known|).implies_in's localSeenset (structure.rs:366) has no cap (unlikeMAX_MEMOonite), andfinish()(structure.rs:940, 954) can invokeforced_foreven when the guard/branch targeteorwhenis a terminal constant (Bool::TRUE/FALSE).- Minor
rustfmtformatting differences in the new unit test (structure.rs:1994, 2008, 2024, 2049).
Claimed in #1633: #1633 (comment)
Summary
Eliminates quadratic BDD node creation and repeated scans during CFG structurisation (
crates/victory-shader/src/structure.rs,+225/-60), with identical reduced OBDD output:Bools::forced()sweep: replacesBools::given()'sO(|b| * |vars(b)|)mutatingimpliesloop with a single bottom-up pass over reachable edges of the reduced OBDD.Bools::implies(): checks entailment directly without allocating temporary BDD nodes or evicting memo entries.finish(): computesforced(cond[n])once per block and reuses it across guards and exits.meet_in(): switches the refuted set from default SipHash to the existingFxhasher.Measured (
--release structure::tests::bench_bools)main)given()(n = 8)20.43 µs0.22 µsgiven()(n = 13)655.25 µs0.54 µsNot a duplicate of
Structured::activereachability rather thanBools::given/implies/forced/meet_in). No open PR or Coordinating who works on what #1633 claim overlapsBoolsBDD evaluation.Verification
windows-latestMSVC + WARP SM 6.6 CI (both clippy-D warningsprofiles,xtaskpolicy 6/6,victory-shader281/281 including equivalence tests comparingforced()/implies()against the previous BDD implementations): https://github.com/RVZO6/VIctory/actions/runs/45666985023AI-assisted: T3 Code (Antigravity, gemini-4-neon)