Repository navigation
fix(agc): skip fetch shaders at registration without logging them as unsupported - #22082
Conversation
…unsupported PlanRegistered logged every registered type 8 header as "unsupported registered shader type 8; it is not prepared at registration". Type 8 is Fs in libSceAgc's ShaderBinaryType, a fetch shader, which runs inside the vertex program that calls it and has nothing of its own to prepare. Forspoken registers about 2,900 of them per run, so the message made up most of its log. Type 8 now returns without a plan, as types 3 and 5 already do; other unknown types are still logged and still throw when used. The registration test keeps an unknown type (9) for that path and checks that a fetch shader registers without the message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
kurexw
left a comment
There was a problem hiding this comment.
Tested on macOS 27.2 on an Apple M4. This is an x86-64 build under Rosetta with Apple clang 21.0.0, on MoltenVK 1.4.2 from the LunarG Vulkan SDK 1.4.363.1.
Method. The base was main at a72186d plus #22056 and #22074, which fix the macOS build of two other targets; both have since merged. I built the base and this PR merged onto it (a clean merge) in two separate build directories. I ran them alternately, base then PR, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer: three runs each:
ctest --test-dir build -R '^agc_driver_prepared_shaders' -V
| base (3 runs) | This PR (3 runs) | |
|---|---|---|
26 agc_driver_prepared_shaders* tests |
Passed | Passed, including the new FetchShaderRegistration |
| Layer inserts per run | 56 | 56 |
was not found but was requested |
0 | 0 |
VUID- lines |
0 | 0 |
Negative control. I kept this PR's test and restored the base's ShaderRegistry.cpp. Then agc_driver_prepared_shaders fails with a fetch shader was logged as an unsupported registered shader type, after logging Shader 0x… has unsupported registered shader type 8; it is not prepared at registration. That matches the description.
I didn't run a title.
|
Thanks @kurexw, that covers the macOS/MoltenVK side, and the negative control shows the test catches the old log line. |
|
Windows + NVIDIA result for head Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, Validation-layer protocol on
The tests this PR adds or changes ( AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
|
Thanks @maskym for the Windows run. I've added it to the Tested section, linked to your comment. |
|
Ran Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
Both runs select Negative control: the PR's No new AI-assisted: yes (Claude Code) |
|
Thanks @domx4q for the validation-layer run on the 4090, and for repeating the negative control. I've added it to the Tested section, linked to your comment. |
|
Windows + AMD run; I found no AMD run in the description or in the comments. Head Setup: Windows 11 25H2 (build 26200), AMD Radeon 760M integrated graphics (
Test names22 tests: 4 tests: AI-assisted: yes (build and runs scripted with an AI assistant, on the hardware above). |
|
Thanks @rafaconvaitis for the Windows + AMD run with the validation layer, the first AMD result on this PR, and for the negative control on |
|
Head No new failures and no new validation messages on either GPU.
Layer runs used AI-assisted: yes |
|
Thanks @Colewiz7 for the RADV run on both GPUs with the validation layer. It is in Tested now, and both GPUs are on the GPUs tested line. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change handles fetch shader type 8 as an intentionally skipped registration type, preserves logging for unknown type 9, and the inspected evidence supports merging at head 73442e34a794cc9d0fd9949934ce867d0e70a8e5.
What I ran
No commands were run; review used the prepared diff and the pinned reader. The reader is named repo_read.py.
Results
| Check | Result | Note |
|---|---|---|
| Code review | passed | All three changed files read |
| Tests | not run | Reported runs are author supplied |
| Negative control | not run | Not run in this review |
Findings
Blocking
None.
Non-blocking
None.
Sources
ShaderRegistry.cpp:1549adds type 8 to the registration skip cases; the default branch still logs other unknown types.PreparedShaders.cpp:1252-1271tests that type 8 is not logged as unsupported and that type 9 remains logged.- The debt entry records the documented shader type behavior.
Not verified
No tests were run independently. The platform and GPU results in the PR description were not independently verified. Files read: ShaderRegistry.cpp, PreparedShaders.cpp, fix-agc-fetch-shader-registration.md, and the prepared description.md, commits.md, manifest.json, and diff.patch. No changed files were excluded; files.json was not present in the review listing.
To get this to a good state
Nothing is required.
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
|
Thanks @kiwe147 for including this one in the batch. The |
What
PlanRegistered(Execution/src/Driver/Shaders/ShaderRegistry.cpp) logs every registered shader of a type it doesn't prepare asShader 0x… has unsupported registered shader type N; it is not prepared at registration. Forspoken (PPSA03984) registers about 2,900 type 8 headers per run, so that line is most of its log: 2,852 to 2,990 lines in each of my six runs today.Type 8 is
Fsin libSceAgc'sShaderBinaryType(Shader/include/ShaderConstants.hpp), a fetch shader. A fetch shader is a subroutine the vertex program reaches throughs_swappcto an address in its user data. The vertex program's preparation follows those calls (FindUserDataCallswith theSwappcInfo), so a fetch shader has no program of its own to prepare. Skipping it at registration is the right outcome, not an unsupported case.What this changes
case 8joinscase 3: case 5: return {};, so a fetch shader is skipped at registration without a message.UnsupportedTypeRegistrationused type 8 as its unknown type; it now uses 9.Registered shader typesdebt entry called type 8 unknown, citing Registering a shader of type 8 aborts the title: "AGC driver: unsupported registered shader type" #1892's observation that its headers carry no context registers. The fragment now names it, with types 3 and 5 alongside, and adds Forspoken to the titles that register type 8.Tested
Linux (Ubuntu 26.04.1, kernel 7.0), GCC 15.2, Ninja, Release,
-DBUILD_TESTING=ON, RTX 4070 Ti (NVIDIA 615.71.09):agc_driver_prepared_shadersgainsFetchShaderRegistration, run beforeRegistration. It registers a type 8 header and checks the captured log has nounsupported registered shader typeline. Then it registers a type 9 header and checks the log hasunsupported registered shader type 9.UnsupportedTypeRegistrationnow registers type 9 twice, as it did type 8.agc_driver_prepared_shaderspasses, 3 runs.main'sShaderRegistry.cppand the new test, it fails witha fetch shader was logged as an unsupported registered shader type, aftermainlogsShader 0x… has unsupported registered shader type 8; it is not prepared at registration.73442e34a7merged intomaine069a7562f(Windows 11, i7-12700K, RTX 2070 SUPER, WinLibs GCC 15.2.0, Release, Khronos validation layer 1.4.366): theagc,guest_video_out,video_outandpad_sdltests pass 2050 of 2054 on bothmainand this PR with the same set ofVUID-messages, the tests this PR adds or changes pass, and the three failures also fail onmainthere.a72186d3cfplus this change:agc_driver_prepared_shaderspasses on both trees, the layer loads in both, and neither log has aVUID-line. Withmain'sShaderRegistry.cppthe new case fails with the same message as above.git merge-treeagainstmainis clean. Five open PRs change other parts ofPlanRegistered(fix(agc): defer a registered shader whose code does not decode instead of aborting #15499, feat(agc): resolve runtime sampler addresses through device image keys #13929, feat(agc): resolve table samplers through device image keys #13928, feat(agc): serve lane-keyed, pointer and runtime image-table columns #10193, feat(agc): look up table images at run time through a device image table on the GPU heap (APS5_GPU_PATH) #7642); none touches the type switch.tools/check_conventions.pypasses on the branch and this body.tools/debt_fold.py --checkreports nothing for this fragment (mainitself fails it on two LibreSSL3 fragments that change the same entry).73442e34a7merged ontomain9a50e1014e(Radeon 760M, AMD Software 26.11.2, WinLibs GCC 15.2.0, Khronos validation layer 1.4.363): the 26agc_driver_prepared_shaders*tests pass 3/3 on both sides with noVUID-lines; with this PR's tests onmain's sources, the fouragc_driver_prepared_shaderstests fail, each logginga fetch shader was logged as an unsupported registered shader type.73442e34a7merged ontomain0a025bd3c6(Mesa 26.2.6, RX 7900 XT and the 7800X3D iGPU, Khronos validation layer 1.4.363.1): no new failures againstmainon either GPU in the full suite on the 7900 XT and the GPU tests on the iGPU, and noVUID-orSYNC-HAZARDlines.73442e34a7, applied with other PRs ontomainfd4aeed483(one combined tree, not this PR alone), Windows 11, WinLibs GCC 15.2.0 r7, Release, no validation layer: the 6agc_driver_prepared_shaders*tests pass on an NVIDIA GeForce RTX 3080 (driver 621.24) and on the AMD Radeon iGPU of a Ryzen 7 9800X3D (gfx1036).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)