Hoisted clamps: draws whose shaders store don't end the run, and each cut piece gets a fresh budget (no measured effect, see correction) #209
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#209
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Marukooh on GitHub · 2026-11-25 23:11 UTC · original
Hi! I ported the hoisted clamps of
ccab973to fxceless/victory-fork and measured them on an RTX 5070 Ti (Proton, vkd3d-proton, prologue). Two of its rules did not hold there, and the currentmainstill seems to have both, so here is what I found.1. Draws whose shaders store do not end the run
count_writeis called for dispatches and copies. A draw whose shaders store to buffers does not end the run, so the clamps of the draws after it are recorded before it ran. When such a draw writes arguments, counts or data that later work reads, that work sees what was there before the run.On our side this showed up as the indirect compute
982f3cccd5c04294going from about 12 ms to about 166 ms a call. The frame went from 208 to 342 ms, GPU 102 to 216 ms. Ending the run after any draw whose pipeline has a stage withtranslated().stores, the rule the indirect windows already use, fixed it. With that rule the hoisted clamps gave GPU 95.5 -> 57.8 ms and frame 187.6 -> 160.0 ms against inline clamps, on the same build and scene.2. Each piece gets a fresh budget
bound_beforechargesclamps.budget(), the budget of the clamp list. Each list cut for hoisting has its own budget of 2^27, which is zeroed per list. A title list that used to share one budget now has one per piece. Work that the shared budget would have emptied can then run, for example garbage records after a run, or a dispatch after the run's draws. In my port all pieces of a title list charge the first piece's budget (the card copy handed onCOMMON -> UAV -> COMMON). That alone did not change the timing above, but it keeps the cap where it was.Not checked
I have not run your build. The 166 ms case may depend on the scene, the driver or the wave size. Radeon/Windows could behave differently.
The adapted change, with both rules and two WARP tests: https://github.com/fxceless/victory-fork/pull/1184
@Marukooh on GitHub · 2026-11-25 23:44 UTC · original
Correction to point 1: I was wrong about the cause.
The jump of
982f3cccd5c04294from about 12 ms to about 166 ms a call was not the hoisted clamps. Later runs showed the same 160-169 ms with hoisting off. Over 13 runs it lined up exactly with the card budget the system reports instead. When the budget dropped from ~12.4 to ~10.5 GB near frame 725,982ftook ~12 ms. When it stayed at ~12.4 GB, the texture queue overfilled the card, memory went out to the PC's, and982ftook 160-170 ms. So my "stores rule fixed it" was a coincidence of which budget state each run landed in. Details are in fxceless/victory-fork#1184.With the budget held at 10.5 GB on both sides, hoisted clamps still help on this RTX 5070 Ti (frame 179.8 -> 151.8 ms, title lists 127 -> 107 ms), and
982fstays at ~12 ms either way.What is left of this issue:
Sorry for the noise. Feel free to close this if neither concerns you.
@MamaLeVrai on GitHub · 2026-11-26 04:58 UTC · original
Both rules are in Belobug now as #227: draws whose shaders may write memory end the run, and the pieces of a cut list charge the first piece's budget. Each rule has a test on the host device that fails without it. Your correction is noted there, so it makes no timing claim. Thanks for the clear write-up and fxceless#1184, which it is adapted from.
AI-assisted (Claude Code); no game data.