gpu: skip timeline polls that cannot release an operation #1491
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1491
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1491"
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?
@NeySlim on GitHub · 2026-10-13 20:52 UTC · original
NeySlim:perf/timeline-idle-poll→main· +157 −5 · 4 files · 1 commits · openTested in God of War Ragnarok (PPSA08332, 05.005).
In this game the GPU command thread is the limit: it is busy 95% of the time, the GPU itself only about half.
CommandScheduler::PopPendingOperationsruns about 2,240 times per frame in the opening cutscene and polls the timeline semaphore (vkGetSemaphoreCounterValue, adrmSyncobjQueryioctl on Linux) every time. 54% of these calls find the operation queue empty, and 3% find an operation at the open tick, which cannot be free since it is not submitted yet. Only about 27 polls per frame actually move the known GPU tick. The polls cost 1.4 ms per frame on that thread.This skips the poll when the queue is empty or when its head is at the open tick. Otherwise it first releases what the known tick allows and polls at most once per call. Skipping a poll is the same as having polled when
CurrentTick()was read, and a later poll releases a superset, so operations run in the same order and never earlier.The only reader of the known tick that did not refresh it is
DescriptorHeap::Commit(reuse of a retired pool). It now polls itself when the oldest pool is not known free and is not at the open tick, likeCommandPool::Commit, so it reuses pools at least as early as before.Testing (Linux, Radeon 8060S, RADV 26.2.3):
CheckSchedulerIdlePolling(--scheduler-only): empty queue, operation at the open tick, submitted tick, submitted tick held by an external semaphore (one poll only), and reuse of a finished descriptor pool without a poll before. It fails on main ("an empty operation queue polled the timeline"), and with each of the 7 mutations I tried, including polling in a loop.PopPendingOperations1.62 -> 0.85 ms per frame (MasterSemaphore::Refresh1.43 -> 0.71).Not tested on Windows. Nothing platform specific: the poll is the same Vulkan call on every platform, it just happens less often.
AI use
I used Claude Code to write the change and the test and to run the measurements above. I reviewed the code and the results before opening the PR.
@coderabbitai[bot] on GitHub · 2026-10-13 20:54 UTC · original
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
615a73cc-50b9-47ce-a554-7637455ab9d2📥 Commits
Reviewing files that changed from the base of the PR and between
df5b9b92beande5e094cdd7.📒 Files selected for processing: 4
src/graphics/host_gpu/renderer/commandScheduler.cppsrc/graphics/host_gpu/renderer/pipeline/descriptorHeap.cppsrc/graphics/host_gpu/renderer/pipeline/descriptorHeap.htests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
The scheduler now refreshes the master semaphore at most once while checking a pending operation, and does not refresh for an empty queue or an unsubmitted tick. The descriptor heap refreshes the semaphore when its oldest pending pool has an older tick that is not yet reported free. Tests cover these conditions, completed-operation release, incomplete work, and descriptor-pool reuse.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Refactor
Merge Risk: ⚪ Minimal · up to
e5e09This change reduces redundant GPU timeline polling while preserving operation ordering and descriptor pool reuse. Tests cover the new conditions. No merge-blocking risk was identified; Windows was not tested.
Pre-merge checks:
4 ·
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 too large.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.