Repository navigation
fix(shader): decode the scalar aperture sources 235-238 instead of failing the shader - #1940
Conversation
|
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
No title was run. 🤖 Addressed by Claude Code |
|
Thank you for this — a native Windows run is exactly the evidence this PR could not produce for itself, and folding 33 AGC/shader PRs into one build is more useful than running yours alone. On the one failure you attribute here: I do not think it is #2257's registration. Its two new modes are added to the same if(WIN32)
set_tests_properties(${preparedTest} PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()so If you can still see the 15:23 failure, could you say which binary it reported as missing, or re-run on #2257's current head from a clean shell? If it does turn out to be the registration I will fix it here, but I would rather correct the cause than the attribution.
Written with AI assistance. |
|
Tested on Windows with a second title that hits the same failure as #1920. Setup: Windows 11 Pro (10.0.26200), RTX 3070, GCC 15.2.0 UCRT (WinLibs), Release. This PR (b0c4d94) merged onto main 54f28f2, together with other open PRs this title needs to get this far (#1836, #1893, #1709, #1837, and #1339 before it merged). Title: Marvel's Wolverine (PPSA03671). Without this PR: the title aborts while preparing shaders with With this PR: that abort is gone. The title runs for the whole 300 s test window without crashing, with the window and swapchain up and about 1,400 shaders compiled. Limits: one title, one run. I have not checked whether the shaders that read the aperture registers render correctly, or whether frames are presented after the swapchain is created. The remaining log lines are shaders deferred at registration for other known reasons (data-dependent |
adriadam10
left a comment
There was a problem hiding this comment.
Checked the decode, the translation refusals and the build: aperture_sources passes here and needs the change to compile. Thanks also to @popcoder565 and @tv7 for the Windows runs. Two things to fix:
core/libs/tests/ApertureSources.cpp:28-33:CheckRefusesTranslationonly checks the decoded kind. The refusal of a read is what the PR promises and replaces the old silent0default, but nothing pins it. Translate an instruction that reads source 235..238 (seecore/libs/tests/ScalarSwappc.cppfor how to build and translate one) and assert that it throws with the source named, for both thereadScalarCodeand thereadRawU32paths.core/libs/prx/libSceAgcDriver/CMakeLists.txt:1024-1030: the new test block is not indented like the surrounding ones.
Once these are in, this is ready from my side.
b0c4d94 to
6532dc7
Compare
6532dc7 to
b7e32b3
Compare
|
Both points are addressed, and the branch is rebased onto 1. The refusal is now pinned by a test that translates, not just a decode check. Two negative controls, each against a rebuilt binary, then restored:
2. The CMake block is indented like its neighbours (4 spaces at statement level, 8 inside One thing I could not test, and would rather flag than paper over: the I have left the guard in place, because it refuses instead of silently returning |
|
Measurement on a real title, in case it helps this land. PPSA26344 (Ghost of Yōtei, 01.008) gets further with this change than without it. Without it — current With it — this branch rebased on
So this change moves the title past the wall #1920 names, which is why One detail worth having, because it is easy to assume the opposite: the new aperture refusal does still fire in these runs — each log records A follow-up build that also names the fields of that refusal ( Three qualifications, so the numbers are not read for more than they are: the runs are not a controlled A/B on a single tree — the later one reused a warm shader cache (1264 hits, no misses) while the first was fully cold; reaching a swapchain is not a correct frame; and the wall the title stops at next is another open question rather than a pass. |
adriadam10
left a comment
There was a problem hiding this comment.
Re-checked after the rebase: aperture_sources now translates s_mov_b32 from sources 235..238 and pins that the refusal names the source; with the OperandAccess.cpp refusals reverted the test fails, and without the change it does not compile. agc_driver_flat_apertures and the scoped ctest are green, CI is green, and the Windows runs by @popcoder565 and @tv7 cover the platform. Merging.
Reading src_shared_base, src_shared_limit, src_private_base or src_private_limit (scalar source codes 235-238) refused the shader since boykopovar#1940, because their values were unknown. They now read as the 64-bit apertures that the flat routing from boykopovar#1190 classifies: a base is the aperture's high dword over a low dword of 0, a limit is the same high dword over 0xffffffff (shared 0x80000000, private 0x70000000). A 64-bit read (s_mov_b64, a 64-bit VALU source, a wave64 lane mask) gets the whole value and a 32-bit read gets the low dword. A flat pointer built from the high dword therefore reaches LDS or scratch, and 64-bit compares against the limits order as on the hardware. The flat routing and the reads share one definition of the two high dwords. Sources: LLVM SIRegisterInfo.td (aperture registers are 64-bit, their low 32 bits are always 0 for a base and -1 for a limit) and getSegmentAperture in AMDGPULegalizerInfo.cpp and SIISelLowering.cpp (a 64-bit read whose high half is the aperture); the RDNA 2 ISA guide, sections 5.2, 5.8 (SH_MEM_BASES holds 16-bit bases) and 9.3; the KFD's MAKE_LDS_APP_LIMIT (limit = base | 0xffffffff); the gfx1030 and gfx1035 readouts on boykopovar#1190 and boykopovar#3803. The PS5's two high dwords stay inferred, as the shader technical debt records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading src_shared_base, src_shared_limit, src_private_base or src_private_limit (scalar source codes 235-238) refused the shader since boykopovar#1940, because their values were unknown. They now read as the 64-bit apertures that the flat routing from boykopovar#1190 classifies: a base is the aperture's high dword over a low dword of 0, a limit is the same high dword over 0xffffffff (shared 0x80000000, private 0x70000000). A 64-bit read (s_mov_b64, a 64-bit VALU source, a wave64 lane mask) gets the whole value and a 32-bit read gets the low dword. A flat pointer built from the high dword therefore reaches LDS or scratch, and 64-bit compares against the limits order as on the hardware. The flat routing and the reads share one definition of the two high dwords. Sources: LLVM SIRegisterInfo.td (aperture registers are 64-bit, their low 32 bits are always 0 for a base and -1 for a limit) and getSegmentAperture in AMDGPULegalizerInfo.cpp and SIISelLowering.cpp (a 64-bit read whose high half is the aperture); the RDNA 2 ISA guide, sections 5.2, 5.8 (SH_MEM_BASES holds 16-bit bases) and 9.3; the KFD's MAKE_LDS_APP_LIMIT (limit = base | 0xffffffff); the gfx1030 and gfx1035 readouts on boykopovar#1190 and boykopovar#3803. The PS5's two high dwords stay inferred, as the shader technical debt records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading src_shared_base, src_shared_limit, src_private_base or src_private_limit (scalar source codes 235-238) refused the shader since boykopovar#1940, because their values were unknown. They now read as the 64-bit apertures that the flat routing from boykopovar#1190 classifies: a base is the aperture's high dword over a low dword of 0, a limit is the same high dword over 0xffffffff (shared 0x80000000, private 0x70000000). A 64-bit read (s_mov_b64, a 64-bit VALU source, a wave64 lane mask) gets the whole value and a 32-bit read gets the low dword. A flat pointer built from the high dword therefore reaches LDS or scratch, and 64-bit compares against the limits order as on the hardware. The flat routing and the reads share one definition of the two high dwords. Sources: LLVM SIRegisterInfo.td (aperture registers are 64-bit, their low 32 bits are always 0 for a base and -1 for a limit) and getSegmentAperture in AMDGPULegalizerInfo.cpp and SIISelLowering.cpp (a 64-bit read whose high half is the aperture); the RDNA 2 ISA guide, sections 5.2, 5.8 (SH_MEM_BASES holds 16-bit bases) and 9.3; the KFD's MAKE_LDS_APP_LIMIT (limit = base | 0xffffffff); the gfx1030 and gfx1035 readouts on boykopovar#1190 and boykopovar#3803. The PS5's two high dwords stay inferred, as the shader technical debt records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading src_shared_base, src_shared_limit, src_private_base or src_private_limit (scalar source codes 235-238) refused the shader since boykopovar#1940, because their values were unknown. They now read as the 64-bit apertures that the flat routing from boykopovar#1190 classifies: a base is the aperture's high dword over a low dword of 0, a limit is the same high dword over 0xffffffff (shared 0x80000000, private 0x70000000). A 64-bit read (s_mov_b64, a 64-bit VALU source, a wave64 lane mask) gets the whole value and a 32-bit read gets the low dword. A flat pointer built from the high dword therefore reaches LDS or scratch, and 64-bit compares against the limits order as on the hardware. The flat routing and the reads share one definition of the two high dwords. Sources: LLVM SIRegisterInfo.td (aperture registers are 64-bit, their low 32 bits are always 0 for a base and -1 for a limit) and getSegmentAperture in AMDGPULegalizerInfo.cpp and SIISelLowering.cpp (a 64-bit read whose high half is the aperture); the RDNA 2 ISA guide, sections 5.2, 5.8 (SH_MEM_BASES holds 16-bit bases) and 9.3; the KFD's MAKE_LDS_APP_LIMIT (limit = base | 0xffffffff); the gfx1030 and gfx1035 readouts on boykopovar#1190 and boykopovar#3803. The PS5's two high dwords stay inferred, as the shader technical debt records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading src_shared_base, src_shared_limit, src_private_base or src_private_limit (scalar source codes 235-238) refused the shader since boykopovar#1940, because their values were unknown. They now read as the 64-bit apertures that the flat routing from boykopovar#1190 classifies: a base is the aperture's high dword over a low dword of 0, a limit is the same high dword over 0xffffffff (shared 0x80000000, private 0x70000000). A 64-bit read (s_mov_b64, a 64-bit VALU source, a wave64 lane mask) gets the whole value and a 32-bit read gets the low dword. A flat pointer built from the high dword therefore reaches LDS or scratch, and 64-bit compares against the limits order as on the hardware. The flat routing and the reads share one definition of the two high dwords. Sources: LLVM SIRegisterInfo.td (aperture registers are 64-bit, their low 32 bits are always 0 for a base and -1 for a limit) and getSegmentAperture in AMDGPULegalizerInfo.cpp and SIISelLowering.cpp (a 64-bit read whose high half is the aperture); the RDNA 2 ISA guide, sections 5.2, 5.8 (SH_MEM_BASES holds 16-bit bases) and 9.3; the KFD's MAKE_LDS_APP_LIMIT (limit = base | 0xffffffff); the gfx1030 and gfx1035 readouts on boykopovar#1190 and boykopovar#3803. The PS5's two high dwords stay inferred, as the shader technical debt records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading src_shared_base, src_shared_limit, src_private_base or src_private_limit (scalar source codes 235-238) refused the shader since boykopovar#1940, because their values were unknown. They now read as the 64-bit apertures that the flat routing from boykopovar#1190 classifies: a base is the aperture's high dword over a low dword of 0, a limit is the same high dword over 0xffffffff (shared 0x80000000, private 0x70000000). A 64-bit read (s_mov_b64, a 64-bit VALU source, a wave64 lane mask) gets the whole value and a 32-bit read gets the low dword. A flat pointer built from the high dword therefore reaches LDS or scratch, and 64-bit compares against the limits order as on the hardware. The flat routing and the reads share one definition of the two high dwords. Sources: LLVM SIRegisterInfo.td (aperture registers are 64-bit, their low 32 bits are always 0 for a base and -1 for a limit) and getSegmentAperture in AMDGPULegalizerInfo.cpp and SIISelLowering.cpp (a 64-bit read whose high half is the aperture); the RDNA 2 ISA guide, sections 5.2, 5.8 (SH_MEM_BASES holds 16-bit bases) and 9.3; the KFD's MAKE_LDS_APP_LIMIT (limit = base | 0xffffffff); the gfx1030 and gfx1035 readouts on boykopovar#1190 and boykopovar#3803. The PS5's two high dwords stay inferred, as the shader technical debt records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
DecodeRdnaScalarSourcethrowsunsupported scalar source operand codefor scalar source codes 235 to 238, which fails the whole shader. Those codes have names —src_shared_base,src_shared_limit,src_private_base,src_private_limit, per LLVM'sSIRegisterInfo.td(lines 266-269) — so this decodes them to their own operand kinds and names, and makes a read of one refuse with a message that names the source instead of falling into the generic invalid-operand path.readScalarCodealso gained explicit refusal cases: itsdefaultanswered 0, which for an aperture base would be a silently wrong address rather than a refusal.What is deliberately not modelled: the value. The wave's shared and private aperture bases and limits are unknown here, so a shader that reads one refuses (and, with #1836's deferral, is left unprepared) instead of being handed a plausible address. A shader that only carries the value into an address — the shape that motivated this — prepares normally.
Tested
aperture_sourcestest: the four codes decode to their four kinds, and an instruction whosesource0is 235 decodes with that kind. It fails onmain(the decode throws) and passes here.ctestdecoder/image/scalar/control-flow subset on lavapipe (the CI device): 62/62 passed.eboot.binrelinked, staged runtime layout, RTX 3080 Ti, Linux. With feat(agc): implement image and sampler tables indexed at runtime offsets #757 + fix(agc): defer shaders that cannot be prepared at registration to their first use #1836 applied it aborted about 13 minutes in withunsupported scalar source operand code 235 at program counter 856(reported as Ghost of Yōtei (PPSA26344): unsupported scalar source operand code 235 at program counter 856 #1920); with this change it runs about 24 minutes and 897 shaders without reaching that call, and the one shader that does read an aperture source is deferred with the named refusal instead of terminating the process.Not verified: the value the console gives these operands (that is what "not modelled" means), and any title whose shaders read rather than carry them.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository