Refactor/iterative shader bdd #1806

Open
VlREX wants to merge 2 commits from upstream-pr/1807 into main
VlREX commented 2026-11-24 22:53:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by VlREX on 2026-11-24T22:53:18Z.


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5481681871 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1807). Originally posted by [VlREX](https://github.com/VlREX) on 2026-11-24T22:53:18Z. --- _No description provided._
catminou4 commented 2026-11-24 23:05:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:05:49Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae).

cargo test -p victory-shader --locked → 121 passed, 0 failed. Iterative BDD rewrite: ite_cached/rewrite/meet_with_budget replace recursion with an explicit budgeted fixpoint — this is the soundness fix for the exponential BDD blowup; +3 macOS tests. Windows hardware suite should still run before merge given the centrality of meet().

<!-- greyfinch-sync:Marvisak/VIctory:review:6048826264 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1807#pullrequestreview-6048826264). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:05:49Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae). cargo test -p victory-shader --locked → 121 passed, 0 failed. Iterative BDD rewrite: ite_cached/rewrite/meet_with_budget replace recursion with an explicit budgeted fixpoint — this is the soundness fix for the exponential BDD blowup; +3 macOS tests. Windows hardware suite should still run before merge given the centrality of meet().
DesertGamer commented 2026-11-24 23:06:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T22:56:20Z.


VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146821602 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1807#issuecomment-7146821602). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-24T22:56:20Z. --- ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Melow-code commented 2026-11-24 23:08:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-24T23:08:31Z.

Review: APPROVED


Explicit-stack BDD with a budget is safer than unbounded recursion. The 121 passing tests on macOS are a good sign — agree that Windows hardware should run before merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048853821 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1807#pullrequestreview-6048853821). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-24T23:08:31Z. **Review:** APPROVED --- Explicit-stack BDD with a budget is safer than unbounded recursion. The 121 passing tests on macOS are a good sign — agree that Windows hardware should run before merge.
upipibi commented 2026-11-25 00:06:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:18:40Z.


NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, c3320ad (on main 70564ae). cargo test -p victory-shader --locked: 209 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures on main, so there are no new failures.

AI-assisted (Claude Code). Synthetic tests only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147253789 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1807#issuecomment-7147253789). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T23:18:40Z. --- NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, `c3320ad` (on `main` `70564ae`). `cargo test -p victory-shader --locked`: 209 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures on `main`, so there are no new failures. AI-assisted (Claude Code). Synthetic tests only.
Marvisak commented 2026-11-25 02:06:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:36:42Z.


Automated triage for the maintainers.

Merge candidate. This is a recommendation to look, not an approval. It now merges cleanly into main. CI: check passing.

The PR moves the recursive BDD operations ite, forget, restrict and meet from structure.rs into structure/bdd.rs, rewritten with explicit task stacks. That removes recursion as deep as the number of atoms, which matters on title threads with small stacks. I compared each with the removed code. The early returns, overflow checks and memo rules are kept, including restrict storing a decided-only path once the memo is non-empty and the MAX_MEMO clear. So are the low-before-high order, meet's MAX_MEET budget, and the refuted set being filled only after both branches fail. The new tests compare every operation with truth tables over three variables, run a 20,000-variable chain, and check the budget-exhausted "yes". Optional tidy-ups: run cargo fmt, and use a title in the repo's "Shaders: ..." style.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149748780 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1807#issuecomment-7149748780). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:36:42Z. --- <!-- victory-triage v1 head=3d8a39a53bda213aa4afb8ddcfd3bbee1cc3faad verdict=merge-candidate at=2026-11-25T19:48:30Z --> Automated triage for the maintainers. **Merge candidate.** This is a recommendation to look, not an approval. It now merges cleanly into `main`. CI: `check` passing. The PR moves the recursive BDD operations `ite`, `forget`, `restrict` and `meet` from `structure.rs` into `structure/bdd.rs`, rewritten with explicit task stacks. That removes recursion as deep as the number of atoms, which matters on title threads with small stacks. I compared each with the removed code. The early returns, overflow checks and memo rules are kept, including `restrict` storing a decided-only path once the memo is non-empty and the `MAX_MEMO` clear. So are the low-before-high order, `meet`'s `MAX_MEET` budget, and the `refuted` set being filled only after both branches fail. The new tests compare every operation with truth tables over three variables, run a 20,000-variable chain, and check the budget-exhausted "yes". Optional tidy-ups: run `cargo fmt`, and use a title in the repo's "Shaders: ..." style. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 19:29:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:29:49Z.

Review: APPROVED


Verified locally merged onto origin/main (63bcca43, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test --locked -p victory-shader --lib structure:: — 17 passed, 0 failed, 1 ignored (including iterative_operations_match_truth_tables, restriction_preserves_multiple_decisions_in_one_walk, deep_diagrams_do_not_use_the_call_stack, and exhausted_search_is_conservative)
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features) — 0 warnings
  • cargo xtask policy — ok (192 files ok)

Review notes

  • Verified exact equivalence of the iterative ite, restrict, forget, and meet rewrites in crates/victory-shader/src/structure/bdd.rs: variable ordering, shortcut precedence, (f, g, h) memo keys and 1 << 18 clearing, mk canonicalization, born[v] >= from quantification, and MAX_MEET conservative handling all match the recursive baseline while keeping call depth constant.
  • Non-blocking observations: meet eagerly builds both cofactors before descending into the low branch (adding pending O(depth * conditions) entries on wide conjunctions compared to lazy recursion), and rustfmt --edition 2024 --check flags 5 lines in structure/bdd.rs (lines 8, 92, 190, 266, and 284).
<!-- greyfinch-sync:Marvisak/VIctory:review:6079553087 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1807#pullrequestreview-6079553087). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T19:29:49Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`63bcca43`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test --locked -p victory-shader --lib structure::` — **17 passed, 0 failed, 1 ignored** (including `iterative_operations_match_truth_tables`, `restriction_preserves_multiple_decisions_in_one_walk`, `deep_diagrams_do_not_use_the_call_stack`, and `exhausted_search_is_conservative`) - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`) — 0 warnings - `cargo xtask policy` — ok (`192 files ok`) ### Review notes - Verified exact equivalence of the iterative `ite`, `restrict`, `forget`, and `meet` rewrites in `crates/victory-shader/src/structure/bdd.rs`: variable ordering, shortcut precedence, `(f, g, h)` memo keys and `1 << 18` clearing, `mk` canonicalization, `born[v] >= from` quantification, and `MAX_MEET` conservative handling all match the recursive baseline while keeping call depth constant. - Non-blocking observations: `meet` eagerly builds both cofactors before descending into the low branch (adding pending `O(depth * conditions)` entries on wide conjunctions compared to lazy recursion), and `rustfmt --edition 2024 --check` flags 5 lines in `structure/bdd.rs` (lines 8, 92, 190, 266, and 284).
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/1807:upstream-pr/1807'
git switch 'upstream-pr/1807'

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/1807'
git switch 'upstream-pr/1807'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1807'
git switch 'upstream-pr/1807'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1807'
git switch 'main'
git merge --squash 'upstream-pr/1807'
git switch 'main'
git merge --ff-only 'upstream-pr/1807'
git switch 'main'
git merge 'upstream-pr/1807'
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!1806
No description provided.