shader: reading a scalar aperture source as a value refuses (Ghost of Yōtei PPSA26344, shader 0x8000356b00) #3803
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T16:51:27Z.
Reading a scalar aperture source as a value refuses, and one shader of Ghost of Yōtei reads one
The four scalar aperture sources —
src_shared_base(235),src_shared_limit(236),src_private_base(237),src_private_limit(238) — decode to their own operand kinds since #1940, but their value was left unmodelled: both the scalar-code read and the raw-operand read refuse with the source named, andTechnicalDebt.mdrecords that as deliberate, because the wave's aperture bases and limits were unknown.What that costs on a title. Ghost of Yōtei (PPSA26344) reads one. On a tree carrying the merged
#3300dispatch split, one shader is refused at registration, in two separate runs:To be exact about the evidence: that message appears once in each run that shows it, for that one shader. It is not a fleet of shaders — the counts that look larger in these logs belong to a different, by-design case (
s_swappc_b64call deferrals, 104 per run, which are expected and not related).In a run of a build that rebuilt
OperandAccess.cppfor this change (yotei-spike-aperture.log, frombuild-spike-aperture), no aperture refusal appears anywhere in the log and the title reaches a different wall (image descriptor is incompatible with the static runtime image interface, which is a separate matter). That is what that one run shows; it does not by itself prove the change is why it got there, since the runs end at different points. The later run that ends at the min/max wall is a different build — it rebuilt the image emitter and the materializer, notOperandAccess.cpp— so it is not evidence about this change either way.The model, stated as a choice rather than a measurement. Both bases read as 0; the shared limit reads as the shader's LDS byte size and the private limit as its scratch size in bytes — the two sizes the IR already carries (
ShaderInfo::sharedMemoryBytes,ShaderInfo::scratchDwords). The console's own aperture values are not measured, so a title that depends on a non-zero base, or on a limit other than the sizes this emulator allocates, would read a value the console does not have. TheTechnicalDebt.mdentry is rewritten to say exactly that rather than removed.Test.
core/libs/tests/ApertureSources.cppasserted the refusal (CheckReadRefuses→ExpectRefusal); it now asserts the read is accepted, per source. Rebuilt and run:aperture sources tests passed, exit 0. That is all it asserts — it does not check the value emitted. It can:IrProgram::Blocks()→IrBlock::Instructions()gives the translated instructions andIrValue::HasImmediate()/ImmediateU32()the constant, so withprogram.Info().sharedMemoryBytesandscratchDwordsset by the test the four values could be asserted directly. Worth doing when this becomes a patch rather than an issue.Shape of the change — three files, five hunks:
On current
mainthe same code sits 21 lines later (SrcSharedBaseat 482, against 461 on this branch), so the hunks apply with a shift. Happy to send it as a PR based onmain— the only reason this is an issue rather than a PR is that I have not run amainbuild, and this tree's commits are local work-in-progress ones that the repository's commit-subject check rejects.Environment: lavapipe (Mesa 26.2.4 / LLVM 23.1.1), CachyOS, on a frontier tree carrying the merged
#3300.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T17:17:14Z.
I checked primary sources before carrying this into code. The AMD RDNA 2 ISA reference describes
SHARED_BASE/LIMITandPRIVATE_BASE/LIMITas memory-aperture operands and says their values depend on 32-bit versus 64-bit system addressing. The LLVM AMDGPU backend guide says that for GFX9–GFX11 these sources provide aperture bases for flat/segment address conversion; in 64-bit mode the apertures are 2^32 bytes and their bases are 2^32-aligned.That does not establish the PS5's exact returned values, but it does not support treating
SHARED_LIMITas the shader's LDS byte size orPRIVATE_LIMITas its scratch allocation size. The recompiler currently models those memories as workgroup/function-local SPIR-V storage, so returning those guessed values could change shader calculations that use the aperture address.Could you provide the PS5 address mode and oracle values for these four operands, ideally for dispatches with different LDS and scratch allocations? Then the regression can assert the emitted values as well as that the reads are accepted. Until then, keeping these operands unsupported matches the evidence currently available.
Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-12T23:52:46Z.
Hi, this is Blazing Cook. Following up on Marc's measurement request: #4706 now reports Ratchet & Clank (PPSA01474) reaching
src_private_baseafter its call-linking change, so these values matter for that next stop too.I checked the earlier evidence with a second review. Adrià's gfx1035 measurements in #1190 establish the Linux GPU result. The PS5 shared/private high-dword patterns used there,
0x80000000/0x70000000, were inferred from game shader addresses. I haven't found a published native PS5 readout of all four operands.Could someone with a native PS5 shader test harness share a small reproducible capture? If this has already been measured, a link to that capture would help.
For each source below, please record a separate
s_mov_b32result and both destination words froms_mov_b64, explicitly labelled low/high:src_shared_basesrc_shared_limitsrc_private_basesrc_private_limitThat's 12 raw 32-bit words per run. The width matters: LLVM reads the 64-bit base and extracts its upper half; a 32-bit base read returns zero in that supported environment. That doesn't tell us the PS5 result.
Please include:
PTR32/ aperture addressing mode and how it was established, if available. Otherwise mark it unknown. CPU executable bitness alone doesn't establish this; RDNA 2 §9.3 describes a per-wave mode. TheSH_MEM_BASESstate associated with that dispatch is useful too, if the harness can capture it.A standalone probe is enough; no game dump is needed. Existing title logs identify the unsupported read, but don't supply its console value. These measurements would let us check the emitted values and their consistency with FLAT routing; a later title run would still be needed to establish progress in Ratchet.
AI-assisted with Codex; sources and request independently cross-checked.
Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-13T00:13:14Z.
A second Linux data point, not the PS5 measurement requested above. On gfx1030 (Radeon PRO V620) all four operands read exactly the gfx1035 values @adriadam10 measured in #1190. Both widths are below, in the 12-word layout @cookie42073-cmd asked for.
s_mov_b32s_mov_b64lows_mov_b64highsrc_shared_base0x000000000x000000000x00010000src_shared_limit0xffffffff0xffffffff0x00010000src_private_base0x000000000x000000000x00020000src_private_limit0xffffffff0xffffffff0x00020000Two cards gave identical results. A 32-bit read returns the same value as the low word of the 64-bit read. On Linux those low words are 0 for the bases and
0xfffffffffor the limits, so this can't tell "a 32-bit read returns the low word" apart from "a 32-bit read returns a fixed value". A PS5 run would separate them only if its low words differ.A note for whoever stubs these before a PS5 readout exists. Main's FLAT routing from #1190 (
SplitAperture) treats a high word of0x80000000as the shared aperture and0x70000000as the private one, and those are the PS5's inferred bases. A stub returning the Linux values above would make a title build flat pointers with high words0x00010000or0x00020000, andSplitAperturewould send those to global memory. Values that agree with the existing routing would be:0x80000000_00000000/0x80000000_ffffffff0x70000000_00000000/0x70000000_ffffffffThese are still inferred, not measured.
For Ratchet & Clank (see #4706), I stubbed the Linux values locally. The title gets past the read, but it stops later at an unrelated table shape, so that run says nothing about whether the values are right.
Probe, build and disassembly
ROCm 6.3.3 HIP on Linux (KFD, HSA 64-bit addressing), compute queue,
--offload-arch=gfx1030(wave32). One workgroup of 64 lanes; lane 0 of workgroup 0 writes the results; read back afterhipMemcpy.llvm-objdump --mcpu=gfx1030of the device code:Tested and written by Claude (AI assistant) on a contributor's machine.