test(agc): validate pixel LDS and expose pipeline statistics #601
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/601"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by nicolasabosch on 2026-10-05T02:13:12Z.
What
Pixel shaders emulate LDS with per-invocation storage. #586 reduces its allocation, but the execution tests currently exercise LDS only in compute shaders. This adds a standalone pixel LDS regression and opt-in driver statistics so the same fixture can check results and inspect the compiled pipeline.
agc_driver_pixel_lds: a fullscreen 64x32 draw fills three LDS banks at byte offsets 0, 256 and 512 using pixel-dependent permutations, then reads them through a different dynamic index. Each pixel has distinct data. The CPU checks all three results, RGBA coverage and an untouched output-stride guard. Guest wave32/wave64 and statically bounded/unbounded read addresses each run three times: 12 draws, 24,576 pixels and 73,728 checked LDS results per execution. The statically unbounded case has valid runtime addresses.APS5_PIPELINE_STATS=1: enableVK_KHR_pipeline_executable_propertiesandpipelineExecutableInfo, capture statistics when creating graphics and compute pipelines, and print each executable's stages, subgroup size, statistic values and driver descriptions. Missing support or Vulkan query errors throw. All four statistic formats are handled. Raw driver values are preserved; the setting is off by default.This PR contains the fixture and diagnostic support only. The implementation from #586 was applied on a separate local comparison branch and is not included here. This PR can merge independently of #586.
Tested
Windows 11 Pro, MinGW-w64 GCC 15.2.0 (supported WinLibs release), Ninja Release build,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON,ANYPS5_REQUIRE_VULKAN=1. NVIDIA GeForce RTX 4070 Laptop GPU, driver 616.92, native subgroup size 32. Synthetic RDNA shader fixture; no commercial title or native 64-lane hardware tested.Validation:
cmake --build build --parallel 10: passed.cmake --build build --target libs --parallel 10: passed.ctest --test-dir build --output-on-failure: 229/229 passed, no skips (158.61 s), statistics disabled.APS5_PIPELINE_STATS=1,ctest --test-dir build -R '^(agc_driver_pixel_lds|agc_driver_lds_atomics64)$' -V: 2/2 passed (3.88 s). Logs contain VS, FS and CS executable statistics; rendering and the 64-bit compute LDS atomics checks pass.agc_shader_memorytest passes as well.Independent comparison: current main
ebf29f8dplus this fixture/diagnostic against the same code plus #586 head3abf1074:All 73,728 results passed on both versions. Every case's statistic was stable across its three draws. Binary inspection of the optimized SPIR-V confirms the bounded module changes only the array-length constant, 8192 to 192. The unbounded modules are byte-identical (SHA-256
fc98e3fc653751d5067a07a07b5f98055de6786fb94ffeef791f05ef4486d4bb).The Windows driver reports
0x10in the high 32 bits of Local Memory Size even for the vertex executable with no local memory. A matching NVIDIA forum report describes this behavior. The low 32 bits are 32768 and 768 respectively, agreeing with the SPIR-V allocations; these are disclosed as low-bit observations, not reliable absolute driver-reported byte counts. No FPS improvement or reproduction/fix of the title-specific GPU hang is claimed.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T02:47:28Z.
Thanks, a pixel shader LDS test is a good addition; until now only compute shaders exercised it.
I disassembled the shaders with llvm-mc (gfx1013): the vertex shader and both pixel variants decode as described (32 rounds of three
ds_write_b32at offsets 0, 256 and 512, reads aty & 31ory, threebuffer_store_dwordwith a stride guard in the fourth dword), and the expected(y - x) & 31index is right. Since #586 isn't part of this PR, the test is a regression guard and should pass on main as it is.The statistics path is off unless
APS5_PIPELINE_STATS=1is set: without it, no extension or feature struct is added,pipelineInfo.flagsstays 0 as before, and the logging returns on a bool, so normal runs don't change. One small wording point: BUILD.md says it prints statistics for "each newly created graphics or compute pipeline", but the driver's own helper compute pipelines (color transfer, detiler, sample counter, mesh arguments) aren't captured, only the ones built from guest shaders. Saying "guest shader pipelines" would match. That's optional.It merges cleanly with main and with the open PRs that touch the same files. The CI build was still running when I looked; once it's green, it's ready to merge from my side.