graphics: optimize TrackingSpinLock with TTAS and cached thread ID (cp2077) #2138
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!2138
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2138/head"
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?
@ArtyomZabroda on GitHub · 2026-11-06 15:26 UTC · original
ArtyomZabroda:pr/tracking-spin-lock-ttas→main· +6 −3 · 1 files · 2 commits · merged 2026-11-07 05:30 UTCSmall and quick improvement.
GetCurrentThreadId() WinAPI calls on every lock and unlock.
m_lock.test(relaxed) and pause instructions to reduce cache line bouncing
across CPU cores during contention.
to keep the uncontended fast path inlined and compact.
@coderabbitai[bot] on GitHub · 2026-11-06 15:32 UTC · original · edited 2026-11-07 05:29 UTC
Walkthrough
TrackingSpinLock::locknow checks whether the lock is held after an unsuccessful acquisition attempt. While the lock remains held, the function executes the architecture-specific pause or yield instruction.Suggested reviewers:
nmzikChange: Refactor
Merge Risk:
Minimal · up to
8fea9No identified issue blocks merging after normal checks.
Pre-merge checks:
4 ·
1
Full details: Title check
Explanation
The title names the TrackingSpinLock optimization and the TTAS and cached thread ID changes. The raw summary describes only the TTAS spin-wait change in TrackingSpinLock::lock. It does not mention a cached thread ID, so the title overstates the changeset. The title is partially related, so the check passes.
Full details: Description check
Explanation
The description relates to the changeset. It describes the TTAS contention loop with test and pause instructions, which matches the summary. It also describes a cached thread ID and an out-of-line LockContended() slow path. The raw summary shows no such changes, so those claims are not supported by the changeset summary. The description is related to the changeset, so the check passes.
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 with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 1 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
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
@coderabbitai[bot] on GitHub · 2026-11-06 15:32 UTC · original · reviewed
0e35cba6-321e-475e-aa1a-52a1db9b4e2eReviewing files that changed from the base of the PR and between
182161eb3eandd8bea13928.src/graphics/host_gpu/regionManager.hIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@coderabbitai[bot] on GitHub · 2026-11-07 05:29 UTC · original · reviewed
38b995da-15ed-4566-ac0d-65aa9b4b440fReviewing files that changed from the base of the PR and between
d8bea13928and8fea95dc6a.src/graphics/host_gpu/regionManager.hIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.