Windows stability fixes found while bringing up Tekken 8 (PPSA10595) #833
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!833
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-833"
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?
@hamzashakir99 on GitHub · 2026-09-25 18:09 UTC · original
hamzashakir99:pr/windows-stability-fixes→main· +831 −105 · 23 files · 13 commits · openSummary
Windows stability fixes found while bringing up Tekken 8 (PPSA10595), an Unreal Engine 5 title. Before these changes the game crashed silently during boot. With them it reaches the title screen, the EULA, the main menu, character select, stage select and an in-game fight (HUD rendered).
None of the changes are game-specific; each fixes a general emulator bug that this title happened to expose.
Changes
CPU / kernel (Windows)
rbprather thanrspwere not patched, so Windows exception frames corrupted live locals.sceKernelRaiseExceptionis parked below its 128-byte red zone before the handler runs.FiberInitialize/FiberFinalize.GPU
maxComputeSharedMemorySize. PS5 shaders can request up to 64 KiB, but NVIDIA RTX 40 exposes 48 KiB in Vulkan. The oversized pipeline was invalid and lost the device.V_NOT_B32with an SDWA partial destination accepts any source selector;MaxBuffersis raised to 64. Covered byshaderCfgTests.Other
KYTY_AUDIO_LATENCY_MS), which reduces crackling when a frame takes longer than usual.KYTY_VALIDATION_NONFATAL=1prints each unique Vulkan validation error instead of exiting on the first one.Testing
shaderCfgTestsandvirtual_memory_allocation_testspass.Known remaining issues (not addressed here)
🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original · edited 2026-09-25 18:30 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
📝 Walkthrough
Walkthrough
The changes add submitted-work GPU buffer readback, known-fill tracking, and limits on dirty-buffer downloads. Guest-stack tracking and Windows signal handling now account for stack ranges and the guest red zone. The red-zone patcher analyzes frame-pointer accesses and jump-table control flow. Other changes update shader limits and decoding, image and sampler handling, pipeline-cache snapshots, Vulkan validation output, audio queue latency, and gamepad-open failure handling.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: 🟡 Moderate · up to
22ffcGPU data may become stale, Windows signal delivery can fail, and some resources or pipeline-cache progress may be lost. Resolve the material paths before merging; the malformed audio setting is a narrower issue.
Security Architecture Review
Security architecture risk: 🟡 Moderate · up to
22ffcA live guest stack can cause protection to be skipped for neighboring memory, and stack registrations can outlive or lose their owner. These conditions could undermine memory-change tracking. The review found no evidence of a host escape or broader security compromise.
Retained concerns
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 8.24% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 85 functions across 22 files. (1 skipped: 1 too large.)
Comment
@coderabbitai helpto get the list of available commands.@ -194,0 +206,4 @@std::fflush(stdout);}return;}@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Skip protection only for the part of the range that overlaps the stack.
UpdateRegionWatchersmerges consecutive pages into oneProtectcall. That call can cover pages on both sides of a stack. The new check returns early when any part overlaps a live stack. The pages outside the stack then stayReadWrite, whilePageStaterecords watchers for them. Guest writes to those pages do not fault, and the GPU cache misses the invalidation.Protect the parts before and after the overlap. Repeat for other live stacks that overlap the remaining parts.
Proposed fix
📝 Committable suggestion
@ -257,0 +416,4 @@if (!slow_readback && buffer.last_gpu_write_tick < m_scheduler.CurrentTick()) {if (ReadbackSubmitted(buffer, chunk, chunk_size)) {m_memory_tracker.UnmarkRegionAsGpuModified(chunk, chunk_size);}@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5305
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 332
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42265
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42129
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 14052
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 16231
Track image-to-buffer writes in
last_gpu_write_tick.SynchronizeBufferFromImagequeuesDownloadImagein the current command buffer but does not updatelast_gpu_write_tick. If the range remains inm_gpu_modified_ranges,ReadMemorycan selectReadbackSubmittedand copy data before the current image download executes. Update the tick after queueing the image download.The
is_writtenupload path already updates the tick inObtainBuffer; no additional assignment is needed there.🐛 Suggested fix
@ -606,0 +785,4 @@if (buffer.Size() > DownloadBudget - download_bytes) {return false;}download_bytes += buffer.Size();@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 2955
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 41887
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 32942
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 25854
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 29000
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 326
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 20199
Chunk oversized dirty buffers during garbage collection.
ObtainBuffer(..., true)can create a buffer for a valid guest range larger than 48 MiB. When that buffer becomes old and remains GPU-dirty, non-aggressive GC skips it, and aggressive GC also skips it because its size exceeds the entireDownloadBudget. The LRU traversal does not remove skipped items, so each eligible GC round repeats this.ReadMemorycan clear the dirty state, and an overlapping request can replace the buffer. Without either path, the device allocation remains cached and continues to consume memory. Reuse the existing 8 MiB readback chunking, with completion waits between chunks, before untracking and retiring an oversized buffer.@ -521,0 +541,4 @@if (m_driver_cache == nullptr || !m_snapshot_pending) {return;}m_snapshot_pending = false;@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Keep the snapshot pending until the write succeeds.
If a periodic
getPipelineCacheData()or file operation fails, this line clearsm_snapshot_pendingbefore the failure. If no new pipeline is inserted,Save()then skips its final write and destroys the driver cache. Clear the flag only after the rename succeeds so the final save can retry.@ -367,0 +368,4 @@// otherwise drain it and crackle. KYTY_AUDIO_LATENCY_MS overrides the 100 ms default.static const uint64_t target_latency_us = [] {const char* value = std::getenv("KYTY_AUDIO_LATENCY_MS");const auto ms = value != nullptr ? std::strtoull(value, nullptr, 10) : 0;@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject trailing text when parsing the latency setting.
Line 371 passes a null end pointer to
std::strtoull, so it accepts a numeric prefix. For example,KYTY_AUDIO_LATENCY_MS=20junkselects 20 ms instead of the 100 ms fallback for invalid values. Require the parser to consume the full string before applying the range check.Suggested fix
@ -2610,6 +2688,7 @@ int32_t KYTY_SYSV_ABI FiberFinalize(FiberObject* fiber) {if (!FiberCompareExchangeState(fiber, FIBER_STATE_IDLE, FIBER_STATE_TERMINATED)) {return FIBER_ERROR_STATE;}LibKernel::UnregisterLiveStack(fiber->addr_context);@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Unregister the fiber stack when the fiber terminates by returning from its entry.
FiberStartTrampolinesets the state toFIBER_STATE_TERMINATEDwhenfiber->entryreturns. After that, theFIBER_STATE_IDLE→FIBER_STATE_TERMINATEDexchange inFiberFinalizefails. The function then returnsFIBER_ERROR_STATEbefore it callsUnregisterLiveStack. The range stays ing_live_stacksforever.This has two effects:
PageManager::Protectrefuses write protection for it. GPU tracking then misses guest writes to that memory.Unregister the stack on every path that ends the fiber's registration. Also unregister any previous registration when
FiberInitializereinitializes the sameaddr_context.Proposed fix
@coderabbitai[bot] on GitHub · 2026-09-25 18:27 UTC · original · reviewed
Actionable comments posted: 6
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
7d2edbed-a44e-4353-9f02-3e5b9b98cc56📥 Commits
Reviewing files that changed from the base of the PR and between
497166009cand22ffc19802.📒 Files selected for processing (23)
src/graphics/host_gpu/pageManager.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.hsrc/graphics/host_gpu/renderer/cache/samplerCache.cppsrc/graphics/host_gpu/renderer/cache/streamBuffer.hsrc/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/image/image.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.hsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/presentation/window/vulkanWindow.cppsrc/graphics/presentation/window/window.cppsrc/graphics/shader/recompiler/ShaderRecompiler.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cppsrc/graphics/shader/recompiler/frontend/decode/VectorAluOps.cppsrc/graphics/shader/recompiler/ir/ShaderIR.hsrc/kernel/pthread.cppsrc/kernel/pthread.hsrc/libs/audio.cppsrc/libs/libKernel.cppsrc/loader/redZonePatcher.cpptests/VirtualMemoryAllocationTests.cpptests/shaderCfgTests.cppIncluded review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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.