pipeline: a stale frame number does not reset the wait budget #98
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/lobomfz--VIctory-xmem!98
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-98"
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?
@coil111 on GitHub · 2026-12-01 19:06 UTC · original
coil111:pipeline-wait-budget→main· +6 −1 · 1 files · 1 commits · merged 2026-12-01 20:55 UTCWhen the title first uses a pipeline that isn't ready yet,
wait()inpipeline/make.rsblocks for at most a shared budget per frame. All threads share theWaitedrecord, and the budget is reset whenever a caller's frame differs from the stored one (waited.frame != frame).A thread that read the frame number just before another thread moved it on still enters with the older frame. The record goes back to that older frame and
spentgoes to zero. The next caller on the newer frame sees a frame change again and resets again. Each time a stale reader comes in, the current frame gets its full budget back, so one frame can stall longer thanwait_budget()/screen_budget()allow.The fix:
6 lines, one file. Within a single frame nothing changes.
@EdouardSence on GitHub · 2026-12-01 21:25 UTC · original
I read this against
wait()/ready()on37bb30f. The race is real but narrow.ready()readsframe::current()right before it takes theWAITEDlock, so a caller is "stale" only when the frame advances in that window (microseconds). It can still reset the budget, so the fix is worth having.One suggestion: the early
returnturns that stale caller into a guaranteed miss. Its draw goes out without the pipeline for that frame, even when the current frame still has budget left. Treating the caller as the newer frame gives the same protection without the forced drop:Since
frame < waited.frameno longer resets anything, the stale caller waits on whatever is left of the current frame's budget, which is what the budget is for. Nothing else inwait()usesframe, so this is the whole change.(Review only. I have not measured it in a run: with all pipelines warm, my runs on an RX 9070 XT hardly enter
wait().)