Shaders: O(|known|) BDD forced() sweep, read-only implies(), per-block reuse in finish(), and FxHash in meet_in() #2660

Open
RVZO6 wants to merge 1 commit from upstream-pr/2662 into main
RVZO6 commented 2026-11-25 17:43:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-25T17:43:59Z.


Claimed in #1633: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7158204478

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:

  1. O(|known|) read-only Bools::forced() sweep: replaces Bools::given()'s O(|b| * |vars(b)|) mutating implies loop with a single bottom-up pass over reachable edges of the reduced OBDD.
  2. Read-only Bools::implies(): checks entailment directly without allocating temporary BDD nodes or evicting memo entries.
  3. Per-block reuse in finish(): computes forced(cond[n]) once per block and reuses it across guards and exits.
  4. FxHash in meet_in(): switches the refuted set from default SipHash to the existing Fx hasher.

Measured (--release structure::tests::bench_bools)

Workload Before (main) After Speedup
given() (n = 8) 20.43 µs 0.22 µs 93×
given() (n = 13) 655.25 µs 0.54 µs 1,213×

Not a duplicate of

  • Checked open PRs including #2627 (which fixes Structured::active reachability rather than Bools::given/implies/forced/meet_in). No open PR or #1633 claim overlaps Bools BDD evaluation.

Verification

  • Verified on windows-latest MSVC + WARP SM 6.6 CI (both clippy -D warnings profiles, xtask policy 6/6, victory-shader 281/281 including equivalence tests comparing forced()/implies() against the previous BDD implementations): https://github.com/RVZO6/VIctory/actions/runs/45666985023
  • Not run: the title; any hardware GPU.

AI-assisted: T3 Code (Antigravity, gemini-4-neon)

<!-- greyfinch-sync:Marvisak/VIctory:issue:5496253389 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662). Originally posted by [RVZO6](https://github.com/RVZO6) on 2026-11-25T17:43:59Z. --- Claimed in #1633: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7158204478 ### 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: 1. **O(|known|) read-only `Bools::forced()` sweep:** replaces `Bools::given()`'s `O(|b| * |vars(b)|)` mutating `implies` loop with a single bottom-up pass over reachable edges of the reduced OBDD. 2. **Read-only `Bools::implies()`:** checks entailment directly without allocating temporary BDD nodes or evicting memo entries. 3. **Per-block reuse in `finish()`:** computes `forced(cond[n])` once per block and reuses it across guards and exits. 4. **FxHash in `meet_in()`:** switches the refuted set from default SipHash to the existing `Fx` hasher. ### Measured (`--release structure::tests::bench_bools`) | Workload | Before (`main`) | After | Speedup | |---|---:|---:|---:| | `given()` (`n = 8`) | `20.43 µs` | `0.22 µs` | **93×** | | `given()` (`n = 13`) | `655.25 µs` | `0.54 µs` | **1,213×** | ### Not a duplicate of - Checked open PRs including #2627 (which fixes `Structured::active` reachability rather than `Bools::given`/`implies`/`forced`/`meet_in`). No open PR or #1633 claim overlaps `Bools` BDD evaluation. ### Verification - Verified on `windows-latest` MSVC + WARP SM 6.6 CI (both clippy `-D warnings` profiles, `xtask` policy 6/6, `victory-shader` 281/281 including equivalence tests comparing `forced()`/`implies()` against the previous BDD implementations): https://github.com/RVZO6/VIctory/actions/runs/45666985023 - **Not run:** the title; any hardware GPU. AI-assisted: T3 Code (Antigravity, gemini-4-neon)
kotekompotek commented 2026-11-25 18:02:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:54:54Z.


Reviewed: the read-only implies/implies_in (local proved set, no memo or node allocation) is sound — BDD implication is decidable by simultaneous top-variable descent. overflow returning true preserves the conservative direction. FxHash swap in the hot BDD maps is a straight win. CI green.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170176173 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662#issuecomment-7170176173). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T17:54:54Z. --- Reviewed: the read-only `implies`/`implies_in` (local `proved` set, no memo or node allocation) is sound — BDD implication is decidable by simultaneous top-variable descent. `overflow` returning true preserves the conservative direction. FxHash swap in the hot BDD maps is a straight win. CI green.
oni-swr commented 2026-11-25 19:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:21:48Z.


Independent verification of #2662 (BDD forced() sweep, read-only implies(), given_with)

PR head 95f56a53f8ff90f700d74d102ad79538bad68771, merges cleanly onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca (git merge-tree).

Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, VICTORY_WARP=1 + VICTORY_D3D12_WARP=1 on every run (WARP adapter only, no physical GPU created), DXC/dxil 1.8.2502.11 (Windows SDK 10.0.26100.0, via VICTORY_DXIL), cargo ... -j 4 --locked.

Tests/clippy vs baseline. origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca: cargo test -p victory-shader --lib --locked -- --test-threads=1 = 267 passed, 3 failed, 3 ignored. The 3 failures are WARP limits and are the same 3 in every variant below: a_mask_joined_with_data_at_a_uniform_loop_is_its_number and permutes_read_the_lane_named_and_zero_from_lanes_left_out ("no pipeline for a wave of 32"), and gathers_at_a_level_match_the_hardware (WARP gather result differs). Clippy: cargo clippy -p victory-shader --all-targets --locked = 0 warnings.
With #2662: 269 passed, 3 failed (same 3), 3 ignored (+2 new tests: forced_matches_implies_across_disjunctive_skips_and_random_bdds, read_only_implies_matches_and_not_without_allocating_nodes). Clippy: 0 warnings.

Equivalence. I read the full diff. forced() (variable v is forced iff no reachable non-FALSE edge skips v and every reachable node testing v takes one polarity) is correct for reduced OBDDs; the TERMINAL far-edge correctly stops forcing past an edge into TRUE. implies() returns true on overflow like the old ite-based form (which yielded FALSE on overflow). given_with(known = FALSE) follows hi edges, matching the old "every atom implied true". Output check: a throwaway, uncommitted patch hashed every container Shader::finish emits during the lib test run: 650 containers (476 distinct), byte-identical to origin/main.

Perf (release, bench_bools, synthetic BDDs). given at n=8/10/12/13 on base: 15 / 55 / 240 / 465 us (its own fast path); with the three shader PRs combined: 0.25 / 0.44 / 0.44 / 0.45 us. Small n (2, 4) unchanged within noise. Caveat: this isolates given; the benchmark's known is cheap to walk, and the effect on real shaders was not measured.

Findings: no bugs. Observation: since implies/forced no longer allocate BDD nodes, the MAX_NODES overflow (TOO_LARGE) should be hit less often than before; that can only turn a TOO_LARGE into a success, not the reverse. Not measured on real shaders.

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170804388 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662#issuecomment-7170804388). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T18:21:48Z. --- **Independent verification of #2662** (BDD `forced()` sweep, read-only `implies()`, `given_with`) PR head `95f56a53f8ff90f700d74d102ad79538bad68771`, merges cleanly onto `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca` (`git merge-tree`). **Environment:** Windows 11 Pro 10.0.26200, rustc 1.98.1, `VICTORY_WARP=1` + `VICTORY_D3D12_WARP=1` on every run (WARP adapter only, no physical GPU created), DXC/dxil 1.8.2502.11 (Windows SDK 10.0.26100.0, via `VICTORY_DXIL`), `cargo ... -j 4 --locked`. **Tests/clippy vs baseline.** `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca`: `cargo test -p victory-shader --lib --locked -- --test-threads=1` = **267 passed, 3 failed, 3 ignored**. The 3 failures are WARP limits and are the same 3 in every variant below: `a_mask_joined_with_data_at_a_uniform_loop_is_its_number` and `permutes_read_the_lane_named_and_zero_from_lanes_left_out` ("no pipeline for a wave of 32"), and `gathers_at_a_level_match_the_hardware` (WARP gather result differs). Clippy: `cargo clippy -p victory-shader --all-targets --locked` = 0 warnings. With #2662: **269 passed, 3 failed (same 3), 3 ignored** (+2 new tests: `forced_matches_implies_across_disjunctive_skips_and_random_bdds`, `read_only_implies_matches_and_not_without_allocating_nodes`). Clippy: 0 warnings. **Equivalence.** I read the full diff. `forced()` (variable v is forced iff no reachable non-FALSE edge skips v and every reachable node testing v takes one polarity) is correct for reduced OBDDs; the `TERMINAL` far-edge correctly stops forcing past an edge into TRUE. `implies()` returns true on overflow like the old `ite`-based form (which yielded FALSE on overflow). `given_with(known = FALSE)` follows `hi` edges, matching the old "every atom implied true". Output check: a throwaway, uncommitted patch hashed every container `Shader::finish` emits during the lib test run: **650 containers (476 distinct), byte-identical to `origin/main`**. **Perf (release, `bench_bools`, synthetic BDDs).** `given` at n=8/10/12/13 on base: 15 / 55 / 240 / 465 us (its own fast path); with the three shader PRs combined: 0.25 / 0.44 / 0.44 / 0.45 us. Small n (2, 4) unchanged within noise. Caveat: this isolates `given`; the benchmark's `known` is cheap to walk, and the effect on real shaders was not measured. **Findings:** no bugs. Observation: since `implies`/`forced` no longer allocate BDD nodes, the `MAX_NODES` overflow (`TOO_LARGE`) should be hit less often than before; that can only turn a `TOO_LARGE` into a success, not the reverse. Not measured on real shaders. **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.
oni-swr commented 2026-11-25 19:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:23:05Z.


Composition check: #2662 + #2664 + #2665 together

Heads: #2662 95f56a53f8ff90f700d74d102ad79538bad68771, #2664 e6ab345e7b73be37a0741a54767e061aad35239c, #2665 8105fdcfb68ac99d79ea728847a0f555b7a41521, merged in that order onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca as a local merge commit (31ed3543e4c18b978f7b0a699a71f8d18e52a81b, not pushed). No conflicts: the three touch disjoint files (structure.rs; gfx10/fields.rs + ir.rs; emit/bitcode.rs + emit/shader.rs).

Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, VICTORY_WARP=1 + VICTORY_D3D12_WARP=1 (WARP only), dxil 1.8.2502.11 (SDK 10.0.26100.0), -j 4 --locked.

  • cargo test -p victory-shader --lib --locked -- --test-threads=1: 276 passed, 3 failed, 5 ignored. That is exactly baseline 267 + 2 + 4 + 3 new tests; the 3 failures are the same WARP-limited ones as on origin/main (wave-of-32 x2, WARP gather).
  • cargo clippy -p victory-shader --all-targets --locked: 0 warnings.
  • Emitted containers over the lib test run: 650 byte-identical to origin/main, plus one extra from #2665's new test (throwaway hashing patch, not committed).
  • Perf (release, combined vs base, 2 rounds each): shader::op 4096 calls 2.84-2.94 ms -> 0.53-0.56 ms; ir::build 2048 insts 2.24-2.29 ms -> 1.80-1.84 ms; 64 movrel insts 426-456 us -> 88-103 us; bitcode writer, 256x512 synthetic module, 8.9-9.8 ms -> 7.0-7.1 ms; BDD given n=13 ~465 us -> ~0.45 us (synthetic).
  • No interaction bugs found. The merge order does not matter (disjoint files).

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170833609 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662#issuecomment-7170833609). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T18:23:05Z. --- **Composition check: #2662 + #2664 + #2665 together** Heads: #2662 `95f56a53f8ff90f700d74d102ad79538bad68771`, #2664 `e6ab345e7b73be37a0741a54767e061aad35239c`, #2665 `8105fdcfb68ac99d79ea728847a0f555b7a41521`, merged in that order onto `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca` as a local merge commit (`31ed3543e4c18b978f7b0a699a71f8d18e52a81b`, not pushed). No conflicts: the three touch disjoint files (`structure.rs`; `gfx10/fields.rs` + `ir.rs`; `emit/bitcode.rs` + `emit/shader.rs`). Environment: Windows 11 Pro 10.0.26200, rustc 1.98.1, `VICTORY_WARP=1` + `VICTORY_D3D12_WARP=1` (WARP only), dxil 1.8.2502.11 (SDK 10.0.26100.0), `-j 4 --locked`. - `cargo test -p victory-shader --lib --locked -- --test-threads=1`: **276 passed, 3 failed, 5 ignored**. That is exactly baseline 267 + 2 + 4 + 3 new tests; the 3 failures are the same WARP-limited ones as on `origin/main` (wave-of-32 x2, WARP gather). - `cargo clippy -p victory-shader --all-targets --locked`: 0 warnings. - Emitted containers over the lib test run: 650 byte-identical to `origin/main`, plus one extra from #2665's new test (throwaway hashing patch, not committed). - Perf (release, combined vs base, 2 rounds each): `shader::op` 4096 calls 2.84-2.94 ms -> 0.53-0.56 ms; `ir::build` 2048 insts 2.24-2.29 ms -> 1.80-1.84 ms; 64 `movrel` insts 426-456 us -> 88-103 us; bitcode writer, 256x512 synthetic module, 8.9-9.8 ms -> 7.0-7.1 ms; BDD `given` n=13 ~465 us -> ~0.45 us (synthetic). - No interaction bugs found. The merge order does not matter (disjoint files). 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.
fuzeofficlal commented 2026-11-25 20:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:27:33Z.


Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + dxil.dll verification, code review, and same-machine --release benchmark comparison of 95f56a53 (on 13f91ca):

Verification (rustc 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll)

  • cargo xtask policy: 184 files ok.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings and --features host: 0 warnings.
  • victory-shader (structure, ir, gfx10, emit::tests, emit::lower, emit::waterfall_tests on RTX 5090 + WARP + dxil.dll, emit::bitcode with unchanged FNV-1a): 99 passed, 0 failed, 2 ignored.
  • Merge compatibility with #2664 & #2665: clean zero-conflict 3-way git merge-tree across all three PRs (disjoint compiler stages: frontend #2664, mid-end #2662, backend #2665).

Same-Machine --release Benchmark (structure::tests::bench_bools)

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 (no Bools::nodes growth or memo churn), O(|known|) forced() sweep (TRUE/FALSE edge handling, TERMINAL = u32::MAX ordering, append-only given_with safety with cached_forced), and bounded FxHash refuted set in meet_in are strictly equivalent with zero unsafe. Clean and ready to merge.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7172324681 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662#issuecomment-7172324681). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:27:33Z. --- Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + `dxil.dll` verification, code review, and same-machine `--release` benchmark comparison of `95f56a53` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`) - `cargo xtask policy`: **184 files ok**. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` and `--features host`: **0 warnings**. - `victory-shader` (`structure`, `ir`, `gfx10`, `emit::tests`, `emit::lower`, `emit::waterfall_tests` on RTX 5090 + WARP + `dxil.dll`, `emit::bitcode` with unchanged FNV-1a): **99 passed, 0 failed, 2 ignored**. - **Merge compatibility with #2664 & #2665:** clean zero-conflict 3-way `git merge-tree` across all three PRs (disjoint compiler stages: frontend `#2664`, mid-end `#2662`, backend `#2665`). ### Same-Machine `--release` Benchmark (`structure::tests::bench_bools`) | 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` (no `Bools::nodes` growth or `memo` churn), `O(|known|)` `forced()` sweep (`TRUE`/`FALSE` edge handling, `TERMINAL = u32::MAX` ordering, append-only `given_with` safety with `cached_forced`), and bounded `FxHash` `refuted` set in `meet_in` are strictly equivalent with zero `unsafe`. Clean and ready to merge.
Marvisak commented 2026-11-25 23:06:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:21:49Z.


Automated triage for the maintainers.

Merge candidate (performance, same output). In crates/victory-shader/src/structure.rs:

  • Bools::implies becomes a read-only simultaneous descent with no node allocation.
  • The new Bools::forced finds the variables known decides in one walk of known.
  • Lanes::finish computes that once per block and reuses it for guards and exits (given_with).
  • meet_in uses the existing Fx hasher.

I checked forced against the reduced-OBDD argument: a variable is forced only if no reachable non-FALSE edge skips it and all its nodes take one polarity, with an edge into TRUE skipping everything below it. Restricting by forced variables that b does not contain is a no-op, so the result equals the old per-variable loop. The known == FALSE path follows hi edges like before, and the memo in implies_in is sound because a false result short-circuits the whole walk. The new tests compare forced/implies with the old formulations on random BDDs, and a tester reports byte-identical DXIL for all lib-test shaders. It merges cleanly; CI check: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176268626 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662#issuecomment-7176268626). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:21:49Z. --- <!-- victory-triage v1 head=95f56a53f8ff90f700d74d102ad79538bad68771 verdict=merge-candidate at=2026-11-25T22:24:00Z --> Automated triage for the maintainers. **Merge candidate** (performance, same output). In `crates/victory-shader/src/structure.rs`: - `Bools::implies` becomes a read-only simultaneous descent with no node allocation. - The new `Bools::forced` finds the variables `known` decides in one walk of `known`. - `Lanes::finish` computes that once per block and reuses it for guards and exits (`given_with`). - `meet_in` uses the existing Fx hasher. I checked `forced` against the reduced-OBDD argument: a variable is forced only if no reachable non-FALSE edge skips it and all its nodes take one polarity, with an edge into TRUE skipping everything below it. Restricting by forced variables that `b` does not contain is a no-op, so the result equals the old per-variable loop. The `known == FALSE` path follows `hi` edges like before, and the memo in `implies_in` is sound because a `false` result short-circuits the whole walk. The new tests compare `forced`/`implies` with the old formulations on random BDDs, and a tester reports byte-identical DXIL for all lib-test shaders. It merges cleanly; CI `check`: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Dukestar69 commented 2026-11-26 04:48:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T04:48:04Z.

Review: APPROVED


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 new forced_matches_implies_across_disjunctive_skips_and_random_bdds and read_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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6068689567 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662#pullrequestreview-6068689567). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T04:48:04Z. **Review:** APPROVED --- 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 new `forced_matches_implies_across_disjunctive_skips_and_random_bdds` and `read_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).
fuzeofficlal commented 2026-11-27 02:41:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T02:41:30Z.

Review: APPROVED


Reviewed at 95f56a53f8ff90f700d74d102ad79538bad68771 — APPROVE.

Verification

  • cargo xtask policy (191 files ok) and cargo clippy -p victory-shader --all-targets --all-features -- -D warnings passed cleanly.
  • Verified forced(), read-only implies() / implies_in(), and given_with() semantics against the prior implementation: negations are ordinary OBDD nodes, skipped variables are suppressed via skip_until <= v (with Bool::TRUE edges yielding TERMINAL), implies() uses a fresh per-query Seen<(Bool, Bool)> without mutating self.memo or allocating nodes, and finish() resets last_guard per block and keys cached_forced on known with no cross-block bleed. meet_in() only performs membership/insertion on its FxHash Set, remaining order-independent.
  • Passed structure:: (15/15, 1 benchmark ignored) and emit::lower::tests (33/33).

Non-blocking notes

  • forced() calls entries.sort_unstable_by_key (crates/victory-shader/src/structure.rs:406), making its worst-case complexity O(|known| log |known|) rather than strictly O(|known|).
  • implies_in's local Seen set (structure.rs:366) has no cap (unlike MAX_MEMO on ite), and finish() (structure.rs:940, 954) can invoke forced_for even when the guard/branch target e or when is a terminal constant (Bool::TRUE/FALSE).
  • Minor rustfmt formatting differences in the new unit test (structure.rs:1994, 2008, 2024, 2049).
<!-- greyfinch-sync:Marvisak/VIctory:review:6082786472 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2662#pullrequestreview-6082786472). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T02:41:30Z. **Review:** APPROVED --- Reviewed at `95f56a53f8ff90f700d74d102ad79538bad68771` — **APPROVE**. ### Verification - `cargo xtask policy` (`191 files ok`) and `cargo clippy -p victory-shader --all-targets --all-features -- -D warnings` passed cleanly. - Verified `forced()`, read-only `implies()` / `implies_in()`, and `given_with()` semantics against the prior implementation: negations are ordinary OBDD nodes, skipped variables are suppressed via `skip_until <= v` (with `Bool::TRUE` edges yielding `TERMINAL`), `implies()` uses a fresh per-query `Seen<(Bool, Bool)>` without mutating `self.memo` or allocating nodes, and `finish()` resets `last_guard` per block and keys `cached_forced` on `known` with no cross-block bleed. `meet_in()` only performs membership/insertion on its `FxHash` `Set`, remaining order-independent. - Passed `structure::` (15/15, 1 benchmark ignored) and `emit::lower::tests` (33/33). ### Non-blocking notes - `forced()` calls `entries.sort_unstable_by_key` (`crates/victory-shader/src/structure.rs:406`), making its worst-case complexity `O(|known| log |known|)` rather than strictly `O(|known|)`. - `implies_in`'s local `Seen` set (`structure.rs:366`) has no cap (unlike `MAX_MEMO` on `ite`), and `finish()` (`structure.rs:940, 954`) can invoke `forced_for` even when the guard/branch target `e` or `when` is a terminal constant (`Bool::TRUE`/`FALSE`). - Minor `rustfmt` formatting differences in the new unit test (`structure.rs:1994, 2008, 2024, 2049`).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2662:upstream-pr/2662'
git switch 'upstream-pr/2662'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2662'
git switch 'upstream-pr/2662'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2662'
git switch 'upstream-pr/2662'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2662'
git switch 'main'
git merge --squash 'upstream-pr/2662'
git switch 'main'
git merge --ff-only 'upstream-pr/2662'
git switch 'main'
git merge 'upstream-pr/2662'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2660
No description provided.