Repository navigation
feat(agc): divide the PS4 vertex instance index by VGT_INSTANCE_STEP_RATE_0 - #20153
puridanish284 wants to merge 6 commits into
Conversation
…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>
|
@puridanish284 the Windows job fails on bfc4a26: 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 |
|
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.
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.
|
|
Cross-HW verified on real AMD RADV across three generations (Mesa 26.2.6, validation layer 1.4.363), head
The new test confirms 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 confirming it detects the divide. (The decode refusal this PR removes is AI-assisted: yes |
|
Corroborating @oneandonlydean — this isn't Windows-specific. On Linux (RADV VEGA10) at So it's the cross-platform serializer-version mismatch (PR bumps To scope my earlier cross-HW note: it covered AI-assisted: yes |
|
Test report, NVIDIA on Windows: confirms the
Single run each. AI-assisted (Claude Code). |
…-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>
|
@oneandonlydean thanks, fixed in 0c982d8. I merged Generated by Claude Code |
MarcZX10
left a comment
There was a problem hiding this comment.
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
|
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 Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
New on the PR side and absent on main: No new AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
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>
MarcZX10
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
90cf083c26fa3b65e5e9c3b2d3e4a742e08b5187throughrepo_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.cppandcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwere 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.
What
PS4 (GCN) vertex programs with a
VGT_INSTANCE_STEP_RATE_0other than 1 were refused withGCN vertex instance step rates other than 1 are not implemented. A plain vertex program whoseSPI_SHADER_PGM_RSRC1_VS.VGPR_COMP_CNTloads 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'sEmitPrologue(a26cac679b3f) uses for v1 and v3.DecodeShaderStagesreads the rate intoShaderStages::instanceStepRate(1 when the register is unset), andApplyInstanceStepRatecopies it intoShaderVertexStageInfoat the four places that already apply the point size.CacheKey.hpp), the draw cache (DrawLookup,sameVertexInfo) and the serialized request. The request serialization version goes to 64 (mainwrites 63 and refuses 58 to 61). The rate is written beforemain's version 63 emulated barycentrics flag, and version 63, 62 and 57 requests still read with a rate of 1.UDiv32(instance, rate)when the rate is not 1.VGT_INSTANCE_STEP_RATE_1other than 1 when v2 is loaded (shadPS4 divides by it, but what a plain VS receives in v2 is not confirmed). Both are recorded indocs/dev/debt/libSceAgcDriver.md.legacyVertex, because these fields reach pipelines through the shader requests. Only theShaderStagessize assert moves from 164 to 168, andsizeof(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.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_memoryandagc_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.main26194f0:request_serializer,agc_shader_memory*,agc_gcn_*,agc_driver_gcn_*,agc_driver_graphics,agc_driver_draw_cache*, withVK_LOADER_DEBUG=layer(every test's log showsInsert instance layer "VK_LAYER_KHRONOS_validation").VUID-vkCmdDraw-None-07629VUID-VkDeviceCreateInfo-pNext-pNextwas not found but was requested by env var VK_INSTANCE_LAYERSagc_driver_gcn_compare_exec_writesskips on lavapipe on both. ThepNextVUID 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.07629comes 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_overlapfailed closed: 97 of the 105 branches it flags conflict withmainthemselves. The 8 it could compare (#11551, #14561, #15343, #19373, #19821, #20010, #20030, #20111) share only the serialization version number or theShaderStagessize assert, which whichever merges second re-bumps. None of them handles instance step rates.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)🤖 Generated with Claude Code