fix(shader): address buffers with ADD_TID in graphics stages #24781

Open
Jirka135 wants to merge 9 commits from upstream-pr/24781 into main
Jirka135 commented 2026-11-21 02:32:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jirka135 on 2026-11-21T02:32:48Z.


What

A V# with ADD_TID_ENABLE in a vertex, local, pixel, mesh or domain program threw at materialization (buffer ADD_TID is only valid for compute shaders) and, read from GPU memory, faulted as an invalid descriptor. The Witcher 3 stops on it in a vertex shader (#20342, shader 0x208017400 stage 1).

This applies the rule #21970 measured on RDNA2 (gfx1036, hardware oracle) for compute to every stage but hull: without IDXEN the index is the lane, with IDXEN ADD_TID is ignored, and the swizzle applies with IDXEN or with ADD_TID. The lane is the one the recompiler already gives v_mbcnt (LaneId) in that stage, the subgroup invocation id. The ADD_TID lane is requested only for non-IDXEN buffer accesses (the only case where the lane reaches the address), so a graphics program whose buffer accesses all use IDXEN no longer declares SubgroupLocalInvocationId. A pixel program with a non-IDXEN buffer access needs fragment-stage basic subgroups and has no fallback; vertex, local and non-mesh domain programs fall back to one lane on hosts without subgroups in that stage (recorded in docs/dev/debt/changes/fix-shader-add-tid-graphics.md). Compute programs behave as before. Hull programs keep throwing (their lane is InvocationId). The behaviour outside compute is not measured on gfx1036 or gfx1013 and is recorded in docs/dev/debt/shader.md.

Built on #21970's addressing code (merged into this branch).

New execution test agc_driver_vertex_buffer_add_tid: a guest vertex shader (96 vertices, wave32 and wave64, swizzled and linear V#s, OFFEN and immediate offsets, stride 16/32, INDEX_STRIDE 0-3) loads and stores through ADD_TID V#s and writes its v_mbcnt lane; the test checks each access against the measured address of that lane and that no other bytes change. The aliasedBufferViewTests stores are non-IDXEN, so the graphics fixture now lists fragment-stage basic subgroups.

Tested

Rebased onto main 8ab98849d5 (head 809d521e5b; only conflict was the shader disk cache version, kept at 97 above main's 96). Windows 11 Enterprise 10.0.26300, WinLibs GCC 15.2.0 UCRT, Ninja, Release, Khronos validation layer 1.4.369, same machine for both sides, on the NVIDIA GeForce RTX 5090 (driver 617.42) and the AMD Radeon iGPU (ANYPS5_GPU=AMD, 1002:13c0), 3 fresh ctest runs with the layer and 1 without, per GPU:
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 '^agc_driver_(vertex_buffer_add_tid|buffer_swizzled_address|runtime_buffer_spans.*|buffer_load_store|buffer_format|buffer_descriptor_runtime|draw_unsupported_buffer_type.*|vertex_elected_atomic_max|vertex_fetch.*|draw_recipe_buffers|buffer_unaligned_base|scalar_buffer_runtime_word3|pixel_lds_lane_slots|many_buffers|null_buffer_substitutes)$|^(spanned_uniformity|ir_opcode_traits|shader_memory_decoder_tolerance)$' -V

side GPU result layer inserted was not found VUID-
main RTX 5090 29/29 in 3/3 runs, and without the layer 32 0 0
main AMD iGPU 29/29 in 3/3 runs, and without the layer 32 0 0
this PR RTX 5090 31/31 in 3/3 runs, and without the layer 34 0 0
this PR AMD iGPU 31/31 in 3/3 runs, and without the layer 34 0 0

The four rows above were at 809d521e5b and did not include agc_driver_graphics. Fix 3f0983f9cd on top of it, merged into 17220db6a3, AMD Radeon 8060S (gfx1151), driver 25.20.32.06, Windows 11, Khronos validation 1.4.363: agc_driver_graphics passes on main, fails on 809d521e5b (subgroup capability 61 is unsupported for shader stage 16) and passes on the fix; whole agc_driver set (ctest -R agc_driver): main 1502 passed, 28 skipped, 4 failed; fix 1505 passed, 28 skipped, 3 failed (linear_target_import_creation, store_over_untracked, frame_replay_relaunch fail on both; native_multisample_depth crashed on main only); no VUID.

vertex_buffer_add_tid and buffer_swizzled_address do not exist on main; before the rebase, main with only the new test added failed vertex_buffer_add_tid 3/3 (buffer ADD_TID is only valid for compute shaders). vertex_elected_atomic_max skips on both GPUs and both sides (the device runs vertex programs in subgroups). No new VUID- errors. check_conventions.py --base upstream/main passes; debt_fold.py --check reports only the feat-libwebrtc-rnn-vad.md error that main also has. pr_overlap.py --branch reports no conflicting files; among the open PRs it could not compare (they conflict with main) is #7689, which rewrites the same throw line in ResourceMaterializer.cpp (a one-line textual conflict). Not tested: the title itself, lavapipe.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: #21970
  • Fixes: none
  • Unblocks: PPSA03977 #20342
  • GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11; AMD Radeon(TM) Graphics iGPU (gfx1036, 1002:13c0), driver 32.0.21045.29003, Windows 11; AMD Radeon 8060S (gfx1151), driver 25.20.32.06, Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5423418388 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781). Originally posted by [Jirka135](https://github.com/Jirka135) on 2026-11-21T02:32:48Z. --- ### What A V# with ADD_TID_ENABLE in a vertex, local, pixel, mesh or domain program threw at materialization (`buffer ADD_TID is only valid for compute shaders`) and, read from GPU memory, faulted as an invalid descriptor. The Witcher 3 stops on it in a vertex shader (#20342, `shader 0x208017400 stage 1`). This applies the rule #21970 measured on RDNA2 (gfx1036, hardware oracle) for compute to every stage but hull: without IDXEN the index is the lane, with IDXEN ADD_TID is ignored, and the swizzle applies with IDXEN or with ADD_TID. The lane is the one the recompiler already gives `v_mbcnt` (LaneId) in that stage, the subgroup invocation id. The ADD_TID lane is requested only for non-IDXEN buffer accesses (the only case where the lane reaches the address), so a graphics program whose buffer accesses all use IDXEN no longer declares `SubgroupLocalInvocationId`. A pixel program with a non-IDXEN buffer access needs fragment-stage basic subgroups and has no fallback; vertex, local and non-mesh domain programs fall back to one lane on hosts without subgroups in that stage (recorded in `docs/dev/debt/changes/fix-shader-add-tid-graphics.md`). Compute programs behave as before. Hull programs keep throwing (their lane is `InvocationId`). The behaviour outside compute is not measured on gfx1036 or gfx1013 and is recorded in `docs/dev/debt/shader.md`. Built on #21970's addressing code (merged into this branch). New execution test `agc_driver_vertex_buffer_add_tid`: a guest vertex shader (96 vertices, wave32 and wave64, swizzled and linear V#s, OFFEN and immediate offsets, stride 16/32, INDEX_STRIDE 0-3) loads and stores through ADD_TID V#s and writes its `v_mbcnt` lane; the test checks each access against the measured address of that lane and that no other bytes change. The `aliasedBufferViewTests` stores are non-IDXEN, so the graphics fixture now lists fragment-stage basic subgroups. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Rebased onto `main` `8ab98849d5` (head `809d521e5b`; only conflict was the shader disk cache version, kept at 97 above main's 96). Windows 11 Enterprise 10.0.26300, WinLibs GCC 15.2.0 UCRT, Ninja, Release, Khronos validation layer 1.4.369, same machine for both sides, on the NVIDIA GeForce RTX 5090 (driver 617.42) and the AMD Radeon iGPU (`ANYPS5_GPU=AMD`, `1002:13c0`), 3 fresh ctest runs with the layer and 1 without, per GPU: `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 '^agc_driver_(vertex_buffer_add_tid|buffer_swizzled_address|runtime_buffer_spans.*|buffer_load_store|buffer_format|buffer_descriptor_runtime|draw_unsupported_buffer_type.*|vertex_elected_atomic_max|vertex_fetch.*|draw_recipe_buffers|buffer_unaligned_base|scalar_buffer_runtime_word3|pixel_lds_lane_slots|many_buffers|null_buffer_substitutes)$|^(spanned_uniformity|ir_opcode_traits|shader_memory_decoder_tolerance)$' -V` | side | GPU | result | layer inserted | `was not found` | `VUID-` | |---|---|---|---|---|---| | main | RTX 5090 | 29/29 in 3/3 runs, and without the layer | 32 | 0 | 0 | | main | AMD iGPU | 29/29 in 3/3 runs, and without the layer | 32 | 0 | 0 | | this PR | RTX 5090 | 31/31 in 3/3 runs, and without the layer | 34 | 0 | 0 | | this PR | AMD iGPU | 31/31 in 3/3 runs, and without the layer | 34 | 0 | 0 | The four rows above were at `809d521e5b` and did not include `agc_driver_graphics`. Fix `3f0983f9cd` on top of it, merged into `17220db6a3`, AMD Radeon 8060S (gfx1151), driver 25.20.32.06, Windows 11, Khronos validation 1.4.363: `agc_driver_graphics` passes on main, fails on `809d521e5b` (`subgroup capability 61 is unsupported for shader stage 16`) and passes on the fix; whole `agc_driver` set (`ctest -R agc_driver`): main 1502 passed, 28 skipped, 4 failed; fix 1505 passed, 28 skipped, 3 failed (`linear_target_import_creation`, `store_over_untracked`, `frame_replay_relaunch` fail on both; `native_multisample_depth` crashed on main only); no VUID. `vertex_buffer_add_tid` and `buffer_swizzled_address` do not exist on main; before the rebase, `main` with only the new test added failed `vertex_buffer_add_tid` 3/3 (`buffer ADD_TID is only valid for compute shaders`). `vertex_elected_atomic_max` skips on both GPUs and both sides (the device runs vertex programs in subgroups). No new `VUID-` errors. `check_conventions.py --base upstream/main` passes; `debt_fold.py --check` reports only the `feat-libwebrtc-rnn-vad.md` error that main also has. `pr_overlap.py --branch` reports no conflicting files; among the open PRs it could not compare (they conflict with main) is #7689, which rewrites the same throw line in `ResourceMaterializer.cpp` (a one-line textual conflict). Not tested: the title itself, lavapipe. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #21970 - [x] Fixes: none - [x] Unblocks: PPSA03977 #20342 - [x] GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11; AMD Radeon(TM) Graphics iGPU (gfx1036, `1002:13c0`), driver 32.0.21045.29003, Windows 11; AMD Radeon 8060S (gfx1151), driver 25.20.32.06, Windows 11 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-21 02:49:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T02:49:41Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the remaining concerns are optional follow-up work.

What I ran

Reviewed head c9c66ae38172f2f561984c8dc49d72170de2effd using the prepared diff and pinned repository reader. No build or tests were run in this review.

Results

Check Result Note
Changed code review passed All nine changed files read
Build and tests not run Author-reported results were not rerun
Excluded files not applicable None listed in the manifest

Findings

Blocking

None.

Non-blocking

  • core/shader/recompiler/SpirvRuntimeBuffer.cpp:183 enables subgroup-local invocation ID requirements for every non-hull stage with buffer accesses. The PR documents that graphics-stage ADD_TID behavior has not been measured on the hardware oracle. Consider adding oracle measurements for the other affected graphics stages and GPUs before treating this behavior as established.

Not verified

The build, tests, convention checks, debt check, and behavior on physical consoles or other GPUs were not run or independently confirmed. The author reports Windows 11 / RTX 5090 test results in the PR description. All nine changed files listed as reviewed in the manifest were read; no changed files were excluded.

To get this to a good state

Nothing is required. Optional: measure ADD_TID behavior in the affected graphics stages with the hardware oracle.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6002371001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6002371001). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T02:49:41Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the remaining concerns are optional follow-up work. ## What I ran Reviewed head `c9c66ae38172f2f561984c8dc49d72170de2effd` using the prepared diff and pinned repository reader. No build or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All nine changed files read | | Build and tests | not run | Author-reported results were not rerun | | Excluded files | not applicable | None listed in the manifest | ## Findings ### Blocking None. ### Non-blocking - `core/shader/recompiler/SpirvRuntimeBuffer.cpp:183` enables subgroup-local invocation ID requirements for every non-hull stage with buffer accesses. The PR documents that graphics-stage ADD_TID behavior has not been measured on the hardware oracle. Consider adding oracle measurements for the other affected graphics stages and GPUs before treating this behavior as established. ## Not verified The build, tests, convention checks, debt check, and behavior on physical consoles or other GPUs were not run or independently confirmed. The author reports Windows 11 / RTX 5090 test results in the PR description. All nine changed files listed as reviewed in the manifest were read; no changed files were excluded. ## To get this to a good state Nothing is required. Optional: measure ADD_TID behavior in the affected graphics stages with the hardware oracle.
MarcZX10 commented 2026-11-21 08:57:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T08:57:26Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks merging; the behavior is supported by the inspected code and the author-reported execution results, with graphics-stage ADD_TID hardware behavior explicitly recorded as unmeasured.

What I ran

  • Reviewed head ec03bc54fd96d9376a102b3814a534e3cbda156d; no commands or tests were run by me.
  • Read description.md, commits.md, manifest.json, and diff.patch. Read all changed files marked included in the manifest: BufferSwizzledAddress.cpp, RuntimeBufferSpans.cpp, VertexBufferAddTid.cpp, ResourceMaterializer.cpp, ShaderDiskCache.hpp, SpirvAnalysis.cpp, SpirvRuntimeBuffer.cpp, and both changed debt files.

Results

Check Result Note
Diff and targeted code review passed Addressing and stage handling are consistent
Reported execution checks passed Author reports 28/28 checks across three runs
Independent test run not run No local execution performed

Findings

Blocking

None.

Non-blocking

None.

Not verified

  • I did not run the reported Windows/Vulkan checks or independently confirm the test output.
  • The author records graphics-stage ADD_TID behavior as unmeasured on RDNA2 and PS5 hardware. The added execution test checks the recompiler on the reported RTX 5090 host.
  • files.json was not available through the review reader, so excluded-file reasons could not be checked. The manifest lists all eight changed files as included; each was read.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004273781 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6004273781). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T08:57:26Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks merging; the behavior is supported by the inspected code and the author-reported execution results, with graphics-stage ADD_TID hardware behavior explicitly recorded as unmeasured. ## What I ran - Reviewed head `ec03bc54fd96d9376a102b3814a534e3cbda156d`; no commands or tests were run by me. - Read `description.md`, `commits.md`, `manifest.json`, and `diff.patch`. Read all changed files marked included in the manifest: `BufferSwizzledAddress.cpp`, `RuntimeBufferSpans.cpp`, `VertexBufferAddTid.cpp`, `ResourceMaterializer.cpp`, `ShaderDiskCache.hpp`, `SpirvAnalysis.cpp`, `SpirvRuntimeBuffer.cpp`, and both changed debt files. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted code review | passed | Addressing and stage handling are consistent | | Reported execution checks | passed | Author reports 28/28 checks across three runs | | Independent test run | not run | No local execution performed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified - I did not run the reported Windows/Vulkan checks or independently confirm the test output. - The author records graphics-stage ADD_TID behavior as unmeasured on RDNA2 and PS5 hardware. The added execution test checks the recompiler on the reported RTX 5090 host. - `files.json` was not available through the review reader, so excluded-file reasons could not be checked. The manifest lists all eight changed files as included; each was read. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-21 13:35:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T13:35:16Z.

Review: COMMENTED


Reviewed — comments

The shared runtime-buffer changes have a plausible vector-addressing defect; graphics-stage ADD_TID behavior is also unmeasured on hardware, so approval is not justified from the available evidence.

What I ran

Reviewed head 809d521e5b4264840be92bfdd9c76188187e9e49. Read the prepared description, commits, manifest, diff, and all nine changed files listed in the manifest. Read targeted runtime-buffer callers and subgroup lane helpers through repo_read.py. No tests were run; the reported Windows/GPU runs are author-supplied.

Results

Check Result Note
Changed-file review passed All nine manifest files read
Tests in this session not run Author reports GPU execution runs
Graphics ADD_TID hardware rule not run Author records it as unmeasured

Findings

Blocking

None verified.

Non-blocking

  • SpirvRuntimeBuffer.cpp:236 enables contiguous vector component addressing whenever memory.idxen is set. byteAddress then adds later components as a physical tail after swizzling (:211,217-222). However, the memory.idxen condition does not require a buffer resource; address calculation is also used for formatted and other buffer-like accesses. For a swizzled vector access in a path whose component layout is not physically contiguous, this can bypass the per-component swizzle calculation and produce wrong addresses. Please confirm the intended scope of vector and constrain contiguous addressing to the access types whose hardware layout is contiguous. The new execution coverage checks raw vector buffer loads/stores, but does not cover the formatted paths that call address without the new vector flag.
  • The change applies the compute lane rule to graphics stages, while the description and debt entry state that graphics behavior has not been measured on gfx1036 or gfx1013. The vertex test validates the recompiler against the same lane-based expectation, not a hardware oracle. Please retain that limitation when describing the behavior until a graphics-stage hardware measurement is available. (Changed lines: SpirvRuntimeBuffer.cpp:183-186.)

Not verified

Did not run tests, builds, or GPU/hardware measurements. The prepared files.json exclusion list was unavailable through the reader; the manifest shows all nine changed files as included, and those nine files were read. Did not read unrelated repository files beyond targeted callers and helpers.

To get this to a good state

Nothing is required. Optional: narrow the contiguous-vector condition after confirming the intended access scope, and add coverage for any formatted vector cases it should support. Keep the graphics-stage hardware limitation explicit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6005533584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6005533584). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T13:35:16Z. **Review:** COMMENTED --- # Reviewed — comments The shared runtime-buffer changes have a plausible vector-addressing defect; graphics-stage ADD_TID behavior is also unmeasured on hardware, so approval is not justified from the available evidence. ## What I ran Reviewed head `809d521e5b4264840be92bfdd9c76188187e9e49`. Read the prepared description, commits, manifest, diff, and all nine changed files listed in the manifest. Read targeted runtime-buffer callers and subgroup lane helpers through `repo_read.py`. No tests were run; the reported Windows/GPU runs are author-supplied. ## Results | Check | Result | Note | |---|---|---| | Changed-file review | passed | All nine manifest files read | | Tests in this session | not run | Author reports GPU execution runs | | Graphics ADD_TID hardware rule | not run | Author records it as unmeasured | ## Findings ### Blocking None verified. ### Non-blocking - `SpirvRuntimeBuffer.cpp:236` enables contiguous vector component addressing whenever `memory.idxen` is set. `byteAddress` then adds later components as a physical `tail` after swizzling (`:211,217-222`). However, the `memory.idxen` condition does not require a buffer resource; address calculation is also used for formatted and other buffer-like accesses. For a swizzled vector access in a path whose component layout is not physically contiguous, this can bypass the per-component swizzle calculation and produce wrong addresses. Please confirm the intended scope of `vector` and constrain contiguous addressing to the access types whose hardware layout is contiguous. The new execution coverage checks raw vector buffer loads/stores, but does not cover the formatted paths that call `address` without the new vector flag. - The change applies the compute lane rule to graphics stages, while the description and debt entry state that graphics behavior has not been measured on gfx1036 or gfx1013. The vertex test validates the recompiler against the same lane-based expectation, not a hardware oracle. Please retain that limitation when describing the behavior until a graphics-stage hardware measurement is available. (Changed lines: `SpirvRuntimeBuffer.cpp:183-186`.) ## Not verified Did not run tests, builds, or GPU/hardware measurements. The prepared `files.json` exclusion list was unavailable through the reader; the manifest shows all nine changed files as included, and those nine files were read. Did not read unrelated repository files beyond targeted callers and helpers. ## To get this to a good state Nothing is required. Optional: narrow the contiguous-vector condition after confirming the intended access scope, and add coverage for any formatted vector cases it should support. Keep the graphics-stage hardware limitation explicit.
Superseabas commented 2026-11-23 11:36:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-23T11:36:41Z.

Review: COMMENTED


Windows check of head 809d521e5b with GCC 16 on an NVIDIA and an AMD GPU, merged onto main f5b7e1d1ac (clean merge). The PR's own tests pass, but agc_driver_graphics fails with it, and it passes on main.

Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. GPUs, each picked with ANYPS5_GPU: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (1002:164e, Adrenalin 26.10.2).

  • ^(.*add_tid.*|.*swizzled.*|.*runtime_buffer_spans.*|agc_driver_buffer_descriptor_runtime)$: main 10 of 10, and with this PR 12 of 12 in 2 of 2 runs, on both GPUs (built together with #25557, #26098 and #22251). No VUID- lines.
  • Red check: with materializeTables refusing ADD_TID outside compute again, agc_driver_vertex_buffer_add_tid fails with buffer ADD_TID is only valid for compute shaders.

agc_driver_graphics fails. I first saw it in the combined build, then built main plus this PR alone (af98298694). It fails there too, and passes on main:

AGC graphics: subgroup capability 61 is unsupported for shader stage 16

Capability 61 is GroupNonUniform, and stage 16 is the fragment stage. The cause looks like the SpirvAnalysis.cpp change: subgroupLocalInvocationId is now required by every non-hull stage that reads a runtime buffer, not just compute. So a fragment (or vertex) program with any runtime buffer access declares the subgroup capability, even without ADD_TID. ValidateShaders refuses that capability for a stage the device's subgroup properties don't list, and several Graphics.cpp cases pass properties with only one stage or none. I haven't pinned down which case trips, so treat the cause as my reading, not a trace. If that's it, requiring the lane id only where ADD_TID can be set would avoid it. A real device without fragment-stage subgroup support would get the same refusal.

This is in addition to MarcZX10's open point on contiguous idxen vector addressing, which I haven't checked.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6020989551 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6020989551). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-23T11:36:41Z. **Review:** COMMENTED --- Windows check of head `809d521e5b` with GCC 16 on an NVIDIA and an AMD GPU, merged onto `main` `f5b7e1d1ac` (clean merge). The PR's own tests pass, but `agc_driver_graphics` fails with it, and it passes on `main`. **Setup:** Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), Release full build, run from PowerShell with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. GPUs, each picked with `ANYPS5_GPU`: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (`1002:164e`, Adrenalin 26.10.2). - `^(.*add_tid.*|.*swizzled.*|.*runtime_buffer_spans.*|agc_driver_buffer_descriptor_runtime)$`: `main` 10 of 10, and with this PR 12 of 12 in 2 of 2 runs, on both GPUs (built together with #25557, #26098 and #22251). No `VUID-` lines. - **Red check:** with `materializeTables` refusing ADD_TID outside compute again, `agc_driver_vertex_buffer_add_tid` fails with `buffer ADD_TID is only valid for compute shaders`. **`agc_driver_graphics` fails.** I first saw it in the combined build, then built `main` plus this PR alone (`af98298694`). It fails there too, and passes on `main`: ``` AGC graphics: subgroup capability 61 is unsupported for shader stage 16 ``` Capability 61 is `GroupNonUniform`, and stage 16 is the fragment stage. The cause looks like the `SpirvAnalysis.cpp` change: `subgroupLocalInvocationId` is now required by every non-hull stage that reads a runtime buffer, not just compute. So a fragment (or vertex) program with any runtime buffer access declares the subgroup capability, even without ADD_TID. `ValidateShaders` refuses that capability for a stage the device's subgroup properties don't list, and several `Graphics.cpp` cases pass properties with only one stage or none. I haven't pinned down which case trips, so treat the cause as my reading, not a trace. If that's it, requiring the lane id only where ADD_TID can be set would avoid it. A real device without fragment-stage subgroup support would get the same refusal. This is in addition to MarcZX10's open point on contiguous `idxen` vector addressing, which I haven't checked. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-25 00:18:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T00:18:25Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the optional points below are for follow-up validation.

What I ran

Reviewed head 3f0983f9cd46d84632eff85acca283d6bad57cfa using the prepared diff and pinned source reader. No tests were run; the test results in the description are author-reported.

Results

Check Result Note
Changed-line review passed All changed lines were inspected
Tests not run Author-reported runs were not repeated
Subgroup validation passed Pixel-stage requirement is consistent with the new analysis rule

Findings

Blocking

None.

Non-blocking

  • Graphics-stage ADD_TID semantics outside compute are explicitly unmeasured on the target hardware. The vertex test provides useful coverage, but pixel, local, mesh, and domain stages remain an evidence gap. Keep the debt note until hardware measurements confirm the rule (ResourceMaterializer.cpp:1843).

Not verified

No tests, build, or hardware runs were performed. The full Graphics.cpp text was excluded from the prepared bundle; its changed lines were read through the pinned source reader. All nine changed files listed as reviewed in the manifest were inspected, including the changed lines of Graphics.cpp.

To get this to a good state

Nothing is required. Optional: measure ADD_TID behavior on RDNA2 or PS5 for the graphics stages recorded in the debt note.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6049582972 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6049582972). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T00:18:25Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the optional points below are for follow-up validation. ## What I ran Reviewed head `3f0983f9cd46d84632eff85acca283d6bad57cfa` using the prepared diff and pinned source reader. No tests were run; the test results in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed-line review | passed | All changed lines were inspected | | Tests | not run | Author-reported runs were not repeated | | Subgroup validation | passed | Pixel-stage requirement is consistent with the new analysis rule | ## Findings ### Blocking None. ### Non-blocking - Graphics-stage ADD_TID semantics outside compute are explicitly unmeasured on the target hardware. The vertex test provides useful coverage, but pixel, local, mesh, and domain stages remain an evidence gap. Keep the debt note until hardware measurements confirm the rule (`ResourceMaterializer.cpp:1843`). ## Not verified No tests, build, or hardware runs were performed. The full `Graphics.cpp` text was excluded from the prepared bundle; its changed lines were read through the pinned source reader. All nine changed files listed as reviewed in the manifest were inspected, including the changed lines of `Graphics.cpp`. ## To get this to a good state Nothing is required. Optional: measure ADD_TID behavior on RDNA2 or PS5 for the graphics stages recorded in the debt note.
Superseabas commented 2026-11-25 12:35:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-25T12:35:28Z.

Review: APPROVED


Re-check on Windows of head 3f0983f9cd, after my comment about agc_driver_graphics.

Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. GPUs, each picked with ANYPS5_GPU: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (1002:164e, Adrenalin 26.10.2). Merged onto main c3aae2e8fb (clean merge), built together with #21948 and #24906, which touch other files.

  • ^(.*add_tid.*|.*swizzled.*|.*runtime_buffer_spans.*|agc_driver_buffer_descriptor_runtime|agc_driver_graphics)$: main 11 of 11, and with this PR 13 of 13 in 2 of 2 runs, on both GPUs, including agc_driver_graphics, which failed on 809d521e5b. No VUID- lines.
  • Red check, not caught: with SpirvAnalysis back to 809d521e5b's rule (every non-hull stage with a runtime buffer asks for the lane), all 13 still pass. That's expected after the fixture change: aliasedBufferViewTests now gives the device fragment subgroups, so the case passes under either rule. Nothing pins the narrowing itself. A non-blocking suggestion: one case with an IDXEN-only pixel program and no fragment-stage subgroups would fail on the old rule and pass on this one.

The change: SpirvAnalysis now asks for the subgroup lane id outside compute only for a non-IDXEN Buffer access in a non-hull stage, and SpirvRuntimeBuffer emits the lane only inside the !memory.idxen branch, so the two agree. The other site that sets it, LaneId (SpirvAnalysis.cpp:557), is unchanged from main. The fixture change in aliasedBufferViewTests gives the device fragment-stage basic subgroups, which a pixel shader with a non-IDXEN access does need. The debt entry now says so, with no fallback for pixel programs.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6057689243 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6057689243). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-25T12:35:28Z. **Review:** APPROVED --- Re-check on Windows of head `3f0983f9cd`, after my comment about `agc_driver_graphics`. **Setup:** Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), Release full build, run from PowerShell with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. GPUs, each picked with `ANYPS5_GPU`: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (`1002:164e`, Adrenalin 26.10.2). Merged onto `main` `c3aae2e8fb` (clean merge), built together with #21948 and #24906, which touch other files. - `^(.*add_tid.*|.*swizzled.*|.*runtime_buffer_spans.*|agc_driver_buffer_descriptor_runtime|agc_driver_graphics)$`: `main` 11 of 11, and with this PR 13 of 13 in 2 of 2 runs, on both GPUs, including `agc_driver_graphics`, which failed on `809d521e5b`. No `VUID-` lines. - **Red check, not caught:** with `SpirvAnalysis` back to `809d521e5b`'s rule (every non-hull stage with a runtime buffer asks for the lane), all 13 still pass. That's expected after the fixture change: `aliasedBufferViewTests` now gives the device fragment subgroups, so the case passes under either rule. Nothing pins the narrowing itself. A non-blocking suggestion: one case with an IDXEN-only pixel program and no fragment-stage subgroups would fail on the old rule and pass on this one. **The change:** `SpirvAnalysis` now asks for the subgroup lane id outside compute only for a non-IDXEN `Buffer` access in a non-hull stage, and `SpirvRuntimeBuffer` emits the lane only inside the `!memory.idxen` branch, so the two agree. The other site that sets it, `LaneId` (`SpirvAnalysis.cpp:557`), is unchanged from `main`. The fixture change in `aliasedBufferViewTests` gives the device fragment-stage basic subgroups, which a pixel shader with a non-IDXEN access does need. The debt entry now says so, with no fallback for pixel programs. AI-assisted: yes (Claude Code)
Jazeupoi commented 2026-11-28 22:21:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-28T22:21:55Z.

Review: COMMENTED


Tested 3f0983f9cd merged into main 4814cae855 on Windows 11 with an RTX 2060, Vulkan validation on.

Content: PSFlyCast (PPSA99247, the Dreamcast emulator homebrew) running Artemio Urbina's 240p Test Suite 1.25 for Dreamcast (free download from the project's SourceForge page), so anyone can reproduce it.

Build Result
main Closes about 45 s in, as the suite starts: shader 0x200346000 stage 5: buffer ADD_TID is only valid for compute shaders
main + this PR No throw and 0 validation errors, but the suite's menu is drawn as scattered pixels and blocks that change every frame, at ~8 FPS (the emulator's own UI runs at 55–60)

The log prints Wave32 programs run on subgroups of 32: compute 1, mesh 1, pixel 0 on this GPU, so this may be the non-compute lane case the description lists as not measured. Since main never gets this far, I can't tell whether the noise comes from the ADD_TID lane or from something later in this path. Happy to rerun with any trace you want.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6100330444 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6100330444). Originally posted by [Jazeupoi](https://github.com/Jazeupoi) on 2026-11-28T22:21:55Z. **Review:** COMMENTED --- Tested `3f0983f9cd` merged into main `4814cae855` on Windows 11 with an RTX 2060, Vulkan validation on. Content: PSFlyCast (PPSA99247, the Dreamcast emulator homebrew) running Artemio Urbina's 240p Test Suite 1.25 for Dreamcast (free download from the project's SourceForge page), so anyone can reproduce it. | Build | Result | |---|---| | main | Closes about 45 s in, as the suite starts: `shader 0x200346000 stage 5: buffer ADD_TID is only valid for compute shaders` | | main + this PR | No throw and 0 validation errors, but the suite's menu is drawn as scattered pixels and blocks that change every frame, at ~8 FPS (the emulator's own UI runs at 55–60) | The log prints `Wave32 programs run on subgroups of 32: compute 1, mesh 1, pixel 0` on this GPU, so this may be the non-compute lane case the description lists as not measured. Since main never gets this far, I can't tell whether the noise comes from the ADD_TID lane or from something later in this path. Happy to rerun with any trace you want. AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 21:43:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:43:07Z.

Review: COMMENTED


The current head conflicts with main f3c2cd73ab in ShaderDiskCache.hpp. Please resolve the schema version against current main before running the paired tests. The reported older rebase used version 97, while the conflict is still present on this head. In the merged run, preserve the non-IDXEN lane path, the IDXEN negative control, and both direct and runtime descriptor cases from the new fixture coverage.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179121628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24781#pullrequestreview-6179121628). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T21:43:07Z. **Review:** COMMENTED --- The current head conflicts with `main` `f3c2cd73ab` in `ShaderDiskCache.hpp`. Please resolve the schema version against current `main` before running the paired tests. The reported older rebase used version 97, while the conflict is still present on this head. In the merged run, preserve the non-IDXEN lane path, the IDXEN negative control, and both direct and runtime descriptor cases from the new fixture coverage. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/24781:upstream-pr/24781'
git switch 'upstream-pr/24781'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/24781'
git switch 'upstream-pr/24781'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/24781'
git switch 'upstream-pr/24781'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/24781'
git switch 'main'
git merge --squash 'upstream-pr/24781'
git switch 'main'
git merge --ff-only 'upstream-pr/24781'
git switch 'main'
git merge 'upstream-pr/24781'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!24781
No description provided.