victory-shader: add forced-var propagation and UNSAT memoization to Bools::meet #947

Closed
Sakura-Byte wants to merge 1 commit from upstream-pr/947 into main
Sakura-Byte commented 2026-11-24 14:25:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Sakura-Byte on 2026-11-24T14:25:37Z.


Summary

  • Add forced-variable propagation and UNSAT memoization to Bools::meet in crates/victory-shader/src/structure.rs to prevent exponential blowup on complex control-flow graphs.
  • Include synthetic unit tests exercising forced-var propagation and UNSAT memoization.

Verification

  • cargo xtask policy and cargo clippy --locked -- -D warnings: clean
  • Verified on Windows 11 (NVIDIA GeForce RTX 5090 D & WARP)

AI-assisted; synthetic tests only, zero game assets.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6583999464 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/947). Originally posted by [Sakura-Byte](https://github.com/Sakura-Byte) on 2026-11-24T14:25:37Z. --- ### Summary - Add forced-variable propagation and UNSAT memoization to `Bools::meet` in `crates/victory-shader/src/structure.rs` to prevent exponential blowup on complex control-flow graphs. - Include synthetic unit tests exercising forced-var propagation and UNSAT memoization. ### Verification - `cargo xtask policy` and `cargo clippy --locked -- -D warnings`: clean - Verified on Windows 11 (NVIDIA GeForce RTX 5090 D & WARP) *AI-assisted; synthetic tests only, zero game assets.*
MichaelSmithAI commented 2026-11-24 15:04:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T14:47:34Z.


A live compute readback on RTX 4090 under Wine/vkd3d-proton 3.2 checked which buffer the shader actually reads after the descriptor values join. On 80a235e, the shader validated and the first two output words were 100 and 101 from the expected buffer. The other 30 words stayed zero. On ffe310e, the same fixture stopped during resource tracking at byte 656, before shader emission.

All three focused Win64 tests passed, including the two existing diamond-chain controls. The Linux shader suite passed 100 tests with one ignored. This shows the solver change admits this source-built shader and preserves its live descriptor choice. Translation time and the number of affected title shaders remain unmeasured.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7134954524 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/947#issuecomment-7134954524). Originally posted by [MichaelSmithAI](https://github.com/MichaelSmithAI) on 2026-11-24T14:47:34Z. --- A live compute readback on RTX 4090 under Wine/vkd3d-proton 3.2 checked which buffer the shader actually reads after the descriptor values join. On `80a235e`, the shader validated and the first two output words were 100 and 101 from the expected buffer. The other 30 words stayed zero. On `ffe310e`, the same fixture stopped during resource tracking at byte 656, before shader emission. All three focused Win64 tests passed, including the two existing diamond-chain controls. The Linux shader suite passed 100 tests with one ignored. This shows the solver change admits this source-built shader and preserves its live descriptor choice. Translation time and the number of affected title shaders remain unmeasured.
Zipettte commented 2026-11-24 16:05:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:40:41Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 80a235e: cargo test -p victory-shader passes, 124 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136427833 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/947#issuecomment-7136427833). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:40:41Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 80a235e: `cargo test -p victory-shader` passes, 124 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
mercuryVM commented 2026-11-24 17:02:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T16:26:30Z.

Review: APPROVED


Tested 80a235e on Windows 11, RTX 5070, MSVC: builds, cargo test --workspace --no-fail-fast 576 passed, 0 failed (on our fork main), with victory-shader single-threaded, including the three new meet_* tests.

I compared victory translate shaders.rpf --list (the user's own package, counts only) on this PR merged into our fork's main against that main:

  • Resource tracking: 26,338 to 26,399 of 26,698 programs tracked. The 61 gained are exactly the ones refused before for "a descriptor read from the first lane of computed VGPRs" (38), "a waterfall loop whose compares do not select the access's lanes" (15) and "a descriptor partly joined by control flow" (8).
  • Emit: all 61 now stop at emit on "a scalar memory read as data" (307 to 368), so the emitted DXIL counts are unchanged: 12,557 VS/PS, 2,187 compute, 8,860 mesh.
  • Time: the list run took 3m27s against 4m09s, but that's a single run each.

On reading, the solver is sound:

  • Propagation: a top variable is forced only when one branch is the failing terminal. restrict stops above max_v, which is correct, since variables increase downward in the ordered BDD.
  • Shortcut answers: a pair with opposite holds is UNSAT, and a single non-constant reduced node is always satisfiable.
  • UNSAT memo: budget exhaustion and node overflow both still answer "yes", so an entry in failed is always a real UNSAT. extra node ids are stable for the life of one Meet, so they are safe as memo keys.

So the gain is the old search giving up rather than any loosening.

Nit: the description should say this changes which programs pass tracking, not only speed.

Merged into our fork's main.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6043223037 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/947#pullrequestreview-6043223037). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T16:26:30Z. **Review:** APPROVED --- Tested 80a235e on Windows 11, RTX 5070, MSVC: builds, `cargo test --workspace --no-fail-fast` 576 passed, 0 failed (on our fork main), with victory-shader single-threaded, including the three new `meet_*` tests. I compared `victory translate shaders.rpf --list` (the user's own package, counts only) on this PR merged into our fork's main against that main: - **Resource tracking:** 26,338 to 26,399 of 26,698 programs tracked. The 61 gained are exactly the ones refused before for "a descriptor read from the first lane of computed VGPRs" (38), "a waterfall loop whose compares do not select the access's lanes" (15) and "a descriptor partly joined by control flow" (8). - **Emit:** all 61 now stop at emit on "a scalar memory read as data" (307 to 368), so the emitted DXIL counts are unchanged: 12,557 VS/PS, 2,187 compute, 8,860 mesh. - **Time:** the list run took 3m27s against 4m09s, but that's a single run each. On reading, the solver is sound: - **Propagation:** a top variable is forced only when one branch is the failing terminal. `restrict` stops above `max_v`, which is correct, since variables increase downward in the ordered BDD. - **Shortcut answers:** a pair with opposite `holds` is UNSAT, and a single non-constant reduced node is always satisfiable. - **UNSAT memo:** budget exhaustion and node overflow both still answer "yes", so an entry in `failed` is always a real UNSAT. `extra` node ids are stable for the life of one `Meet`, so they are safe as memo keys. So the gain is the old search giving up rather than any loosening. Nit: the description should say this changes which programs pass tracking, not only speed. Merged into our fork's main. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 01:04:59 +00:00
Marvisak commented 2026-11-25 01:07:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:28:24Z.


Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

UNSAT memoization in Bools::meet is in main (structure.rs meet_in with refuted); the extra forced-variable propagation comes with no measurement.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148545323 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/947#issuecomment-7148545323). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:28:24Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. UNSAT memoization in `Bools::meet` is in main (structure.rs `meet_in` with `refuted`); the extra forced-variable propagation comes with no measurement. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

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!947
No description provided.