Skip to content

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

Closed
aznohonza wants to merge 1 commit into
ProjectLeonida:mainfrom
aznohonza:shader/bounded-budget-test
Closed

aznohonza wants to merge 1 commit into
ProjectLeonida:mainfrom
aznohonza:shader/bounded-budget-test

Conversation

@aznohonza

@aznohonza aznohonza commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

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):

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

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

… decides

`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.
@aznohonza aznohonza changed the title shader/opt: the visit-budget test uses 5 phi levels, where the budget decides (D3D12-SHADER-BUDGET-TEST) shader/opt: the visit-budget test uses 5 phi levels, where the budget decides (D3D12-SHADER-BOUNDED-BUDGET-TEST) Dec 1, 2026
@andrew-ai

Copy link
Copy Markdown

Reproduced on Windows at 535c140 and its parent 1fff691. 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.

@aznohonza aznohonza closed this Dec 1, 2026

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@aznohonza

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants