perf(faultManager): reduce memset and throttle fault logs #877
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!877
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/877/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?
@Hamadshu on GitHub · 2026-09-27 22:50 UTC · original
Hamadshu:main→main· +60 −14 · 2 files · 5 commits · closed without mergingThis commit reduces per-frame overhead in FaultManager::ProcessFaultBuffer on two fronts:
m_download_buffer initialization:
Fault logging throttling:
The memset reduction cuts per-frame host-to-device transfer from ~8 KiB to 8 bytes, and the logging change cuts worst-case log calls from ~1023 to 17 per frame.
No behavioral changes: the fault data reaching BufferCache::FindBuffer is identical to before.
This commit reduces per-frame overhead in FaultManager::ProcessFaultBuffer on two fronts: 1. m_download_buffer initialization: - The per-frame memset was clearing the entire fault area (8 KiB), even though the compute shader writes fresh entries each dispatch (indexed from counter = 0). - Only the counter (8 bytes) needs to be cleared each frame. - A one-time zero-initialization of the whole buffer is added in the constructor, matching the existing m_gds_buffer pattern in BufferCache. 2. Fault logging throttling: - Each fault was logged unconditionally, producing up to 1023 log lines per frame in the worst case. - The logging is now capped at 16 entries per frame, with a summary line for the remainder. - This preserves diagnostic value (first 16 faults show the pattern) while avoiding log flooding. The memset reduction cuts per-frame host-to-device transfer from ~8 KiB to 8 bytes, and the logging change cuts worst-case log calls from ~1023 to 17 per frame. No behavioral changes: the fault data reaching BufferCache::FindBuffer is identical to before.@coderabbitai[bot] on GitHub · 2026-09-27 22:56 UTC · original · edited 2026-09-28 15:30 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough
FaultManager now clears and flushes the download buffer during construction and clears only the first 64-bit counter before processing an area. It clamps reported fault counts to
MaxPageFaults - 1and limits individual address logging to the first 16 faults. BufferCache uses a thread-local vector to prepare page addresses for page-table writes.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Refactor
Merge Risk: 🔴 Critical · up to
9cd1eThe fault-handling source file in this change does not compile, because a misplaced closing brace leaves duplicated code outside its scope. The emulator cannot be built until this is fixed. The fix is small: remove the stray brace and the duplicated lines. The intended performance improvements otherwise look sound.
Security Architecture Review
Security architecture risk: 🟡 Moderate · up to
9cd1eThe change does not show a new external access path or privilege, but the submitted fault-processing flow contains a residual address-processing block that prevents reliance on the intended bounded processing. Its effect on rollout needs resolution.
Retained concerns
Security review details
Security Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.@ -137,0 +158,4 @@LOGF_COLOR(Log::Color::BrightYellow,"FaultManager: %u more faults suppressed\n", count - 16u);}}@coderabbitai[bot] on GitHub · 2026-09-28 15:23 UTC · original
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Remove the premature closing brace and duplicate trailing code.
Line 161 closes the deferred-operation lambda. The following summary block then uses
countoutside its scope, and the remaining lines useindexand other loop-local values outside their scopes. This file cannot compile. Keep one summary block inside the lambda, after the fault loop, and remove the duplicate lines that follow it.@coderabbitai[bot] on GitHub · 2026-09-28 15:23 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
cc16da74-92d5-49a3-9a1b-6635a62f3c1d📥 Commits
Reviewing files that changed from the base of the PR and between
845ab85bf1and9cd1eb7d19.📒 Files selected for processing (2)
src/graphics/host_gpu/renderer/cache/bufferCache.cppsrc/graphics/host_gpu/renderer/cache/faultManager.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Pull request closed