End clamp runs after draws that store #212
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!212
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-212"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Ingenioeren on GitHub · 2026-11-25 23:43 UTC · original
Ingenioeren:fix/209-store-draws-end-clamp-run→main· +96 −60 · 4 files · 1 commits · openWhat
Count a recorded graphics draw as a possible write when any stage of its bound pipeline has the translated
writes_memoryflag set. This covers direct, indexed, mesh, and indirect draws.Part of #209. Rule 2 (the per-piece clamp budget) is out of scope. Thanks to Marukooh for reporting the ordering bug.
Why
The next indirect draw uses the host list’s write count to decide whether it can reuse the current clamp list. A draw that stores to memory can change indirect arguments or counts. Advancing the write count forces the next indirect draw to reconsider hoisting so its clamp can see those writes.
How tested
The regression and the full suite ran with the AMD Radeon RX 6750 XT as the default D3D12 adapter. The full suite also ran its existing software-adapter fixtures.
cargo test --locked --offline -p victory-gpu pipeline::depth_bounds_test::storing_draw_counts_as_a_write -- --exact --nocapturefailed at the write-count assertion with only thedraw.rschange temporarily stashed. The draw recorded successfully andwrites()returned 0 instead of 1. After restoringdraw.rs, the same command passed (1 passed, 0 failed).cargo test --locked --offline -p victory-gpupassed (114 passed, 0 failed, 4 ignored).cargo clippy --locked --offline -p victory-gpu --all-targetsexited successfully with warnings.cargo run --locked --offline -p xtask -- policy --stagedpassed for all four staged files.Not tested: no game run and no timing with
VICTORY_HOIST_CLAMPS=1. The test checks the write count that ends a run, not a recorded hoisted list.AI assistance: prepared with OpenAI Codex under Claude Code's direction, reviewed by Ingenioeren.
@adrianmjim on GitHub · 2026-11-26 19:51 UTC · original
Tested natively on Windows 11, RX 7900 XT (RDNA3, driver 32.0.32029.2010). Head
888d58a, base4f62c2a.Tests:
cargo test -p victory-gpu --lib: 14 runs each of base and PR, alternating. Other heavy jobs were running on the machine. The only failures were threewatch::testsflakes, one per failing run: two on base (written_pages_are_reported_to_every_asker,a_write_is_reported_at_every_checked_view) and one on the PR (a_write_through_another_view_is_reported_at_the_guarded_one). All other runs: 113 passed on base, 114 on the PR, 4 ignored.storing_draw_counts_as_a_writefails (writes 0, expected 1). It fails on the hardware adapter and on WARP (--features diagnostics,VICTORY_D3D12_WARP=1). With the PR it passes on both.How often draws will count as writes:
writes_memoryis set per shader container: true if any program in it stores or has ans_setpc_b64/s_swappc_b64. I applied the rule from pipeline.rs to every unique container in the shader archive:s_swappc_b64, which lower.rs describes as the vertex fetch call.VS_VoxelizeGeneric) also hold an ES program. All 195 are true through it.Hoisting is on by default (
VICTORY_HOIST_CLAMPSdefaults to 7). After a draw with a storing pipeline, the next indirect draw cuts a new list. If the title's draws use these shaders in about these proportions, most VS/PS indirect draws would be followed by a cut. Mesh runs are only cut when their pixel shader stores. If the fetch call is known not to store, not countings_swappc_b64in vertex programs would stop the 629 fetch-only containers from counting.Not tested: no game run, so the number of extra cuts and any timing change are not measured. The census counts containers, not the pipelines or draws a scene actually uses. In a diagnostics build with
VICTORY_HOIST_FILEset, the "lists cut for hoisted clamps" log line would show the extra cuts with and without this PR.@gut0to on GitHub · 2026-11-27 15:09 UTC · original · reviewed
AI-assisted static review; I inspected the draw-write counter and the clamp-hoisting regression. I did not run the test suite.
@ -133,1 +133,4 @@fn count_draw(list: &HostList, writes_memory: bool) {if writes_memory {list.count_write();@gut0to on GitHub · 2026-11-27 15:09 UTC · original
AI-assisted static review: the new fixture verifies that a storing draw increments the write counter, but the ordering regression is whether the indirect-argument clamp can be hoisted before that draw. Could a synthetic sequence record a draw that writes the indirect arguments followed by the indirect draw, then assert the clamp consumes the post-draw values? This would exercise the ordering decision changed here rather than only its counter input.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.