fix(shader): keep an unbounded pixel LDS array in a storage buffer #7888

Merged
mazen320 merged 15 commits from upstream-pr/7888 into main 2026-10-23 18:12:31 +00:00
mazen320 commented 2026-10-19 12:27:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-19T12:27:58Z.


What

A pixel shader whose local data share address has no compile-time bound keeps the full 8192-dword array. On NVIDIA proprietary drivers that array, stored as a SPIR-V Function variable, does not finish past about 4 GiB of private memory over every resident invocation (RTX 5090 on 617.42: 4096 dwords completes, 6144 times out; 4090 measured similarly). The array is not shrunk. Above min(4096, 4 GiB / (SMs × warps/SM × subgroup × 4)) it moves to a storage buffer, one 8192-dword region per invocation, and an address at or past 8192 still reads 0 and does not store. Other drivers keep Function; largePixelFunctionLdsBuffer is set only for VK_DRIVER_ID_NVIDIA_PROPRIETARY.

Each subgroup takes one slot from a pool sized to min(2 GiB, maxStorageBufferRange), retained until device teardown. A draw that needs more slots than the pool has sets a sticky overflow flag, and WaitIdle throws instead of wrapping, dropping the write, or recycling slots (a full-screen 1920×1080 wave32 draw needs far more than 2047 slots and therefore throws by design). The header is mapped host-visible/coherent so CheckPixelFunctionLds can read that flag without a GPU readback; allocation prefers a device-local host-visible type when the driver exposes one so the pool can stay in VRAM on discrete GPUs.

This does not change the wave32 bounded draw in #7708.

Tested

Windows 11, NVIDIA GeForce RTX 5090, driver 617.42, WinLibs GCC 15.2.0, Release. APS5_DUMP_FRAMES unset.

With ANYPS5_NO_SHADER_CACHE=1, and again with the shader cache:

  • agc_driver_pixel_lds_limit_tests: dword 8000 and dword 8191 read back the stored values, dword 8192 reads 0, 2048 pixels, exit 0. The run prints [gpu] pixel function LDS pool: 2047 subgroups, 2047 MiB, stride 32 lanes. Overflow case asserts the WaitIdle throw when the pool is exhausted.
  • agc_driver_pixel_lds: all four stages, pixel LDS tests passed: 12 draws, 24576 pixels, 73728 LDS results, exit 0. No device-lost and no vkQueueSubmit failure.

agc_shader_memory_tests exit 0, including the check that an address with no bound stays 8192 dwords.

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: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4920924850 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-19T12:27:58Z. --- ### What A pixel shader whose local data share address has no compile-time bound keeps the full 8192-dword array. On NVIDIA proprietary drivers that array, stored as a SPIR-V `Function` variable, does not finish past about 4 GiB of private memory over every resident invocation (RTX 5090 on 617.42: 4096 dwords completes, 6144 times out; 4090 measured similarly). The array is not shrunk. Above `min(4096, 4 GiB / (SMs × warps/SM × subgroup × 4))` it moves to a storage buffer, one 8192-dword region per invocation, and an address at or past 8192 still reads 0 and does not store. Other drivers keep `Function`; `largePixelFunctionLdsBuffer` is set only for `VK_DRIVER_ID_NVIDIA_PROPRIETARY`. Each subgroup takes one slot from a pool sized to `min(2 GiB, maxStorageBufferRange)`, retained until device teardown. A draw that needs more slots than the pool has sets a sticky overflow flag, and `WaitIdle` throws instead of wrapping, dropping the write, or recycling slots (a full-screen 1920×1080 wave32 draw needs far more than 2047 slots and therefore throws by design). The header is mapped host-visible/coherent so `CheckPixelFunctionLds` can read that flag without a GPU readback; allocation prefers a device-local host-visible type when the driver exposes one so the pool can stay in VRAM on discrete GPUs. This does not change the wave32 bounded draw in #7708. ### Tested Windows 11, NVIDIA GeForce RTX 5090, driver 617.42, WinLibs GCC 15.2.0, Release. `APS5_DUMP_FRAMES` unset. With `ANYPS5_NO_SHADER_CACHE=1`, and again with the shader cache: - `agc_driver_pixel_lds_limit_tests`: dword 8000 and dword 8191 read back the stored values, dword 8192 reads 0, 2048 pixels, exit 0. The run prints `[gpu] pixel function LDS pool: 2047 subgroups, 2047 MiB, stride 32 lanes`. Overflow case asserts the `WaitIdle` throw when the pool is exhausted. - `agc_driver_pixel_lds`: all four stages, `pixel LDS tests passed: 12 draws, 24576 pixels, 73728 LDS results`, exit 0. No device-lost and no `vkQueueSubmit` failure. `agc_shader_memory_tests` exit 0, including the check that an address with no bound stays 8192 dwords. ### 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) - [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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11 - [x] AI-assisted: yes
savvaniss commented 2026-10-19 14:09:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T14:09:01Z.


AMD and Intel Windows data: agc_driver_pixel_lds_limit passes with this PR on an AMD RX 9070 XT and an Intel UHD 770, so the storage-buffer path for the unbounded pixel LDS array runs on both.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head 834d52805 merged into main 85029a00f.

Tests, ×3 UHD 770 RX 9070 XT
This head: agc_driver_pixel_lds_limit pass pass

There is no run without the change: the test reads RecompileResult::functionLdsBuffer, which this PR adds, so the test alone does not build on main.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6269213192 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6269213192). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-19T14:09:01Z. --- AMD and Intel Windows data: `agc_driver_pixel_lds_limit` passes with this PR on an AMD RX 9070 XT and an Intel UHD 770, so the storage-buffer path for the unbounded pixel LDS array runs on both. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, `ANYPS5_NO_SHADER_CACHE=1`, serial CTest. Intel UHD Graphics 770 (`8086:a780`), driver 32.0.101.7088. AMD Radeon RX 9070 XT (`1002:7550`), driver 32.0.31041.1004, with `VkCache` emptied first. This head `834d52805` merged into `main` `85029a00f`. | Tests, ×3 | UHD 770 | RX 9070 XT | |---|---|---| | This head: `agc_driver_pixel_lds_limit` | pass | pass | There is no run without the change: the test reads `RecompileResult::functionLdsBuffer`, which this PR adds, so the test alone does not build on `main`. AI-assisted: yes (Claude Code)
DavidAmsellem commented 2026-10-19 15:44:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T15:44:19Z.


On AMD/RADV this PR breaks the existing agc_driver_pixel_lds test. It passes on main and fails 3/3 with the PR merged.

Merged onto main 43a2abaf7 (clean merge). AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release, ANYPS5_REQUIRE_VULKAN=1.

ctest -R '^agc_driver_pixel_lds$' main with this PR
RADV Passed 3/3 (pixel LDS tests passed: 12 draws, 24576 pixels, 73728 LDS results) Failed 3/3
lavapipe Skipped (its subgroup cannot hold a wave32) Skipped

With the PR, the wave64 bounded, wave64 unbounded and wave32 bounded stages all finish. The wave32 unbounded stage, the one that now goes through the new buffer, fails:

pixel LDS wave64 bounded
pixel LDS wave64 unbounded
pixel LDS wave32 bounded
pixel LDS wave32 unbounded
AGC graphics: pixel LDS wave32 unbounded: pixel 0 bank 0 expected 0 got 65536

Device lines from the same run:

[gpu] pixel function LDS pool: 1023 subgroups, 2046 MiB, stride 64 lanes
Selected GPU name=AMD Radeon RX 7900 XT (RADV NAVI31) ... subgroup=64
Wave32 programs run on subgroups of 32: compute 1, mesh 1

So on RADV the pool is sized for 64-lane subgroups, and a wave32 pixel program does not get 32-lane subgroups: only compute and mesh do. On the RTX 5090 in the description, the host subgroup and the guest wave are both 32 lanes, so the two cannot differ. My guess, not verified: two guest wave32s that share one 64-lane host subgroup address the same pool slot, or the slot index or lane offset assumes the guest wave size. That would fit only the wave32 unbounded stage failing. lavapipe skips this test, so CI cannot show it.

The full suite with the PR otherwise matches main: the same two failures, agc_driver_image_table_vouched_lookups (#7766, fixed by #7916) and agc_driver_guest_memory_lifetime (#7784), plus this one. The PR's new agc_driver_pixel_lds_limit passes on RADV.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38; lavapipe (skips)

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271202339 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6271202339). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T15:44:19Z. --- On AMD/RADV this PR breaks the existing `agc_driver_pixel_lds` test. It passes on `main` and fails 3/3 with the PR merged. Merged onto `main` `43a2abaf7` (clean merge). AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release, `ANYPS5_REQUIRE_VULKAN=1`. | `ctest -R '^agc_driver_pixel_lds$'` | `main` | with this PR | |---|---|---| | RADV | Passed 3/3 (`pixel LDS tests passed: 12 draws, 24576 pixels, 73728 LDS results`) | **Failed 3/3** | | lavapipe | Skipped (its subgroup cannot hold a wave32) | Skipped | With the PR, the wave64 bounded, wave64 unbounded and wave32 bounded stages all finish. The wave32 unbounded stage, the one that now goes through the new buffer, fails: ``` pixel LDS wave64 bounded pixel LDS wave64 unbounded pixel LDS wave32 bounded pixel LDS wave32 unbounded AGC graphics: pixel LDS wave32 unbounded: pixel 0 bank 0 expected 0 got 65536 ``` Device lines from the same run: ``` [gpu] pixel function LDS pool: 1023 subgroups, 2046 MiB, stride 64 lanes Selected GPU name=AMD Radeon RX 7900 XT (RADV NAVI31) ... subgroup=64 Wave32 programs run on subgroups of 32: compute 1, mesh 1 ``` So on RADV the pool is sized for 64-lane subgroups, and a wave32 pixel program does not get 32-lane subgroups: only compute and mesh do. On the RTX 5090 in the description, the host subgroup and the guest wave are both 32 lanes, so the two cannot differ. My guess, not verified: two guest wave32s that share one 64-lane host subgroup address the same pool slot, or the slot index or lane offset assumes the guest wave size. That would fit only the wave32 unbounded stage failing. lavapipe skips this test, so CI cannot show it. The full suite with the PR otherwise matches `main`: the same two failures, `agc_driver_image_table_vouched_lookups` (#7766, fixed by #7916) and `agc_driver_guest_memory_lifetime` (#7784), plus this one. The PR's new `agc_driver_pixel_lds_limit` passes on RADV. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38; lavapipe (skips) AI-assisted: yes
mazen320 commented 2026-10-19 17:47:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-19T17:47:38Z.


The wave32 unbounded miss on RADV matches the lane index. EmitSubgroupLocalInvocationId masks a wave32 program on a wider host subgroup down to 32 lanes, so both halves of a 64-lane fragment subgroup wrote the same 32 regions. The pool stride was already the host subgroup size (64 on that 7900 XT). The region index for that case is now the raw SubgroupLocalInvocationId, so lane 32 is a different region from lane 0. One slot is still elected for the whole subgroup.

This machine's fragment subgroup is 32 lanes, so the two halves never share a subgroup here. After 80bf3630d, agc_driver_pixel_lds and agc_driver_pixel_lds_limit still pass on an RTX 5090, driver 617.42, Windows 11, ANYPS5_NO_SHADER_CACHE=1. The RADV wave32 unbounded stage is the run that can confirm the fix.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6273547166 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6273547166). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-19T17:47:38Z. --- The wave32 unbounded miss on RADV matches the lane index. `EmitSubgroupLocalInvocationId` masks a wave32 program on a wider host subgroup down to 32 lanes, so both halves of a 64-lane fragment subgroup wrote the same 32 regions. The pool stride was already the host subgroup size (64 on that 7900 XT). The region index for that case is now the raw `SubgroupLocalInvocationId`, so lane 32 is a different region from lane 0. One slot is still elected for the whole subgroup. This machine's fragment subgroup is 32 lanes, so the two halves never share a subgroup here. After `80bf3630d`, `agc_driver_pixel_lds` and `agc_driver_pixel_lds_limit` still pass on an RTX 5090, driver 617.42, Windows 11, `ANYPS5_NO_SHADER_CACHE=1`. The RADV wave32 unbounded stage is the run that can confirm the fix.
adriadam10 commented 2026-10-19 18:02:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T18:02:26Z.

Review: CHANGES_REQUESTED


Thanks for the fix and for the RADV wave32 follow-up. Reviewed by reading the diff; the head has only Conventions CI.

  • Draw.cpp:161: vkCmdFillBuffer zeroes bytes 0-7 (counter and overflow flag) at the start of every draw. A draw that overflowed sets the flag, and the next draw clears it before WaitIdle reads it, so CheckPixelFunctionLds only catches an overflow in the last draw before the wait. The overflowing draw has already written slot 0 for the excess subgroups. Keep the flag sticky (reset it only where it is checked) or check it per submit.
  • Draw.cpp:162-163: the barrier has srcStageMask = TRANSFER | HOST, so the fill is not ordered after earlier draws' fragment shaders in the same command buffer. Those can still be taking slots and writing their regions while the counter is reset to 0, and the next draw hands out the same slots. It needs a barrier from FRAGMENT_SHADER shader writes to the transfer write (or a counter that is not reset while draws are in flight).
  • Draw.cpp:112-116: this allocates up to 2 GiB host-visible/coherent memory on every driver, kept until ReleasePixelFunctionLds. The bug described is NVIDIA 617.42 Function arrays, so scope the buffer path to that driver (vendor/driver ID), as docs/dev for memory handling asks for driver workarounds that retain memory, or state the bound and show peak RSS before/after on a draw that takes the buffer path. "Freed at device teardown" is not a bound. Please also say whether host-visible memory is the right type here (on discrete GPUs it can end up in system RAM).
  • A full-screen draw (1920x1080 = 64800 subgroups of 32) needs far more than the 2047 slots, so any such draw will throw. If that is intended, say so in the description; otherwise slots need to be recycled.
  • Test: PixelLdsLimit.cpp has no overflow case (a draw needing more slots than the pool has, asserting WaitIdle throws), and it skips when the host subgroup is < 32. Please add the overflow check and re-run agc_driver_pixel_lds on RADV after 80bf3630d (the earlier AMD/Intel runs are on 834d52805).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5575648450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#pullrequestreview-5575648450). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T18:02:26Z. **Review:** CHANGES_REQUESTED --- Thanks for the fix and for the RADV wave32 follow-up. Reviewed by reading the diff; the head has only Conventions CI. - `Draw.cpp:161`: `vkCmdFillBuffer` zeroes bytes 0-7 (counter and overflow flag) at the start of every draw. A draw that overflowed sets the flag, and the next draw clears it before `WaitIdle` reads it, so `CheckPixelFunctionLds` only catches an overflow in the last draw before the wait. The overflowing draw has already written slot 0 for the excess subgroups. Keep the flag sticky (reset it only where it is checked) or check it per submit. - `Draw.cpp:162-163`: the barrier has `srcStageMask = TRANSFER | HOST`, so the fill is not ordered after earlier draws' fragment shaders in the same command buffer. Those can still be taking slots and writing their regions while the counter is reset to 0, and the next draw hands out the same slots. It needs a barrier from `FRAGMENT_SHADER` shader writes to the transfer write (or a counter that is not reset while draws are in flight). - `Draw.cpp:112-116`: this allocates up to 2 GiB host-visible/coherent memory on every driver, kept until `ReleasePixelFunctionLds`. The bug described is NVIDIA 617.42 `Function` arrays, so scope the buffer path to that driver (vendor/driver ID), as docs/dev for memory handling asks for driver workarounds that retain memory, or state the bound and show peak RSS before/after on a draw that takes the buffer path. "Freed at device teardown" is not a bound. Please also say whether host-visible memory is the right type here (on discrete GPUs it can end up in system RAM). - A full-screen draw (1920x1080 = 64800 subgroups of 32) needs far more than the 2047 slots, so any such draw will throw. If that is intended, say so in the description; otherwise slots need to be recycled. - Test: `PixelLdsLimit.cpp` has no overflow case (a draw needing more slots than the pool has, asserting `WaitIdle` throws), and it skips when the host subgroup is < 32. Please add the overflow check and re-run `agc_driver_pixel_lds` on RADV after `80bf3630d` (the earlier AMD/Intel runs are on `834d52805`).
mazen320 commented 2026-10-19 18:17:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-19T18:17:23Z.


3acd3c4bd takes the pool notes.

The per-draw fill now zeroes only the slot counter, and only after a barrier from earlier fragment-shader access. The overflow flag stays set until CheckPixelFunctionLds, which runs from WaitIdle after the device is idle and then clears it. Slots are reused between draws. One draw that needs more subgroups than the pool holds still throws: on this 5090 that is 2047 subgroups, so a 1920x1080 draw does.

The storage buffer is now emitted only for NVIDIA's proprietary driver, which is the driver where a Function array of 6144 or more dwords does not finish. Other drivers keep the Function array, so they do not allocate the pool. The RADV wave32 unbounded stage then stays on the path that already passed on main.

On this RTX 5090, driver 617.42, Windows 11, ANYPS5_NO_SHADER_CACHE=1: agc_driver_pixel_lds passed all four stages, and agc_driver_pixel_lds_limit passed the 64x32 readback and then a 256x256 draw, which threw pixel function LDS subgroup slots exhausted.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274115434 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6274115434). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-19T18:17:23Z. --- `3acd3c4bd` takes the pool notes. The per-draw fill now zeroes only the slot counter, and only after a barrier from earlier fragment-shader access. The overflow flag stays set until `CheckPixelFunctionLds`, which runs from `WaitIdle` after the device is idle and then clears it. Slots are reused between draws. One draw that needs more subgroups than the pool holds still throws: on this 5090 that is 2047 subgroups, so a 1920x1080 draw does. The storage buffer is now emitted only for NVIDIA's proprietary driver, which is the driver where a `Function` array of 6144 or more dwords does not finish. Other drivers keep the `Function` array, so they do not allocate the pool. The RADV wave32 unbounded stage then stays on the path that already passed on `main`. On this RTX 5090, driver 617.42, Windows 11, `ANYPS5_NO_SHADER_CACHE=1`: `agc_driver_pixel_lds` passed all four stages, and `agc_driver_pixel_lds_limit` passed the 64x32 readback and then a 256x256 draw, which threw `pixel function LDS subgroup slots exhausted`.
blawesom commented 2026-10-19 18:41:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T18:41:47Z.


Rebase handoff, with one PR-own failure confirmed — rebased onto current main (all commits, authorship unchanged). One test conflict unioned.

The finding: agc_shader_memory fails with "new requests did not use serialization version 37" — and it fails identically on your own unrebased head, so it is the branch's own state: the serializer bump to v37 (or whichever version this PR's encoder changes require) did not land in the tree the test sees. Everything else is green apart from the four known main regressions (#5444 Mesa, #7584 BDA, #7766, #7784); conventions pass.

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/7888
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 5f4f31f57.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274586066 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6274586066). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-19T18:41:47Z. --- **Rebase handoff, with one PR-own failure confirmed** — rebased onto current `main` (all commits, authorship unchanged). One test conflict unioned. **The finding:** `agc_shader_memory` fails with **"new requests did not use serialization version 37"** — and it fails identically on your own unrebased head, so it is the branch's own state: the serializer bump to v37 (or whichever version this PR's encoder changes require) did not land in the tree the test sees. Everything else is green apart from the four known `main` regressions (#5444 Mesa, #7584 BDA, #7766, #7784); conventions pass. **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/7888 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `5f4f31f57`.
mazen320 commented 2026-10-19 18:54:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-19T18:54:29Z.


Merged current main. Request version 37 is already the stencil operation export, so the pixel function LDS flag is version 38. agc_shader_memory and request_serializer_tests passed here after that. The expected prefix is the full 12-character NVNQQSYAAAA=.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274826485 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6274826485). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-19T18:54:29Z. --- Merged current main. Request version 37 is already the stencil operation export, so the pixel function LDS flag is version 38. `agc_shader_memory` and `request_serializer_tests` passed here after that. The expected prefix is the full 12-character `NVNQQSYAAAA=`.
mazen320 commented 2026-10-19 21:58:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-19T21:58:31Z.


The review notes are in the commits after the request.

Local runs of head 0af52c0a0:

  • RTX 3080 (device 0x2206, subgroup 32): agc_driver_pixel_lds and agc_driver_pixel_lds_limit passed. The limit run printed the 2047-subgroup pool, dword 8000 and 8191, and the overflow throw.
  • AMD Radeon graphics on this PC (device 0x13c0, subgroup 64): both tests passed, including the wave32 cases. The NVIDIA-only overflow case did not run there.

Linux RADV was not run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6278302135 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6278302135). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-19T21:58:31Z. --- The review notes are in the commits after the request. Local runs of head `0af52c0a0`: - RTX 3080 (device 0x2206, subgroup 32): `agc_driver_pixel_lds` and `agc_driver_pixel_lds_limit` passed. The limit run printed the 2047-subgroup pool, dword 8000 and 8191, and the overflow throw. - AMD Radeon graphics on this PC (device 0x13c0, subgroup 64): both tests passed, including the wave32 cases. The NVIDIA-only overflow case did not run there. Linux RADV was not run.
blawesom commented 2026-10-20 07:26:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-20T07:26:11Z.


Closing the loop on the finding from my handoff: the agc_shader_memory failure ("new requests did not use serialization version 37") is fixed on 0af52c0a0 — the version-38 serialization resolves it. Verified on Linux (CachyOS, AMD RX 9070 XT / RADV): agc_shader_memory_tests passes on the new head (capture, strict validation and deterministic replay).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6285710737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6285710737). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-20T07:26:11Z. --- Closing the loop on the finding from my handoff: the `agc_shader_memory` failure ("new requests did not use serialization version 37") is **fixed** on `0af52c0a0` — the version-38 serialization resolves it. Verified on Linux (CachyOS, AMD RX 9070 XT / RADV): `agc_shader_memory_tests` passes on the new head (capture, strict validation and deterministic replay).
mazen320 commented 2026-10-20 09:44:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-20T09:44:09Z.


Rebased onto current main (request serializer is already at 38 for mesh barycentrics, so the pixel function LDS flag is version 39; fixture prefix NVNQQScAAAA=).

Review items from the earlier pass are in 8ed61fcc8 / head:

  • Overflow flag is sticky: vkCmdFillBuffer clears only the slot counter (4 bytes); CheckPixelFunctionLds clears the flag after WaitIdle reads it. PixelLdsLimit asserts the overflow throw.
  • Barrier before the fill is FRAGMENT_SHADER → TRANSFER.
  • Buffer path is gated to VK_DRIVER_ID_NVIDIA_PROPRIETARY (largePixelFunctionLdsBuffer).
  • Debt note states a full-screen draw past the slot pool throws (2047 subgroups of 32 on that 5090).

Local after rebase: request_serializer_tests passed; conventions clean aside from the pre-existing debt-length warning on the lengthened LDS entry.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288120999 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6288120999). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-20T09:44:09Z. --- Rebased onto current `main` (request serializer is already at 38 for mesh barycentrics, so the pixel function LDS flag is version **39**; fixture prefix `NVNQQScAAAA=`). Review items from the earlier pass are in `8ed61fcc8` / head: - Overflow flag is sticky: `vkCmdFillBuffer` clears only the slot counter (4 bytes); `CheckPixelFunctionLds` clears the flag after `WaitIdle` reads it. `PixelLdsLimit` asserts the overflow throw. - Barrier before the fill is `FRAGMENT_SHADER` → `TRANSFER`. - Buffer path is gated to `VK_DRIVER_ID_NVIDIA_PROPRIETARY` (`largePixelFunctionLdsBuffer`). - Debt note states a full-screen draw past the slot pool throws (2047 subgroups of 32 on that 5090). Local after rebase: `request_serializer_tests` passed; conventions clean aside from the pre-existing debt-length warning on the lengthened LDS entry.
mazen320 commented 2026-10-20 09:56:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-20T09:56:48Z.


Follow-up after actually running the suite on this tip (874659b20 + fixture fix):

  • request_serializer passed
  • agc_shader_memory failed until the v39 trailer was accounted for in legacy downgrade fixtures / unsupported-version probe (NVNQQSgAAAA= = 40); now passed
  • agc_driver_pixel_lds passed (RTX 3080)
  • agc_driver_pixel_lds_limit passed (RTX 3080), including the overflow throw path

Safe to re-request review on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288332386 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6288332386). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-20T09:56:48Z. --- Follow-up after actually running the suite on this tip (`874659b20` + fixture fix): - `request_serializer` passed - `agc_shader_memory` failed until the v39 trailer was accounted for in legacy downgrade fixtures / unsupported-version probe (`NVNQQSgAAAA=` = 40); now passed - `agc_driver_pixel_lds` passed (RTX 3080) - `agc_driver_pixel_lds_limit` passed (RTX 3080), including the overflow throw path Safe to re-request review on this head.
dantdmdarealguy commented 2026-10-20 11:29:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-10-20T11:29:40Z.


RTX 5080 data (Windows, same driver as the failing 4090 in #7708), plus one validation finding on this PR.

NVIDIA GeForce RTX 5080 (10de:2c02, subgroups of 32), driver 617.42 (32.0.16.1742), Windows 11 Pro 26300, i9-14900K, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, every execution test built:

Build agc_driver_pixel_lds agc_driver_pixel_lds_limit
main 1d4164552 25/25 pass (5 plain, 20 with ANYPS5_REQUIRE_VULKAN=1) —
this PR merged onto it (ebfc3f4ca, clean) 5/5 pass 5/5 pass

No [device-fault] and no vkWaitForFences error in any run, so the device loss doesn't reproduce on Blackwell here either.

With VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layer 1.4.363), main reports no VUID-, but this PR adds one on the wave64 unbounded stage and on both limit-test shaders:

Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ]
vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
In SPIR-V 1.4 or earlier, Id must be a constant instruction
  %60 = OpGroupNonUniformBroadcast %uint %uint_3 %59 %58

That is the slot broadcast in SpirvBufferAccess.cpp, whose lane source comes from OpGroupNonUniformBallotFindLSB. Before SPIR-V 1.5, OpGroupNonUniformBroadcast needs a constant lane. Since the ballot is of OpGroupNonUniformElect, which picks the lowest active invocation, OpGroupNonUniformBroadcastFirst of local should give the same slot without the dynamic lane.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6289843147 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6289843147). Originally posted by [dantdmdarealguy](https://github.com/dantdmdarealguy) on 2026-10-20T11:29:40Z. --- RTX 5080 data (Windows, same driver as the failing 4090 in #7708), plus one validation finding on this PR. NVIDIA GeForce RTX 5080 (`10de:2c02`, subgroups of 32), driver 617.42 (32.0.16.1742), Windows 11 Pro 26300, i9-14900K, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, every execution test built: | Build | `agc_driver_pixel_lds` | `agc_driver_pixel_lds_limit` | |---|---|---| | `main` `1d4164552` | 25/25 pass (5 plain, 20 with `ANYPS5_REQUIRE_VULKAN=1`) | — | | this PR merged onto it (`ebfc3f4ca`, clean) | 5/5 pass | 5/5 pass | No `[device-fault]` and no `vkWaitForFences` error in any run, so the device loss doesn't reproduce on Blackwell here either. With `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (layer 1.4.363), `main` reports no `VUID-`, but this PR adds one on the wave64 unbounded stage and on both limit-test shaders: ``` Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ] vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error): In SPIR-V 1.4 or earlier, Id must be a constant instruction %60 = OpGroupNonUniformBroadcast %uint %uint_3 %59 %58 ``` That is the slot broadcast in `SpirvBufferAccess.cpp`, whose lane `source` comes from `OpGroupNonUniformBallotFindLSB`. Before SPIR-V 1.5, `OpGroupNonUniformBroadcast` needs a constant lane. Since the ballot is of `OpGroupNonUniformElect`, which picks the lowest active invocation, `OpGroupNonUniformBroadcastFirst` of `local` should give the same slot without the dynamic lane.
screamm commented 2026-10-20 14:30:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-20T14:30:43Z.


Tested at ebfc3f4ca. The head moved to 69ee247b2 while this ran; the only change is the slot broadcast (OpGroupNonUniformBallot + FindLSB + OpGroupNonUniformBroadcast replaced by OpGroupNonUniformBroadcastFirst), so the gate finding below is unaffected, but the runs were not repeated on the new head.

Independent NVIDIA run on Windows. The PR's tests pass. The negative control does not reproduce the Function-array failure on this card and driver.

Windows 11 Pro 26220, NVIDIA GeForce RTX 4070 (10de:2786, subgroup 32), driver 596.21, Ryzen 7 5700X, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full build. Head ebfc3f4ca merged onto main 1d4164552 (clean; #7849 was stacked on top for an unrelated run, and the two PRs share no files).

Run Result
request_serializer, agc_shader_memory, agc_driver_pixel_lds, agc_driver_pixel_lds_limit (CTest, ANYPS5_NO_SHADER_CACHE=1) 3/3 each
agc_driver_pixel_lds, agc_driver_pixel_lds_limit with the shader cache 3/3 each
Overflow case pixel LDS limit overflow passed in every limit run

Pool line, the same in every run: [gpu] pixel function LDS pool: 2047 subgroups, 2047 MiB, stride 32 lanes.

Negative control: I kept the PR and forced target.largePixelFunctionLdsBuffer = false in VulkanDevice::buildTarget, then ran under --timeout 60.

  • agc_driver_pixel_lds_limit passes 3/3 in 1-3 s on the 8192-dword Function array. The pool line does not appear, and the test's functionLdsBuffer == false check holds.
  • agc_driver_pixel_lds passes 3/3.
  • I added local draws on the same Function path that read back every pixel. 256x256 passes 3/3 and 1024x1024 passes 3/3.
  • No hang, no device loss and no vkQueueSubmit failure.

On this Ada card with 596.21, the gate therefore changes a draw that works into one that throws pixel function LDS subgroup slots exhausted once it needs more than 2047 subgroups. The 256x256 draw in the limit test does exactly that. The failure in the description was measured on driver 617.42, and the gate covers every VK_DRIVER_ID_NVIDIA_PROPRIETARY device. Could it be bounded by the driver version or architecture where the failure was measured? If not, could the description say it applies to all NVIDIA drivers?

Also checked:

  • GPU pass -j1 -R '^agc_driver_': 601/604 pass. The three failures match main: image_array_window_past_layer_limit does not build (MinGW alignas(65536)), and pass_input_hazard fails with the same message on main 1d4164552. The third, pm4_replay_tool, failed because of my shell's PATH and passes on a rerun.
  • Non-GPU suite: every failure under -j8 load passes when rerun serially.
  • check_conventions.py: 0 errors. One warning: the debt entry at docs/dev/debt/shader.md:145 is 1832 characters. git diff --check is clean.
  • Showcase PPSA99005, RetroArch PPSA99169 and vkQuake PPSA99010 (shareware pak), 60 s each, main against the PR: no stop line and no vkQueueSubmit failure on either side. No title reached the buffer path.

Not checked:

  • The Khronos validation layer is not installed here, so I could not confirm or rule out the VUID-VkShaderModuleCreateInfo-pCode-08737 OpGroupNonUniformBroadcast finding.
  • No Blackwell card and no 617.42 driver.
  • No performance comparison.
  • No run on today's newer main (d50ec76da; the merge is clean).

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6293278407 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6293278407). Originally posted by [screamm](https://github.com/screamm) on 2026-10-20T14:30:43Z. --- Tested at `ebfc3f4ca`. The head moved to `69ee247b2` while this ran; the only change is the slot broadcast (`OpGroupNonUniformBallot` + `FindLSB` + `OpGroupNonUniformBroadcast` replaced by `OpGroupNonUniformBroadcastFirst`), so the gate finding below is unaffected, but the runs were not repeated on the new head. Independent NVIDIA run on Windows. The PR's tests pass. The negative control does not reproduce the `Function`-array failure on this card and driver. Windows 11 Pro 26220, NVIDIA GeForce RTX 4070 (`10de:2786`, subgroup 32), driver 596.21, Ryzen 7 5700X, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full build. Head `ebfc3f4ca` merged onto `main` `1d4164552` (clean; #7849 was stacked on top for an unrelated run, and the two PRs share no files). | Run | Result | |---|---| | `request_serializer`, `agc_shader_memory`, `agc_driver_pixel_lds`, `agc_driver_pixel_lds_limit` (CTest, `ANYPS5_NO_SHADER_CACHE=1`) | 3/3 each | | `agc_driver_pixel_lds`, `agc_driver_pixel_lds_limit` with the shader cache | 3/3 each | | Overflow case | `pixel LDS limit overflow passed` in every limit run | Pool line, the same in every run: `[gpu] pixel function LDS pool: 2047 subgroups, 2047 MiB, stride 32 lanes`. Negative control: I kept the PR and forced `target.largePixelFunctionLdsBuffer = false` in `VulkanDevice::buildTarget`, then ran under `--timeout 60`. - `agc_driver_pixel_lds_limit` passes 3/3 in 1-3 s on the 8192-dword `Function` array. The pool line does not appear, and the test's `functionLdsBuffer == false` check holds. - `agc_driver_pixel_lds` passes 3/3. - I added local draws on the same `Function` path that read back every pixel. 256x256 passes 3/3 and 1024x1024 passes 3/3. - No hang, no device loss and no `vkQueueSubmit` failure. On this Ada card with 596.21, the gate therefore changes a draw that works into one that throws `pixel function LDS subgroup slots exhausted` once it needs more than 2047 subgroups. The 256x256 draw in the limit test does exactly that. The failure in the description was measured on driver 617.42, and the gate covers every `VK_DRIVER_ID_NVIDIA_PROPRIETARY` device. Could it be bounded by the driver version or architecture where the failure was measured? If not, could the description say it applies to all NVIDIA drivers? Also checked: - GPU pass `-j1 -R '^agc_driver_'`: 601/604 pass. The three failures match `main`: `image_array_window_past_layer_limit` does not build (MinGW `alignas(65536)`), and `pass_input_hazard` fails with the same message on `main` `1d4164552`. The third, `pm4_replay_tool`, failed because of my shell's PATH and passes on a rerun. - Non-GPU suite: every failure under `-j8` load passes when rerun serially. - `check_conventions.py`: 0 errors. One warning: the debt entry at `docs/dev/debt/shader.md:145` is 1832 characters. `git diff --check` is clean. - Showcase PPSA99005, RetroArch PPSA99169 and vkQuake PPSA99010 (shareware pak), 60 s each, `main` against the PR: no stop line and no `vkQueueSubmit` failure on either side. No title reached the buffer path. Not checked: - The Khronos validation layer is not installed here, so I could not confirm or rule out the `VUID-VkShaderModuleCreateInfo-pCode-08737` `OpGroupNonUniformBroadcast` finding. - No Blackwell card and no 617.42 driver. - No performance comparison. - No run on today's newer `main` (`d50ec76da`; the merge is clean). Written with Claude Code assistance (validation by a subagent, reviewed in this session).
DavidAmsellem commented 2026-10-20 16:59:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-20T16:59:09Z.


The RADV run of the current head, 69ee247b2, built as-is (it no longer merges cleanly with main 6bef96df7: the only conflict is in RequestSerializerTests.cpp, so I tested the branch on its own base, 8a7ba4beb).

AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release, ANYPS5_REQUIRE_VULKAN=1. The device reports subgroup=64, and wave32 subgroups only for compute and mesh.

As submitted (the buffer is limited to NVIDIA's driver, so RADV keeps the Function array):

  • agc_driver_pixel_lds: passes 3 of 3, all four stages, including the wave32 unbounded stage that failed here before.
  • agc_driver_pixel_lds_limit: passes 3 of 3.
  • request_serializer and agc_shader_memory pass.

With the buffer forced on RADV, to exercise the lane index fix on a 64-lane fragment subgroup: the only local change is target.largePixelFunctionLdsBuffer = true; in VulkanDevice::buildTarget. The pool line shows the buffer path is used:

[gpu] pixel function LDS pool: 1023 subgroups, 2046 MiB, stride 64 lanes
  • agc_driver_pixel_lds: passes 3 of 3, all four stages. The wave32 unbounded stage, which returned expected 0 got 65536 before the lane index change, is now correct.
  • agc_driver_pixel_lds_limit: passes 3 of 3, including pixel LDS limit overflow passed.

With the Khronos validation layer (ANYPS5_NO_SHADER_CACHE=1), both tests in both configurations add no VUID: no pCode-08737 from the slot broadcast, and the only message is VkDeviceCreateInfo-pNext-pNext, which my older 1.3.275 layer prints for every device because it doesn't know maintenance8.

So the 64-lane case works on AMD hardware too. On the question about the NVIDIA-only gate: on this card the buffer path is correct, but I haven't checked whether the Function array has any limit on RADV that the buffer would avoid.

GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6296420710 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6296420710). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-20T16:59:09Z. --- The RADV run of the current head, `69ee247b2`, built as-is (it no longer merges cleanly with `main` `6bef96df7`: the only conflict is in `RequestSerializerTests.cpp`, so I tested the branch on its own base, `8a7ba4beb`). AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release, `ANYPS5_REQUIRE_VULKAN=1`. The device reports `subgroup=64`, and wave32 subgroups only for compute and mesh. **As submitted** (the buffer is limited to NVIDIA's driver, so RADV keeps the `Function` array): - `agc_driver_pixel_lds`: passes 3 of 3, all four stages, including the wave32 unbounded stage that failed here before. - `agc_driver_pixel_lds_limit`: passes 3 of 3. - `request_serializer` and `agc_shader_memory` pass. **With the buffer forced on RADV**, to exercise the lane index fix on a 64-lane fragment subgroup: the only local change is `target.largePixelFunctionLdsBuffer = true;` in `VulkanDevice::buildTarget`. The pool line shows the buffer path is used: ``` [gpu] pixel function LDS pool: 1023 subgroups, 2046 MiB, stride 64 lanes ``` - `agc_driver_pixel_lds`: passes 3 of 3, all four stages. The wave32 unbounded stage, which returned `expected 0 got 65536` before the lane index change, is now correct. - `agc_driver_pixel_lds_limit`: passes 3 of 3, including `pixel LDS limit overflow passed`. With the Khronos validation layer (`ANYPS5_NO_SHADER_CACHE=1`), both tests in both configurations add no VUID: no `pCode-08737` from the slot broadcast, and the only message is `VkDeviceCreateInfo-pNext-pNext`, which my older 1.3.275 layer prints for every device because it doesn't know `maintenance8`. So the 64-lane case works on AMD hardware too. On the question about the NVIDIA-only gate: on this card the buffer path is correct, but I haven't checked whether the `Function` array has any limit on RADV that the buffer would avoid. GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38 AI-assisted: yes
blawesom commented 2026-10-20 19:14:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-20T19:14:29Z.


Rebase handoff with a serializer-version collision resolved to v40, one fixture byte left — rebased onto current main (a9cfea22f, all commits, authorship unchanged). This needed real format work; here's the map.

The collision: main and this PR both took serialization version 39 for different features — main's merged-hull PR writes mergedHull at v39, your series writes largePixelFunctionLdsBuffer at v39. Same number, incompatible blobs (the pattern of #6503/#7642). The handoff moves your feature to v40 following that precedent: main's landed mergedHull keeps 39, largePixelFunctionLdsBuffer reads at >= 40u, the writer emits 40, the version cap is 40, and the tests' version bytes, prefix strings ("NVNQQSgAAAA=" is now the current-version prefix — base64-decodes with version byte 0x28), unsupported-version list (now NVNQQSkAAAA= = 41), the merged-hull positional check (- 53u, one byte for the LDS flag) and the legacy-downgrade erase (- 53u) are all moved accordingly.

What still fails, and it's one byte somewhere: agc_shader_memory and request_serializer both fail with RequestSerializer: unexpected trailing data — one constructed fixture still carries a stale byte count relative to the v40 layout. I've pinned: round-trips are symmetric (write and read both end with the LDS bool), all hardcoded legacy blobs are pre-v21 (no trailing check), the merged-hull positional check and the version-30..38 downgrade loop are corrected — the remaining mismatch is in one of the hand-built fixtures in the serializer section of ShaderMemory.cpp (between the version-40 prefix check and the version-18 blob), and you'll find the exact byte far faster than a rebase can — the fixtures are yours.

Everything else is green: 1716/1721 — the three known current-main failures on this stack (#7784 guest-memory, tessellation pending Mesa 26.2.6, image_array_window_past_layer_limit flagged on #6772) plus the two serializer fixtures above.

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/7888
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is ``.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6299132393 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6299132393). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-20T19:14:29Z. --- **Rebase handoff with a serializer-version collision resolved to v40, one fixture byte left** — rebased onto current `main` (`a9cfea22f`, all commits, authorship unchanged). This needed real format work; here's the map. **The collision:** `main` and this PR both took serialization version 39 for different features — `main`'s merged-hull PR writes `mergedHull` at v39, your series writes `largePixelFunctionLdsBuffer` at v39. Same number, incompatible blobs (the pattern of #6503/#7642). The handoff moves **your feature to v40** following that precedent: `main`'s landed `mergedHull` keeps 39, `largePixelFunctionLdsBuffer` reads at `>= 40u`, the writer emits 40, the version cap is 40, and the tests' version bytes, prefix strings ("NVNQQSgAAAA=" is now the current-version prefix — base64-decodes with version byte 0x28), unsupported-version list (now NVNQQSkAAAA= = 41), the merged-hull positional check (`- 53u`, one byte for the LDS flag) and the legacy-downgrade erase (`- 53u`) are all moved accordingly. **What still fails, and it's one byte somewhere:** `agc_shader_memory` and `request_serializer` both fail with `RequestSerializer: unexpected trailing data` — one constructed fixture still carries a stale byte count relative to the v40 layout. I've pinned: round-trips are symmetric (write and read both end with the LDS bool), all hardcoded legacy blobs are pre-v21 (no trailing check), the merged-hull positional check and the version-30..38 downgrade loop are corrected — the remaining mismatch is in one of the hand-built fixtures in the serializer section of `ShaderMemory.cpp` (between the version-40 prefix check and the version-18 blob), and you'll find the exact byte far faster than a rebase can — the fixtures are yours. Everything else is green: **1716/1721** — the three known current-`main` failures on this stack (#7784 guest-memory, tessellation pending Mesa 26.2.6, `image_array_window_past_layer_limit` flagged on #6772) plus the two serializer fixtures above. **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/7888 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is ``.
oneandonlydean commented 2026-10-20 21:54:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T21:54:48Z.


@mazen320 I read the head 69ee247b2 against the earlier review notes: the sticky flag, the fragment-to-transfer barrier, the NVIDIA-only scope and the documented full-screen limit are in. Two things in the draw path still need a change:

  • Draw.cpp:2147: in recordDraw, PreparePixelFunctionLds runs only when the pass is not continued, but BindPixelFunctionLds (:2169) runs every time. StartDrawPass (:2099) continues the previous pass unless the draw captures, reads its target or is GPU/mesh indirect, and a pixel-LDS draw is none of those, although it records a fill and two barriers outside a pass. If the first such draw on a device continues a pass, pool.set is still null and the bind throws pixel function LDS buffer was not prepared. Later continued draws skip the counter reset, so slots add up across the pass. Adding PixelFunctionLdsSubgroup(shaders) != 0u to the begin-forcing argument would fix both. PixelLdsLimit.cpp does one draw per WaitIdle, so a case with two draws into the same target would cover it.
  • SpirvBufferAccess.cpp (EmitPixelFunctionLdsBase): an exhausted subgroup takes slot 0 (OpSelect(exhausted, 0, acquired)), so it shares slot 0's region with the subgroup that owns it. The flag is read only in VulkanDevice::WaitIdle, which an asynchronous flip does not call (Presentation.cpp:113 waits only for a synchronous flip), so the frames before the next idle render with the shared slot. Please either check the flag where submissions retire, or reword the debt note, which says the draw throws "instead of wrapping or dropping the write".

Still open from the earlier notes: the pool takes the first HOST_VISIBLE | HOST_COHERENT type (Context::MemoryType), which on NVIDIA is usually system memory, for 2 GiB that fragment shaders read and write. Only the 16-byte header is read by the host. Was a device-local pool with a separate host-visible header considered, and what does a large-LDS draw cost on the 5090 with the current type?

Smaller: arrays from 4097 to 6143 dwords move to the buffer path too (PixelFunctionStorageDwords = 4096), while the measured failure starts at 6144. Is there a size between the two that was measured?

The branch also needs the serializer-version rebase (v39 is taken on main; blawesom's handoff resolves it to v40).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302538099 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6302538099). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T21:54:48Z. --- @mazen320 I read the head `69ee247b2` against the earlier review notes: the sticky flag, the fragment-to-transfer barrier, the NVIDIA-only scope and the documented full-screen limit are in. Two things in the draw path still need a change: - `Draw.cpp:2147`: in `recordDraw`, `PreparePixelFunctionLds` runs only when the pass is not continued, but `BindPixelFunctionLds` (`:2169`) runs every time. `StartDrawPass` (`:2099`) continues the previous pass unless the draw captures, reads its target or is GPU/mesh indirect, and a pixel-LDS draw is none of those, although it records a fill and two barriers outside a pass. If the first such draw on a device continues a pass, `pool.set` is still null and the bind throws `pixel function LDS buffer was not prepared`. Later continued draws skip the counter reset, so slots add up across the pass. Adding `PixelFunctionLdsSubgroup(shaders) != 0u` to the begin-forcing argument would fix both. `PixelLdsLimit.cpp` does one draw per `WaitIdle`, so a case with two draws into the same target would cover it. - `SpirvBufferAccess.cpp` (`EmitPixelFunctionLdsBase`): an exhausted subgroup takes slot 0 (`OpSelect(exhausted, 0, acquired)`), so it shares slot 0's region with the subgroup that owns it. The flag is read only in `VulkanDevice::WaitIdle`, which an asynchronous flip does not call (`Presentation.cpp:113` waits only for a synchronous flip), so the frames before the next idle render with the shared slot. Please either check the flag where submissions retire, or reword the debt note, which says the draw throws "instead of wrapping or dropping the write". Still open from the earlier notes: the pool takes the first `HOST_VISIBLE | HOST_COHERENT` type (`Context::MemoryType`), which on NVIDIA is usually system memory, for 2 GiB that fragment shaders read and write. Only the 16-byte header is read by the host. Was a device-local pool with a separate host-visible header considered, and what does a large-LDS draw cost on the 5090 with the current type? Smaller: arrays from 4097 to 6143 dwords move to the buffer path too (`PixelFunctionStorageDwords` = 4096), while the measured failure starts at 6144. Is there a size between the two that was measured? The branch also needs the serializer-version rebase (v39 is taken on `main`; blawesom's handoff resolves it to v40).
mazen320 commented 2026-10-21 06:48:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T06:48:40Z.


Rebased onto current main (serializer is at 41 for float32DenormPreserve, so the pixel LDS flag is version 42; fixture prefix NVNQQSoAAAA=, unsupported NVNQQSsAAAA=).

Dean’s pass-begin note: StartDrawPass now forces a new pass when PixelFunctionLdsSubgroup(shaders) != 0, so the slot fill is not skipped on a continued pass while the set is still bound.

Local tip c60b91c46 (RTX 3080):

  • request_serializer passed
  • agc_shader_memory passed
  • agc_driver_pixel_lds passed
  • agc_driver_pixel_lds_limit passed
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309910355 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6309910355). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-21T06:48:40Z. --- Rebased onto current `main` (serializer is at 41 for `float32DenormPreserve`, so the pixel LDS flag is version **42**; fixture prefix `NVNQQSoAAAA=`, unsupported `NVNQQSsAAAA=`). Dean’s pass-begin note: `StartDrawPass` now forces a new pass when `PixelFunctionLdsSubgroup(shaders) != 0`, so the slot fill is not skipped on a continued pass while the set is still bound. Local tip `c60b91c46` (RTX 3080): - `request_serializer` passed - `agc_shader_memory` passed - `agc_driver_pixel_lds` passed - `agc_driver_pixel_lds_limit` passed
mazen320 commented 2026-10-21 11:03:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T11:03:10Z.


Rebased onto current main again. main took serialization version 42 for pixel sampleOrder, so the pixel LDS trailer flag is now version 43 (prefix NVNQQSsAAAA=, unsupported NVNQQSwAAAA=).

Local tip (RTX 3080): request_serializer, agc_shader_memory, agc_driver_pixel_lds, agc_driver_pixel_lds_limit all passed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6314354524 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6314354524). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-21T11:03:10Z. --- Rebased onto current `main` again. `main` took serialization version **42** for pixel `sampleOrder`, so the pixel LDS trailer flag is now version **43** (prefix `NVNQQSsAAAA=`, unsupported `NVNQQSwAAAA=`). Local tip (RTX 3080): `request_serializer`, `agc_shader_memory`, `agc_driver_pixel_lds`, `agc_driver_pixel_lds_limit` all passed.
mazen320 commented 2026-10-21 12:01:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T12:01:53Z.


@oneandonlydean Remaining notes from your last pass:

  • Exhausted subgroups still take slot 0; the sticky flag is now checked from RetirePresents (when a present fence retires) as well as WaitIdle, and the debt note matches that (shared slot until the check throws, not "throws instead of wrapping").
  • PixelLdsLimit draws twice into the same target before WaitIdle.
  • Host-visible whole pool: only the 16-byte header is read by the host; the allocation stays the first HOST_VISIBLE|HOST_COHERENT type so that header can be mapped without a separate device-local body. A device-local body plus host-visible header was not measured; on discrete NVIDIA the current type is usually system memory for the full ~2 GiB. Cost of a large-LDS draw on the 5090 with this type was not measured here.
  • Threshold: only 4096 (completes), 6144 (timeout), 7680 and 8192 (fault) were measured; 4097–6143 still take the buffer path. Debt notes that gap.

Rebased onto current main. Tip c5db72049 on RTX 3080 (ANYPS5_NO_SHADER_CACHE=1): request_serializer, agc_shader_memory, agc_driver_pixel_lds, and agc_driver_pixel_lds_limit (including two draws + overflow) passed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315401497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6315401497). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-21T12:01:53Z. --- @oneandonlydean Remaining notes from your last pass: - Exhausted subgroups still take slot 0; the sticky flag is now checked from `RetirePresents` (when a present fence retires) as well as `WaitIdle`, and the debt note matches that (shared slot until the check throws, not \"throws instead of wrapping\"). - `PixelLdsLimit` draws twice into the same target before `WaitIdle`. - Host-visible whole pool: only the 16-byte header is read by the host; the allocation stays the first `HOST_VISIBLE|HOST_COHERENT` type so that header can be mapped without a separate device-local body. A device-local body plus host-visible header was not measured; on discrete NVIDIA the current type is usually system memory for the full ~2 GiB. Cost of a large-LDS draw on the 5090 with this type was not measured here. - Threshold: only 4096 (completes), 6144 (timeout), 7680 and 8192 (fault) were measured; 4097–6143 still take the buffer path. Debt notes that gap. Rebased onto current `main`. Tip `c5db72049` on RTX 3080 (`ANYPS5_NO_SHADER_CACHE=1`): `request_serializer`, `agc_shader_memory`, `agc_driver_pixel_lds`, and `agc_driver_pixel_lds_limit` (including two draws + overflow) passed.
MaxLikesCode commented 2026-10-21 14:44:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MaxLikesCode on 2026-10-21T14:44:55Z.


RTX 4090 (Ada) check at head c5db72049, merged onto main 2c4b116da (clean). #7708 is fixed here. One concern is left, and it also answers @oneandonlydean's question about sizes between 4096 and 6144: the size at which the Function array fails depends on the GPU's size, and on the largest NVIDIA cards it is below 4096.

ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, ctest --test-dir build -R <test> -V. Validation runs add VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan-ValidationLayers vulkan-sdk-1.4.363.0) with implicit layers disabled; the loader log shows the layer inserted, and no log has was not found but was requested by env var VK_INSTANCE_LAYERS.

Test main 2c4b116da this PR
agc_driver_pixel_lds 5 of 10 fail: write invalid device fault, vkWaitForFences graphics: Vulkan result -4 10 of 10 pass
agc_driver_pixel_lds, validation 3 of 5 fail the same way, 0 VUID- 5 of 5 pass, 0 VUID-
agc_driver_pixel_lds_limit, validation not on main 3 of 3 pass, 0 VUID-, pixel function LDS pool: 2047 subgroups, 2047 MiB, stride 32 lanes, overflow throw
the other 21 tests matching lds|shader_memory|request_serializer, validation 21 pass, 0 VUID- 21 pass, 0 VUID-

Threshold. On this card the limit follows 4 GiB of private memory over every invocation the GPU can hold at once. The driver reports 128 SMs of 48 warps through VK_NV_shader_sm_builtins, so 196608 invocations. Run alone on main ae7ad5ff9, the unbounded pixel draw passed with its Function array cut to 5456 dwords and lost the device at 5472. 5456 × 4 × 196608 is just under 4 GiB, and 5472 × 4 × 196608 is just over it. So on a 4090 an array from 5472 to 6143 dwords fails too, and the buffer path is needed below 6144.

The same budget gives 4112 dwords for a 5090 (170 SMs, assuming 48 warps per SM there too), which fits 4096 completing and 6144 timing out there. A card with more SMs crosses 4 GiB below 4096: an RTX PRO 6000 Blackwell (188 SMs) at 3718 dwords. Other private arrays in the same program lower the limit further. So PixelFunctionStorageDwords = 4096 can still lose the device on the largest cards. A threshold of min(4096, 4 GiB / (shaderSMCount × shaderWarpsPerSM × subgroupSize) / 4) from VkPhysicalDeviceShaderSMBuiltinsPropertiesNV would cover them. Only the 4090 numbers are measured; the 5090 and RTX PRO 6000 numbers are computed from published SM counts.

  • NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200
  • WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6318858072 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6318858072). Originally posted by [MaxLikesCode](https://github.com/MaxLikesCode) on 2026-10-21T14:44:55Z. --- RTX 4090 (Ada) check at head `c5db72049`, merged onto `main` `2c4b116da` (clean). #7708 is fixed here. One concern is left, and it also answers @oneandonlydean's question about sizes between 4096 and 6144: the size at which the `Function` array fails depends on the GPU's size, and on the largest NVIDIA cards it is below 4096. `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `ctest --test-dir build -R <test> -V`. Validation runs add `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan-ValidationLayers `vulkan-sdk-1.4.363.0`) with implicit layers disabled; the loader log shows the layer inserted, and no log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. | Test | `main` `2c4b116da` | this PR | |---|---|---| | `agc_driver_pixel_lds` | 5 of 10 fail: `write invalid` device fault, `vkWaitForFences graphics: Vulkan result -4` | 10 of 10 pass | | `agc_driver_pixel_lds`, validation | 3 of 5 fail the same way, 0 `VUID-` | 5 of 5 pass, 0 `VUID-` | | `agc_driver_pixel_lds_limit`, validation | not on `main` | 3 of 3 pass, 0 `VUID-`, `pixel function LDS pool: 2047 subgroups, 2047 MiB, stride 32 lanes`, overflow throw | | the other 21 tests matching `lds\|shader_memory\|request_serializer`, validation | 21 pass, 0 `VUID-` | 21 pass, 0 `VUID-` | **Threshold.** On this card the limit follows 4 GiB of private memory over every invocation the GPU can hold at once. The driver reports 128 SMs of 48 warps through `VK_NV_shader_sm_builtins`, so 196608 invocations. Run alone on `main` `ae7ad5ff9`, the unbounded pixel draw passed with its `Function` array cut to 5456 dwords and lost the device at 5472. 5456 × 4 × 196608 is just under 4 GiB, and 5472 × 4 × 196608 is just over it. So on a 4090 an array from 5472 to 6143 dwords fails too, and the buffer path is needed below 6144. The same budget gives 4112 dwords for a 5090 (170 SMs, assuming 48 warps per SM there too), which fits 4096 completing and 6144 timing out there. A card with more SMs crosses 4 GiB below 4096: an RTX PRO 6000 Blackwell (188 SMs) at 3718 dwords. Other private arrays in the same program lower the limit further. So `PixelFunctionStorageDwords = 4096` can still lose the device on the largest cards. A threshold of `min(4096, 4 GiB / (shaderSMCount × shaderWarpsPerSM × subgroupSize) / 4)` from `VkPhysicalDeviceShaderSMBuiltinsPropertiesNV` would cover them. Only the 4090 numbers are measured; the 5090 and RTX PRO 6000 numbers are computed from published SM counts. - NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 Pro 26200 - WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON` AI-assisted: yes (Claude Code)
mazen320 commented 2026-10-21 15:02:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T15:02:34Z.


Implemented the SM-budget threshold Max measured on the 4090.

pixelFunctionStorageDwords is min(4096, 4 GiB / (shaderSMCount × shaderWarpsPerSM × subgroupSize × 4)) when VK_NV_shader_sm_builtins is present on NVIDIA proprietary (else 4096). Serializer version 44 carries the dword count; tip 0a8ea6cc1.

Local RTX 3080 (ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1): request_serializer, agc_shader_memory, agc_driver_pixel_lds, agc_driver_pixel_lds_limit passed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6319237884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6319237884). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-21T15:02:34Z. --- Implemented the SM-budget threshold Max measured on the 4090. `pixelFunctionStorageDwords` is `min(4096, 4 GiB / (shaderSMCount × shaderWarpsPerSM × subgroupSize × 4))` when `VK_NV_shader_sm_builtins` is present on NVIDIA proprietary (else 4096). Serializer version 44 carries the dword count; tip `0a8ea6cc1`. Local RTX 3080 (`ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`): `request_serializer`, `agc_shader_memory`, `agc_driver_pixel_lds`, `agc_driver_pixel_lds_limit` passed.
MaxLikesCode commented 2026-10-21 16:02:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MaxLikesCode on 2026-10-21T16:02:08Z.


RTX 4090 retest of 0a8ea6cc1, merged onto main cecb540a6 (clean), same setup as my run above:

  • agc_driver_pixel_lds: 10 of 10 pass, and 5 of 5 under the validation layer with 0 VUID-.
  • agc_driver_pixel_lds_limit, validation: 3 of 3 pass, 0 VUID-.
  • the other 21 tests matching lds|shader_memory|request_serializer, validation: 21 pass, 0 VUID-.
  • request_serializer and agc_shader_memory pass.

On this card the budget works out to 4 GiB / (128 × 48 × 32 × 4) = 5461 dwords, so the threshold stays at 4096 and the 4090 takes the same path as before; only cards with more than about 170 SMs get a lower one. The dword count is part of the request and the cache key, so a shader cached on one card is not reused on a card with a different threshold.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6320449454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6320449454). Originally posted by [MaxLikesCode](https://github.com/MaxLikesCode) on 2026-10-21T16:02:08Z. --- RTX 4090 retest of `0a8ea6cc1`, merged onto `main` `cecb540a6` (clean), same setup as my run above: - `agc_driver_pixel_lds`: 10 of 10 pass, and 5 of 5 under the validation layer with 0 `VUID-`. - `agc_driver_pixel_lds_limit`, validation: 3 of 3 pass, 0 `VUID-`. - the other 21 tests matching `lds|shader_memory|request_serializer`, validation: 21 pass, 0 `VUID-`. - `request_serializer` and `agc_shader_memory` pass. On this card the budget works out to 4 GiB / (128 × 48 × 32 × 4) = 5461 dwords, so the threshold stays at 4096 and the 4090 takes the same path as before; only cards with more than about 170 SMs get a lower one. The dword count is part of the request and the cache key, so a shader cached on one card is not reused on a card with a different threshold. AI-assisted: yes (Claude Code)
mazen320 commented 2026-10-21 16:11:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-21T16:11:52Z.


Thanks for the retest. Agreed on the 4090 staying at 4096 (5461 budget), and on the cache key carrying the dword count so cards with different thresholds do not share variants.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6320672141 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6320672141). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-21T16:11:52Z. --- Thanks for the retest. Agreed on the 4090 staying at 4096 (5461 budget), and on the cache key carrying the dword count so cards with different thresholds do not share variants.
janzezno commented 2026-10-22 15:32:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-22T15:32:55Z.


@mazen320 #9185 adds a condition to the same libraryKeys early return as this PR: || FragmentInterlock(shaders) after SplitsAlternateAlpha(state), which keeps a pipeline whose fragment shader uses an interlock out of graphics pipeline libraries. The two conditions are independent, and the merged line keeps both:

... || SplitsAlternateAlpha(state) || FragmentInterlock(shaders) || std::ranges::any_of(shaders, [](const CompiledShader& shader) { return shader.program != nullptr && shader.program->functionLdsBuffer; })) return false;

Neither PR depends on the other, so I'd propose no Depends on in either and that the one that merges second rebases onto the first. If #7888 lands first, I'll rebase #9185 and keep your condition. Is that OK with you?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6344647059 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6344647059). Originally posted by [janzezno](https://github.com/janzezno) on 2026-10-22T15:32:55Z. --- @mazen320 #9185 adds a condition to the same `libraryKeys` early return as this PR: `|| FragmentInterlock(shaders)` after `SplitsAlternateAlpha(state)`, which keeps a pipeline whose fragment shader uses an interlock out of graphics pipeline libraries. The two conditions are independent, and the merged line keeps both: ```cpp ... || SplitsAlternateAlpha(state) || FragmentInterlock(shaders) || std::ranges::any_of(shaders, [](const CompiledShader& shader) { return shader.program != nullptr && shader.program->functionLdsBuffer; })) return false; ``` Neither PR depends on the other, so I'd propose no `Depends on` in either and that the one that merges second rebases onto the first. If #7888 lands first, I'll rebase #9185 and keep your condition. Is that OK with you?
mazen320 commented 2026-10-22 15:35:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-22T15:35:27Z.


@janzezno Agreed — independent conditions, no Depends on either way. Whichever of #7888 / #9185 merges second rebases and keeps both SplitsAlternateAlpha / FragmentInterlock / functionLdsBuffer on the libraryKeys early return. If #7888 lands first, your rebase plan looks right.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6344701521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#issuecomment-6344701521). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-22T15:35:27Z. --- @janzezno Agreed — independent conditions, no `Depends on` either way. Whichever of #7888 / #9185 merges second rebases and keeps both `SplitsAlternateAlpha` / `FragmentInterlock` / `functionLdsBuffer` on the `libraryKeys` early return. If #7888 lands first, your rebase plan looks right.
adriadam10 commented 2026-10-23 15:50:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T15:50:41Z.

Review: CHANGES_REQUESTED


Thanks, the sticky flag, the FRAGMENT_SHADER → TRANSFER barrier, the NVIDIA-only scope, the documented full-screen limit and the overflow case in PixelLdsLimit.cpp all look right in d2844b496. One point is left:

  • Draw.cpp:129-143 (PreparePixelFunctionLds): the memory type is now DEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT whenever one exists, and the allocation is up to min(2 GiB, maxStorageBufferRange). On NVIDIA without Resizable BAR that type lives in the 256 MiB BAR heap, so vkAllocateMemory fails with VK_ERROR_OUT_OF_DEVICE_MEMORY and Check throws; the previous host-visible type is never tried. Please fall back to the plain host-visible/coherent type when the device-local one fails to allocate (or only pick it when its heap is at least bytes), and keep the failed buffer state clean as the existing failure path does.
  • Please re-run agc_driver_pixel_lds and agc_driver_pixel_lds_limit on an NVIDIA card after that change; the runs listed in the thread predate d2824e28d (the memory-type commit), and the overflow case only runs on the buffer path, which neither lavapipe CI nor RADV exercises.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5630838276 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#pullrequestreview-5630838276). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-23T15:50:41Z. **Review:** CHANGES_REQUESTED --- Thanks, the sticky flag, the `FRAGMENT_SHADER` → `TRANSFER` barrier, the NVIDIA-only scope, the documented full-screen limit and the overflow case in `PixelLdsLimit.cpp` all look right in `d2844b496`. One point is left: - `Draw.cpp:129-143` (`PreparePixelFunctionLds`): the memory type is now `DEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT` whenever one exists, and the allocation is up to `min(2 GiB, maxStorageBufferRange)`. On NVIDIA without Resizable BAR that type lives in the 256 MiB BAR heap, so `vkAllocateMemory` fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY` and `Check` throws; the previous host-visible type is never tried. Please fall back to the plain host-visible/coherent type when the device-local one fails to allocate (or only pick it when its heap is at least `bytes`), and keep the failed buffer state clean as the existing failure path does. - Please re-run `agc_driver_pixel_lds` and `agc_driver_pixel_lds_limit` on an NVIDIA card after that change; the runs listed in the thread predate `d2824e28d` (the memory-type commit), and the overflow case only runs on the buffer path, which neither lavapipe CI nor RADV exercises.
adriadam10 commented 2026-10-23 16:27:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T16:27:58Z.

Review: CHANGES_REQUESTED


The full Build on the exact head fails on Windows: agc_shader_memory (run 39983298976) exits with RequestSerializer: unexpected trailing data. main does not fail it.

  • core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp: version 45 appends 5 bytes (largePixelFunctionLdsBuffer bool + pixelFunctionStorageDwords u32) after the fused-arithmetic flag, so every legacy fixture has to drop 5 more bytes. The fixtures that only add resize(size() - sizeof(std::uint32_t)) drop 4 and leave one byte behind, which Deserialize rejects for version >= 21. Compare orderedVersion32 (:5259-5261, resize + 2 pop_back before the require) with version32 (:5295-5298, resize + 3 pop_back for the same tail layout); orderedVersion34, version36, version35 and the legacyBytes loop at :5407-5410 need the same check. Rerun agc_shader_memory on the final head, as the last runs in the thread were of the two pixel LDS tests only.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5631349745 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7888#pullrequestreview-5631349745). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-23T16:27:58Z. **Review:** CHANGES_REQUESTED --- The full Build on the exact head fails on Windows: `agc_shader_memory` (run 39983298976) exits with `RequestSerializer: unexpected trailing data`. `main` does not fail it. - `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp`: version 45 appends 5 bytes (`largePixelFunctionLdsBuffer` bool + `pixelFunctionStorageDwords` u32) after the fused-arithmetic flag, so every legacy fixture has to drop 5 more bytes. The fixtures that only add `resize(size() - sizeof(std::uint32_t))` drop 4 and leave one byte behind, which `Deserialize` rejects for version >= 21. Compare `orderedVersion32` (`:5259-5261`, resize + 2 `pop_back` before the require) with `version32` (`:5295-5298`, resize + 3 `pop_back` for the same tail layout); `orderedVersion34`, `version36`, `version35` and the `legacyBytes` loop at `:5407-5410` need the same check. Rerun `agc_shader_memory` on the final head, as the last runs in the thread were of the two pixel LDS tests only.
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!7888
No description provided.