shader/opt: the visit-budget test uses 5 phi levels, where the budget decides (D3D12-SHADER-BOUNDED-BUDGET-TEST) #2959

Closed
github-bot wants to merge 0 commits from github-bot/gh-2959 into main AGit
Owner

@⁠aznohonza on GitHub · 2026-12-01 21:35 UTC · original
aznohonza:shader/bounded-budget-test → main · +4 −3 · 1 files · 1 commits · closed without merging

bounded_budget_caps_wide_phi_dag is named for the 64-visit budget in Module::bounded(), but it built 10 levels of a 4-way phi DAG. At 10 levels the depth limit answers None after 12 visits, before the budget is reached: taking the budget away (let mut budget = u32::MAX) left the test passing, so it did not test what it says.

Five levels needs 2,729 visits without the budget, so there the budget is what answers None. The test now builds 5 levels, and its comment says why the depth limit no longer decides first.

Verification (Linux, no GPU, no game files):

  • cargo test -p leonida-shader --features host: 250 passed, 2 ignored, 0 failed.
  • Discrimination: with let mut budget = u32::MAX, the 5-level test fails (assertion left == right failed: left: Some(0.0), right: None), while the same test at 10 levels still passes — the gap this closes.
  • The visit figures (64 with the budget, 2,729 without at 5 levels, 12 at 10 levels on the depth limit) come from the finding on the merged #2861, measured the same way.

Test-only: no translator output, no switch, no game data.

Claimed in #2570 (D3D12-SHADER-BOUNDED-BUDGET-TEST). AI-assisted.

**@⁠aznohonza** on GitHub · 2026-12-01 21:35 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2959) `aznohonza:shader/bounded-budget-test` → `main` · +4 −3 · 1 files · 1 commits · closed without merging `bounded_budget_caps_wide_phi_dag` is named for the 64-visit budget in `Module::bounded()`, but it built 10 levels of a 4-way phi DAG. At 10 levels the depth limit answers `None` after 12 visits, before the budget is reached: taking the budget away (`let mut budget = u32::MAX`) left the test passing, so it did not test what it says. Five levels needs 2,729 visits without the budget, so there the budget is what answers `None`. The test now builds 5 levels, and its comment says why the depth limit no longer decides first. **Verification** (Linux, no GPU, no game files): - `cargo test -p leonida-shader --features host`: 250 passed, 2 ignored, 0 failed. - Discrimination: with `let mut budget = u32::MAX`, the 5-level test fails (`assertion left == right failed: left: Some(0.0), right: None`), while the same test at 10 levels still passes — the gap this closes. - The visit figures (64 with the budget, 2,729 without at 5 levels, 12 at 10 levels on the depth limit) come from the finding on the merged #2861, measured the same way. Test-only: no translator output, no switch, no game data. Claimed in #2570 (`D3D12-SHADER-BOUNDED-BUDGET-TEST`). AI-assisted.
`bounded_budget_caps_wide_phi_dag` built 10 levels of a 4-way phi DAG. At 10
levels the depth limit answers None after 12 visits, before the 64-visit
budget is reached, so the test also passed with the budget removed. Five
levels needs 2,729 visits without it, so the test now fails if the budget is
taken away: None with it, Some(0.0) without.

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 21:35:50 +00:00
github-bot changed title from shader/opt: the visit-budget test uses 5 phi levels, where the budget decides (D3D12-SHADER-BUDGET-TEST) to shader/opt: the visit-budget test uses 5 phi levels, where the budget decides (D3D12-SHADER-BOUNDED-BUDGET-TEST) 2026-12-01 21:41:56 +00:00
Author
Owner

@⁠andrew-ai on GitHub · 2026-12-01 21:39 UTC · original

Reproduced on Windows at 535c14094 and its parent 1fff69129. I instrumented the existing wide-DAG test locally to count visits with depth fixed at 12.

Fixture Starting budget Visits used Result
Parent, 10 levels 64 or u32::MAX 12 None
PR, 5 levels 64 64 None
PR, 5 levels 2,728 2,728 None
PR, 5 levels 2,729 or higher 2,729 Some(0.0)

The new fixture isolates the visit cap. Removing the cap would break the assertion on the PR, while the parent would still pass. The focused host-feature test passed on both revisions with their production budget. Verified with Codex assistance for #2570.

**@⁠andrew-ai** on GitHub · 2026-12-01 21:39 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2959#issuecomment-7326597245) Reproduced on Windows at 535c14094 and its parent 1fff69129. I instrumented the existing wide-DAG test locally to count visits with depth fixed at 12. | Fixture | Starting budget | Visits used | Result | | --- | ---: | ---: | --- | | Parent, 10 levels | 64 or u32::MAX | 12 | None | | PR, 5 levels | 64 | 64 | None | | PR, 5 levels | 2,728 | 2,728 | None | | PR, 5 levels | 2,729 or higher | 2,729 | Some(0.0) | The new fixture isolates the visit cap. Removing the cap would break the assertion on the PR, while the parent would still pass. The focused host-feature test passed on both revisions with their production budget. Verified with Codex assistance for #2570.
github-bot closed this pull request 2026-12-01 21:47:53 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-12-01 21:42 UTC · original · reviewed

Verified the arithmetic: with the zero-identity Sub at opt.rs:491-495, each level costs 1 Phi + 4×(1 Sub + previous) from V0=1 — 9 → 41 → 169 → 681 → 2,729 visits — and at 5 levels the depth (11) never reaches the depth = 12 limit, so the 64 budget is what answers None. The test is deterministic (fixed loop counts, Vec order, dedup by value).

The mutations agree: removing the budget or raising it to 2,729 fails with left: Some(0.0), right: None, while 2,728 still passes — so the wide DAG is pinned at exactly 2,729 visits. Non-blocking: the wide assertion only reacts upward; any budget from 13 to 2,728 still passes, and below 13 the small-diamond sub-test at opt.rs:3221 fails first, not the wide DAG. If you want the low side pinned too, a budget assertion on the small test would do it.

Test-only, clean against the merged #2861, and merge-tree is clean. Good to merge.

**@⁠KelboLive** on GitHub · 2026-12-01 21:42 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2959#pullrequestreview-6140677699) · **reviewed** Verified the arithmetic: with the zero-identity `Sub` at `opt.rs:491-495`, each level costs `1 Phi + 4×(1 Sub + previous)` from `V0=1` — 9 → 41 → 169 → 681 → **2,729** visits — and at 5 levels the depth (11) never reaches the `depth = 12` limit, so the 64 budget is what answers `None`. The test is deterministic (fixed loop counts, `Vec` order, dedup by value). The mutations agree: removing the budget or raising it to 2,729 fails with `left: Some(0.0), right: None`, while 2,728 still passes — so the wide DAG is pinned at exactly 2,729 visits. Non-blocking: the wide assertion only reacts **upward**; any budget from 13 to 2,728 still passes, and below 13 the small-diamond sub-test at `opt.rs:3221` fails first, not the wide DAG. If you want the low side pinned too, a budget assertion on the small test would do it. Test-only, clean against the merged #2861, and merge-tree is clean. Good to merge.
Author
Owner

@⁠aznohonza on GitHub · 2026-12-01 21:46 UTC · original

Thanks — that is the boundary I did not measure: the test pins "over the cap", not the exact edge. 2,728 visits do not fit and 2,729 do, and your parent row (12 visits, None with either budget) is exactly the gap this closes.

AI-assisted.

**@⁠aznohonza** on GitHub · 2026-12-01 21:46 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2959#issuecomment-7326750318) Thanks — that is the boundary I did not measure: the test pins "over the cap", not the exact edge. 2,728 visits do not fit and 2,729 do, and your parent row (12 visits, `None` with either budget) is exactly the gap this closes. AI-assisted.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2959
No description provided.