Repository navigation
sync(upstream): integrate Batch 38 ADX lowering, macOS exports, clear-key hand-over, and BDA fault masking - #562
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95ae26e755
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (remaining.empty()) { | ||
| emptyAddresses.push_back(address); | ||
| } else if (remaining.size() != headers.size()) { | ||
| (*registry)[address] = std::move(remaining); |
There was a problem hiding this comment.
Defer registry replacements until after iteration
When a mapping change removes only some shader headers at an address, this assignment calls ShaderRegistry::writable, which replaces the current shared chunk while the range loop's iterator still points into the old chunk. The iterator increment then compares that old map iterator with the new chunk's end(), which is undefined behavior and can walk past the old chunk or crash during a partial shader invalidation. Collect these replacements alongside emptyAddresses and apply them only after the traversal.
Useful? React with 👍 / 👎.
| if (!DirectMemoryAllocated(start, len)) return SCE_KERNEL_ERROR_ENOENT; | ||
| const auto views = DirectMemoryViews(start, len); | ||
| if (!DirectMemoryCheckedFree(start, len)) return SCE_KERNEL_ERROR_ENOENT; | ||
| UnmapDirectMemoryViews(views); | ||
| if (!DirectMemoryCheckedFree(start, len)) return SCE_KERNEL_ERROR_ENOENT; |
There was a problem hiding this comment.
Keep checked release atomic across view unmapping
If guest threads concurrently release and allocate direct memory, this new precheck introduces a TOCTOU window: after DirectMemoryAllocated succeeds, another thread can free and reallocate the same pages while this thread gathers/unmaps views, and the final DirectMemoryCheckedFree will then see the newly allocated pages as used and free the other thread's allocation. The physical span must be claimed under the pool lock before unmapping, or otherwise protected from allocation until the final free.
Useful? React with 👍 / 👎.
…r-key hand-over, and BDA fault masking
95ae26e to
2ba620b
Compare
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Upstream Sync Batch 38, based on
main90b390fa1(Batch 37 + the #561 capture-format fix): 14 upstream PRs, 65 files, +2470 / -101.Integrated upstream PRs
Merged upstream:
SPV_KHR_terminate_invocationis availableOpen upstream PRs, applicable now:
ds_ordered_countswapFork adaptations (Metal path, not upstream)
Execution/Metal/MetalDriver.mm: rebuild the registry through the new chunkedShaderRegistryAPI.MetalBackend/MetalShaderBridge.cpp:DescriptorBinding448 -> 472 and thesamplerCoordinatesIgnoredconversion-key bit for fix(shader): bind an unnormalized S# normalized when it samples only null images boykopovar/AnyPS5#7296.elfpatcher/general/ElfConstants.hpp:SHN_LORESERVE/SHN_ABSfor fix(relinker): preserve executable exports in macOS output boykopovar/AnyPS5#7361.tools/rosetta/tests/CMakeLists.txt: linkAdxLowering.cppintorosetta_cpuid_testsfor fix(relinker): lower ADCX and ADOX for Rosetta boykopovar/AnyPS5#7173.Execution/.../ShaderRegistry.{hpp,cpp}: move the chunked-map method bodies inline so every target that includes the header links them.Findings
MetalDriver::replaceBorrowedRangesassigned(*registry)[address]while iterating*registry;ShaderRegistry::writablecan replace or split a chunk, invalidating the range-for iterator (undefined behaviour during a partial shader invalidation).sceKernelCheckedReleaseDirectMemorycheckedDirectMemoryAllocatedand then freed after unmapping views, so a concurrent release + allocate of the same span let the final free release another thread's allocation (TOCTOU).PhysicalMemoryPool::Claim) before the views are unmapped, and released withReleaseClaim. A release of a claimed span is refused, so the pages cannot be freed and reused in between.fix(shader): end a pixel shader's failed BDA reads through one exit) wraps the pixel body in a second function. The fork's minimum-LOD shadow-sampler bank is an argument-buffer member, andCompilerMSL::to_nameonly emits the qualified alias inside the default entry point, so the generated MSL referencedminimumLodSamplersundeclared.anyps5_metal_guest_draw_replayfailed onPublic pixel LOD mode=0 floor=384withuse of undeclared identifier 'minimumLodSamplers'.captures/agc-live-map/replay-ref-v2.png(2026-10-15) no longer matches currentmain.Gates
tools/check_conventions.py --base maincmake --build build-rosetta --parallel 6ctest --test-dir build-rosettacmake --build build-metal --parallel 6ctest --test-dir build-metalanyps5_agc_replay cap-live-map --repeat 3 --expect-png .../replay-ref-v2.png --max-diff-pixels 200Replay note: the 2026-10-15 reference is stale. On
main(934f20620+ the #561 capture fix) the last repeat is 14257 px off that reference; on this branch 14258 px; repeat-to-repeat noise is 69-82 px. This branch's last repeat is 80 px frommain's dumped frame, inside the frame's 66-98 px inherent race noise. Batch 38 therefore does not change the live-map image; the reference should be refreshed separately.No engine release is published; one is ready after this merge.