Skip to content

feat(agc): divide the PS4 vertex instance index by VGT_INSTANCE_STEP_RATE_0 - #20153

Open
puridanish284 wants to merge 6 commits into
boykopovar:mainfrom
puridanish284:claude/ps4-instance-step-rate
Open

puridanish284 wants to merge 6 commits into
boykopovar:mainfrom
puridanish284:claude/ps4-instance-step-rate

Conversation

@puridanish284

@puridanish284 puridanish284 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What

PS4 (GCN) vertex programs with a VGT_INSTANCE_STEP_RATE_0 other than 1 were refused with GCN vertex instance step rates other than 1 are not implemented. A plain vertex program whose SPI_SHADER_PGM_RSRC1_VS.VGPR_COMP_CNT loads v1 now receives the instance index divided by that rate in v1. v2 and v3 keep the instance index, as before. This is the layout the vertex case of shadPS4's EmitPrologue (a26cac679b3f) uses for v1 and v3.

  • DecodeShaderStages reads the rate into ShaderStages::instanceStepRate (1 when the register is unset), and ApplyInstanceStepRate copies it into ShaderVertexStageInfo at the four places that already apply the point size.
  • The rate is part of the shader cache key (CacheKey.hpp), the draw cache (DrawLookup, sameVertexInfo) and the serialized request. The request serialization version goes to 64 (main writes 63 and refuses 58 to 61). The rate is written before main's version 63 emulated barycentrics flag, and version 63, 62 and 57 requests still read with a rate of 1.
  • The translator seeds v1 with UDiv32(instance, rate) when the rate is not 1.
  • Still refused: a rate of 0 (shadPS4 writes 0 to v1 then, unmeasured), and a VGT_INSTANCE_STEP_RATE_1 other than 1 when v2 is loaded (shadPS4 divides by it, but what a plain VS receives in v2 is not confirmed). Both are recorded in docs/dev/debt/libSceAgcDriver.md.
  • The recipe codec is unchanged. It already leaves out legacyVertex, because these fields reach pipelines through the shader requests. Only the ShaderStages size assert moves from 164 to 168, and sizeof(State) stays 952.

Tested

WSL2 Ubuntu 24.04, gcc 13.3, Release, lavapipe (Mesa 25.2.8, Vulkan 1.4.318), Khronos validation layer 1.3.275, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. Same machine and build directory for both runs.

  • New agc_driver_gcn_instance_step_rate: a GFX7 vertex program stores v1, v2 and v3 into a buffer indexed by v3, over 7 instances at rates 1, 2, 3 and 8. It checks v1 = instance / rate and v2 = v3 = instance. With v1 forced back to the plain instance, it fails (rate 2, instance 1: v1 is 1, not ... (0)).
  • agc_driver_graphics: decode of the rate for VGPR_COMP_CNT 1 to 3, an unset register, a program that loads no instance, the two refusals, the cache key and the request round trip.
  • request_serializer: version 64 round trip, truncation and reading versions 63, 62 and 57; main's version 63 single-sample dither checks now start from version 64 and probe 65 as unsupported.
  • agc_shader_memory and agc_shader_memory_coherent_atomic_loads: the new-request prefix is version 64, the unsupported-version probe moves to 65, main's emulated barycentrics check starts from version 64, and the version 56 fixture also drops the 4-byte rate of a vertex request.
  • Focused set after merging main 26194f0: request_serializer, agc_shader_memory*, agc_gcn_*, agc_driver_gcn_*, agc_driver_graphics, agc_driver_draw_cache*, with VK_LOADER_DEBUG=layer (every test's log shows Insert instance layer "VK_LAYER_KHRONOS_validation").
main 26194f0 this PR 5e025f0
Tests 39/39 passed 40/40 passed (the new test added)
VUID-vkCmdDraw-None-07629 450 450
VUID-VkDeviceCreateInfo-pNext-pNext 153 156
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0

agc_driver_gcn_compare_exec_writes skips on lavapipe on both. The pNext VUID is the known one from Ubuntu's older validation layer (#17693) and comes once per device creation, so the 3 extra lines are the new test's own devices. 07629 comes from tests this PR does not touch and has the same count on both.

Not run on a title: no title report hits this refusal yet.

pr_overlap failed closed: 97 of the 105 branches it flags conflict with main themselves. The 8 it could compare (#11551, #14561, #15343, #19373, #19821, #20010, #20030, #20111) share only the serialization version number or the ShaderStages size assert, which whichever merges second re-bumps. None of them handles instance step rates.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: lavapipe (llvmpipe, Mesa 25.2.8, Vulkan 1.4.318) on WSL2 Ubuntu 24.04; no hardware GPU
  • AI-assisted: yes

🤖 Generated with Claude Code

…RATE_0

A plain PS4 vertex program that loads v1 now receives the instance index
divided by VGT_INSTANCE_STEP_RATE_0 instead of being refused when the
rate is not 1. The rate travels in the vertex stage info, so it keys the
shader cache, the draw cache and the serialized request (version 58).
A rate of 0, and a VGT_INSTANCE_STEP_RATE_1 other than 1 when v2 is
loaded, still throw; the debt file records why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@puridanish284 the Windows job fails on bfc4a26: agc_shader_memory and agc_shader_memory_coherent_atomic_loads. This PR moves RequestSerializer to version 58, but core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp still expects 57: new requests did not use serialization version 57 (the encoded prefix), the unsupported-version list, and a legacy fixture did not start from serialization version 57 with its truncation sizes. The focused set in the body did not include agc_shader_memory, which is why it passed locally.

Please update those ShaderMemory expectations the way RequestSerializerTests.cpp already is in this PR (new prefix for 58, the next unsupported version, the legacy fixture at 58 with its truncation by the size of the field you added, plus a read of a version 57 request), and run agc_shader_memory and agc_shader_memory_coherent_atomic_loads. #20030 and #20111 also move the serializer to 58 and edit the same lines; whichever lands second takes 59, so a rebase will be needed anyway.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 15343 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229-230, L787, L902-906, L1197, L1238, L1254
PR 15548 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238
PR 17611 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238
PR 19821 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L210, L229-230, L787, L902-903, L1197, L1238, L1254
PR 20010 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238, L1254
PR 20518 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L50-52
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9198-9205, L9260-9262
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L204-206, L787, L902-903, L1196-1197, L1238
PR 22251 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L46
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238
PR 22328 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L46
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238
PR 22439 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L46
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L50-51
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L1420-1421, L1425-1427
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/Translation/src/InstructionTranslator.cpp L529
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238
PR 23243 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229-230, L787, L902-903, L905-906, L1197, L1238
PR 23244 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229-230, L787, L902-903, L905-906, L1197, L1238
PR 23553 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9199-9205, L9262
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L993
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-906, L1196-1197
PR 23811 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L50-52
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9198-9205, L9260-9262
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L204-206, L787, L902-903, L1196-1197, L1238
PR 23818 core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp L50-52
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238, L1253-1254
PR 24721 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9198-9205, L9260-9262
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L204-206, L787, L902-903, L1196-1197, L1238
PR 24906 core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L210, L787, L1254
PR 25489 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L46
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L205-206, L229, L787, L902-903, L1197, L1238
PR 25576 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L9021, L9142, L9199-9205, L9262-9263
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L930, L983, L993, L1068
core/shader/recompiler/tests/RequestSerializerTests.cpp L204-206, L228-229, L787, L902-903, L1196-1197, L1238

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.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 1896 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5371 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5609 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/shader/recompiler/Recompiler.hpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Recompiler.hpp
docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/shader/recompiler/Recompiler.hpp
PR 6235 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.hpp
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6995 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7085 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7682 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 8592 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9356 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9387 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9508 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9563 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 9712 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9852 core/shader/recompiler/Recompiler.hpp
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9897 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.hpp
PR 9915 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9950 docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10359 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/Translation/src/InstructionTranslator.cpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10652 core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/Recompiler.hpp
PR 10743 docs/dev/debt/libSceAgcDriver.md
PR 11442 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 11483 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 12324 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 12792 docs/dev/debt/libSceAgcDriver.md
PR 12828 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.hpp
PR 12840 docs/dev/debt/libSceAgcDriver.md
PR 12944 core/shader/recompiler/Recompiler.hpp
PR 13863 docs/dev/debt/libSceAgcDriver.md
PR 13920 docs/dev/debt/libSceAgcDriver.md
PR 13928 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13929 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/CacheKey.hpp
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/tests/RequestSerializerTests.cpp
docs/dev/debt/libSceAgcDriver.md
PR 14032 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.hpp
PR 14473 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 14853 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 14871 core/shader/recompiler/Recompiler.hpp
PR 14944 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/Recompiler.hpp
docs/dev/debt/libSceAgcDriver.md
PR 14964 docs/dev/debt/libSceAgcDriver.md
PR 15136 docs/dev/debt/libSceAgcDriver.md
Report truncated: 39 more lines omitted.

@tablefrogpillow

Copy link
Copy Markdown
Contributor

Cross-HW verified on real AMD RADV across three generations (Mesa 26.2.6, validation layer 1.4.363), head bfc4a261 vs parent 5358c307. Tests via ctest (needs a cmake reconfigure after checkout for the new test).

GPU agc_driver_gcn_instance_step_rate agc_driver_graphics request_serializer
Vega (RADV VEGA10, GCN5 — native GCN arch) PASS PASS PASS
RDNA2 (RADV RAPHAEL_MENDOCINO, gfx1036) PASS PASS PASS
RDNA3 (RADV NAVI31, gfx1100) PASS PASS PASS

The new test confirms v1 receives the instance index divided by VGT_INSTANCE_STEP_RATE_0 for rates 1/2/3/8 over 7 instances while v2/v3 keep the raw instance — on all three gens, no divergence (and it's clean on Vega, the native GCN architecture this PS4-path feature targets).

Negative control (gen-independent): worth noting the new test exercises the recompiler prologue divide, not the decode-time refusal — setting the pre-fix decode throw back does not fail it (the test bypasses DecodeShaderStages). The faithful control is reverting only the prologue divide in emitEntryPrologue to its pre-fix form (v1=v2=v3 = raw instance); the test then fails deterministically:

GCN instance step rate 2, instance 1: v1 is 1, not the instance divided by VGT_INSTANCE_STEP_RATE_0 (0)

confirming it detects the divide. (The decode refusal this PR removes is validate(..., "GCN vertex instance step rates other than 1 are not implemented").)

AI-assisted: yes

@tablefrogpillow

Copy link
Copy Markdown
Contributor

Corroborating @oneandonlydean — this isn't Windows-specific. On Linux (RADV VEGA10) at bfc4a261, both tests fail the same way:

2957 - agc_shader_memory ...........................***Failed  (new requests did not use serialization version 57)
2958 - agc_shader_memory_coherent_atomic_loads .....***Failed  (new requests did not use serialization version 57)

So it's the cross-platform serializer-version mismatch (PR bumps RequestSerializer to v58, but tests/ShaderMemory.cpp still encodes/expects v57), exactly as described — the ShaderMemory.cpp prefix/unsupported-version/legacy-fixture expectations need the same v58 update that RequestSerializerTests.cpp already got in this PR.

To scope my earlier cross-HW note: it covered agc_driver_gcn_instance_step_rate / agc_driver_graphics / request_serializer (which pass 3-gen) — the instance-step-rate behavior itself (the prologue instance/VGT_INSTANCE_STEP_RATE_0 divide) is correct on Vega/RDNA2/RDNA3. agc_shader_memory was outside that set, and it does fail until the ShaderMemory expectations are moved to v58. (And per the note, with #20030/#20111 also going to v58, whichever lands second will need v59 + a rebase.)

AI-assisted: yes

@hamdanpor-ctrl

Copy link
Copy Markdown
Contributor

Test report, NVIDIA on Windows: confirms the agc_shader_memory failure reported above; the new agc_driver_gcn_instance_step_rate passes.

  • GPU: NVIDIA GeForce RTX 3050 Laptop GPU, driver 617.42, Windows 11 Pro (10.0.26300)
  • Build: WinLibs GCC 15.2.0 r7 UCRT, Release, all AGC execution tests built
  • Compared: main at 93e73cc with fix(tests): set the upload cache test's environment with _putenv_s on Windows #19899 merged (current main does not build on MinGW: UploadCacheReadOnlyFlush.cpp:177: 'setenv' was not declared), and the same tree with bfc4a26 merged (git merge --no-ff, clean)
  • Environment: ANYPS5_GPU=NVIDIA, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0)
  • Command: ctest --test-dir build -V --parallel 4 -R "^agc_|^request_serializer|shader"
main main + this PR
Passed 1763 1762
Failed 0 2
Skipped 18 18
VUID- lines 0 0
Validation messages 61 61, same IDs
  • agc_driver_gcn_instance_step_rate (new) passes in 1.5 s.

  • agc_shader_memory and agc_shader_memory_coherent_atomic_loads (same executable) pass on main and fail with this PR:

    new requests did not use serialization version 57
    

    The cause is the one oneandonlydean gave: RequestSerializer now writes version 58, but tests/ShaderMemory.cpp:8807 still compares the first 8 bytes with the version 57 prefix. The version byte is byte 4 (35 53 50 41 39 00 00 00), so for 58 the check becomes:

    require(requestPrefix(encoded, 8u) == "NVNQQToAAAA=", "new requests did not use serialization version 58");

    I computed that string from the existing one (byte 4 from 0x39 to 0x3a). I did not rebuild with it.

  • Every other test has the same result on both sides. The layer loads in both logs and neither reports it missing.

Single run each. AI-assisted (Claude Code).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 16, 2026
…-step-rate

# Conflicts:
#	core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp
#	core/shader/recompiler/tests/RequestSerializerTests.cpp
…ry tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 16, 2026
@puridanish284

Copy link
Copy Markdown
Contributor Author

@oneandonlydean thanks, fixed in 0c982d8. I merged main (e7b5fdd), which is now at serialization version 62 and refuses 58 to 61, so this PR takes 63 and still reads 62 and 57 requests with a rate of 1. ShaderMemory.cpp now expects the version 63 prefix, probes 64 as unsupported, and its version 56 fixture also strips the 4-byte rate of a vertex request. agc_shader_memory and agc_shader_memory_coherent_atomic_loads pass, and the focused set (now including both) is 35/35 with the same VUIDs as main; the table in the description is updated.


Generated by Claude Code

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the implementation and the included tests support merging on the inspected paths.

What I ran

Reviewed head 0c982d8a274d3cf00d9106f131df8d1c09d40dd9 using the prepared diff and pinned reader. No build or tests were run; test results below are author-reported.

Results

Check Result Note
Diff and touched implementation passed Reviewed core behavior and serialization paths
Tests not run Author reports 35/35 focused tests passed

Findings

Blocking

None.

Non-blocking

None.

Not verified

The full text of core/libs/prx/libSceAgcDriver/tests/Graphics.cpp and core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was excluded as too large; only their changed hunks were reviewed. No local test or build run was performed, and no title or physical console behavior was verified. Other included changed files were read from the prepared diff or targeted reader ranges; not every full file was read.

To get this to a good state

Nothing is required.

# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp
@domx4q

domx4q commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Ran the Tested section's focused set with the Khronos validation layer on NVIDIA's proprietary driver, since the PR was tested on lavapipe with a layer older than VK_HEADER_VERSION 335 only.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head a525340b4d merged onto main 89b0eef7ab with --no-ff, clean merge. Main baseline is a Release build of 89b0eef7ab on the same machine.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^(request_serializer|agc_shader_memory.*|agc_gcn_.*|agc_driver_gcn_.*|agc_driver_graphics|agc_driver_draw_cache.*)$' -V
main 89b0eef7ab this PR
Result 36 passed (36) 37 passed (37)
Insert instance layer "VK_LAYER_KHRONOS_validation" 48 49
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

New on the PR side and absent on main: agc_driver_gcn_instance_step_rate; it passes. agc_driver_gcn_compare_exec_writes, which skips on lavapipe, runs and passes on both sides here. Every device selection picked the RTX 4090. Neither the lavapipe VUID-vkCmdDraw-None-07629 nor the old layer's VUID-VkDeviceCreateInfo-pNext-pNext appears here.

No new VUID- errors; all focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 20, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

The inspected code implements the described instance step rate handling; the author-reported tests were not run during this review.

What I ran

Reviewed head a525340b4dec598e4f7a78c6c8dafb360ba585dd using the prepared diff and repo_read.py to inspect changed hunks and relevant code. No tests or build commands were run.

Results

Check Result Note
Changed-code review passed Inspected relevant hunks and context
Tests and build not run Results in the PR description are author-reported

Findings

Blocking

None identified in the code inspected.

Non-blocking

The change has no console validation yet, as noted in the PR description and debt entry. The behavior should be confirmed on console hardware when available.

Not verified

I did not run the reported test suite or build, and did not verify behavior on console hardware. The prepared folder omitted the full text of Graphics.cpp and ShaderMemory.cpp; I read the changed regions for both through repo_read.py. I inspected changed hunks and relevant context rather than every line of every changed file.

To get this to a good state

Nothing is required. Keep the console validation limitation documented until that behavior is confirmed.

Main now writes recompile request serialization version 63 for the
emulated barycentrics flag, so the instance step rate moves to version
64. It is written before that flag, and version 63 requests read a rate
of 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 21, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

Nothing in the inspected changes shows a verified blocking defect; the author’s reported test results were not run in this review.

What I ran

Reviewed head 5e025f010d3d7f5bd4b3e2ca0d616e141b6ac25d using repo_read.py to inspect the prepared diff and targeted source context. No tests or builds were run.

Results

Check Result Note
Diff and source review passed Reviewed behavior, cache keys, and serialization
Tests and build not run Results in the description are author reported

Findings

Blocking

None.

Non-blocking

None.

Not verified

No build or test commands were run. Console behavior is unverified, as the description states. Reviewed changed files: Draw.cpp, DrawLookup.cpp, DrawRegisterKey.cpp, ShaderRegistry.cpp, State.hpp, PipelineJournal.cpp, State.cpp, Graphics.cpp (changed region), ShaderMemory.cpp (changed regions), GcnInstanceStepRate.cpp, CacheKey.hpp, RequestSerializer.cpp, ShaderStageInputInfo.hpp, Recompiler.hpp, InstructionTranslator.cpp, ShaderInputInfoBuilder.cpp, RequestSerializerTests.cpp (changed regions), and libSceAgcDriver.md. No changed files were excluded from review; full-file text for Graphics.cpp and ShaderMemory.cpp was not included, so only their changed regions were read.

To get this to a good state

Nothing is required.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the implementation and inspected tests support the stated instance-rate behavior, though the two oversized changed test files were inspected only at relevant ranges.

What I ran

  • Reviewed head 90cf083c26fa3b65e5e9c3b2d3e4a742e08b5187 through repo_read.py.
  • Read the prepared description, commits, manifest, diff, and all 16 changed files listed below; the full text for two oversized files was not included, so I read only the changed test ranges needed.
  • No build or test commands were run. The runtime and test results in the PR description are author-reported.

Results

Check Result Note
Diff and changed code review passed Reviewed all changed files
Build and tests not run PR description reports focused tests
Console behavior not run No title report or hardware run supplied

Findings

Blocking

None.

Non-blocking

None.

Not verified

  • The full contents of core/libs/prx/libSceAgcDriver/tests/Graphics.cpp and core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp were not read; targeted changed regions were reviewed.
  • Build and tests were not run in this review. The PR description reports its own test results on WSL2 Ubuntu 24.04 with gcc 13.3 and lavapipe.
  • PS4 console behavior remains unverified, as documented in the change.
  • Excluded by review-folder rule: none, lockfiles, minified files, build or dist outputs, or SVGs. All changed files are listed as reviewed in the manifest; two had full text omitted for size.

To get this to a good state

Nothing is required.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants