feat(shader): raise the sampler and sampled-pair limits past the 32-bit sampler masks #10000
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10000"
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 EagleBearerYS on 2026-10-23T03:35:18Z.
What
With #9749, Ratchet & Clank: Rift Apart (PPSA01474) gets past
LoadAddressU32@pc=0x13bc0. It then stops onShaderRecompiler::Recompile: sampler resource limit exceeded, in compute 0x116bb61900 in game and in the captured requests 0x116bb67b00 and 0x116bb5e100. Tamalero counted the shaders' resources with the caps lifted (comment):Sixty of the samplers are indirect columns of one per-lane table, which differ in chase depth and in the S#'s offset in the record. The other three are direct S#s. No sharing gets them under 32, and the pairs are over 64 as well.
Why 32:
MaxSamplers = 32is the width of the image-to-sampler masks, which arestd::uint32_twith1u << element.DescriptorBindingBuilder's sampler masks,DescriptorBinding::imageSamplersandtableSamplerMasks.Sampler.cpp's filter-minmax, degamma, border-swizzle and non-seamless-cube checks, which loopelement < 32u, andShaderResources.cpp's sampler-source loops.The change:
std::uint64_tin the recompiler, the serialized artifact and the driver. The driver's per-image loops walk set bits instead of 32 elements.MaxSamplers: 32→64. That'sRuntimeAbi::SamplerHeapCapacity, theShaderDatasampler metadataBindingAllocatoralready caps every shader at.MaxSampledPairs: 64→256. Nothing sizes an array by it.static_assertguards the resource-indexed shift, and the element-mask capacity check compares against 64 with its old text.FormatVersionto 52, since serializedimageSamplerswidens.The next limit, stated in the shader debt file:
ShaderDataholds 64 sampler metadata elements, and each direct sampler takes two of them (the original and a point copy). So a shader can have at most 64 samplers in all, and at most 32 direct ones ("shader sampler pairs exceed runtime heap capacity"). Rift Apart fits by one. More would need a largerShaderData, a runtime-ABI change with a per-draw cost, and wider masks.Cost: each mask is 8 bytes instead of 4, and the content key holds one more word per image. In a synthetic micro-benchmark of the driver's per-image loops (
g++ -O3, 64 images per draw, the old and new loop bodies), the common two-bit masks went from about 4.7 µs to about 0.2 µs per draw, because the new loops visit only set bits. Fully set 32-bit masks were unchanged within noise. This is not a driver run.Overlap:
FormatVersion:mainis at 51 since #6959 (JJenkx). Ours take one number each: #10000 52, #10489 54, #7642 62, #7395 63, #8939 66, #9457 67, #9633 70, #9790 71, #9749 72 and #9969 73. The other open PRs seen changing it hold 50 (#9508, #12944), 51 (#7223, #14944), 58 (#14853), 65 (#14032), 68 (#14636) and 69 (#14871). So the conflict is the one line, plus the shader debt entries those PRs add next to the image-table entry this one edits. Keep both, and whichever lands second takes the next free number.FormatVersion, it conflicts inDescriptorBindingBuilder::Populate, where it addsAtomicImageKindandimageAtomic64on the lines next to this PR'sstd::uint64_tmask, and in one line of the AGC driver's debt file. Keep both.set_tests_propertiesline in the AGC driver'sCMakeLists.txt. #9989 went first, and this PR's merge ofmain85f8e11372keeps both PRs' names.main, none of these files conflicts.Tested
test/9749-sampler-masks(b340d224db, this change on #9749's headb2d4afc64d) (comment):sampler resource limit exceededat #9749's head (0x116bb67b00, 0x116bb5e100, and 0x116bb5ad00, the in-game stop) plan with this change. They then stop evaluating runtime sources whose guest memory thepreparerequests don't carry, which is the replay's limit, not a refusal.AGC driver: invalid shader memory read address) and at 1,170 s on compute 0x116bb75900 (runtime image descriptor is invalid). Those are shaders that now get further, stopping on the values they resolve, not on a limit this PR sets. They're being traced on #9749.agc_shader_sampler_limits(tests/ShaderMemory.cpp, beside #7527's selected-records tests):agc_driver_many_direct_samplers(new,tests/execution/ManyDirectSamplers.cpp, on lavapipe): 17 direct samplers bound as 33 sampler elements, with the last one at element 32.main's product files, both fail 20/20:sampler resource limit exceededandprepared sampler mask capacity exceeded. Green: 20/20 each.MaxSampledPairs. They now sample each read through 8 samplers, so they reach 256 pairs within the 64-image limit. All four pass.main's product code. The reds above come from reverting the product files alone on a cloud Linux machine.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandANYPS5_NO_SHADER_CACHE=1on llvmpipe (LLVM 20.1.2), GitHub's Linux runner. The run includesagc_driver_many_direct_samplers,agc_driver_image_tableandagc_driver_bindless_images.main's tree and 5 with the change, which adds a test.VUID-VkDeviceCreateInfo-pNext-pNext, so the change adds noVUID-message.agc_driver_sgpr_pattern_fill_keystiming flake under--parallel 4.sampler resource limit exceededin Tamalero's runs above; its next stops are listed there.main0db47b263d. The only conflict wasShaderDiskCache.hpp'sFormatVersionline:mainmoved to 45 (#7831), and this branch keeps its 49. On GitHub's runners (run), the new tests and the shader, image-sample and disk-cache sets (19 tests) pass 10 runs in a row on Linux. On Windows the set has 21, with two Windows-only disk-cache tests: they build, 19 pass 10 runs in a row, and the other 2, which need a Vulkan device, skip. The libc and libkernel suites pass on both, run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.check_conventions.py: passes. The one warning is the image-table debt entry's length: it's already over the limit onmain(1,067 characters) and is 1,068 here. No comment lines are added.0db47b263d, thesampler,selected_records,image_sampleanddisk_cachetests, three runs each with and without the Khronos layer. The base passes 18 of 18 and this PR 20 of 20 in every run.agc_driver_many_direct_samplersruns there, with no skip. Under the layer neither side logs aVUID-line.agc_shader_replay --preparewithANYPS5_NO_SHADER_CACHE=1on the request the driver dumped, RTX 4090, Windows 11; replay only, no title run. Every build ismain513ca7e55with #9068, #8070 and #9701 to #9703.GetImageResourcerefusal and stops onsampler resource limit exceeded; #9969's stack alone stops there too.image resource limit exceeded, the 64-image cap (MaxImages).ANYPS5_NO_SHADER_CACHE=1; replay only, no title or GPU run. Onmain0db47b263with #9068, #8070 and #9703, with #8939 (9162d9df8) and this PR (51a0116de), it gets pastsampler resource limit exceededand stops on another image load,LoadAddressU32@pc=0x0002ef78, whose pointer Phi has an arm read at a fixed offset of a buffer whose V# is loaded from memory. With #8939 alone it stops on the sampler limit.agc_shader_replay --prepareof the request the driver dumped for it, RTX 5090, Windows 11, WinLibs GCC 15.2.0, Release,ANYPS5_NO_SHADER_CACHE=1, one run per build; replay only, no title run. The base ismain0db47b263with #9068 and #9703.GetImageResource dword 0 is not a valid runtime valueatLoadAddressU32@pc=0x000036f8. With #9969's branch (the stack from #7223 through #9969) it gets past that and stops onsampled image/sampler pair limit exceeded.FormatVersionrenumbered to 51 for the stack; the replays run without the shader cache), it gets past the pair limit and stops on a deeperGetImageResourcechain atLoadAddressU32@pc=0x00014724, through a buffer whose V# is itself read through a pointer at0x00013a4c. That's the shader's next stop, not this PR's.test/9749-sampler-masks(b340d224db): one 600 s run from a cold shader cache withAPS5_DUMP_IR=all. Nosampler resource limit exceededline, nowhat()or terminate and no stop line: it ran the whole 600 s. 7840 IR blocks were dumped. The highest shader pc is 0x1f2c8, and 980 block lines are at or past 0x13bc0. This covers that branch, not this PR's current head.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,mainb84322da6against this PR's head12b89239c7merged onto it,ctest -R "agc_shader_memory|agc_shader_selected_records|agc_shader_bindless|agc_shader_disk_cache|image_sample|sampler|agc_driver_image_table|agc_driver_bindless_images":main30 of 30 pass; this PR 32 of 32, the newagc_driver_many_direct_samplersandagc_shader_sampler_limitsincluded. The run didn't request the validation layer (correction). The-9fromvkCreateInstancewith the layer requested (#10663) came from a leftoverVK_DRIVER_FILESin the shell, and the layer works on that machine; its run is the next bullet.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,main2fade7ef4eagainst this PR's headd6061d4ce2merged onto it. Each test ran on its own withVK_KHRONOS_VALIDATION_LOG_FILENAMEset, and the layer's log file shows it loaded in every test that creates a Vulkan instance: 18 onmainand 19 with this PR.main30 of 30 pass and this PR 32 of 32, the newagc_driver_many_direct_samplersandagc_shader_sampler_limitsincluded. Neither arm has aVUID-message.d6061d4ce2, a merge ofmainc9b2660d56. The only conflict wasFormatVersion:mainmoved to 47 (#7550), and this PR goes from 49 to 52. Its own diff is otherwise unchanged. On GitHub's runners, 10 runs (run) of the sampler, selected-record, image-sample, disk-cache and shader-memory tests (^.*sampler,^.*selected_records,^.*image_sample,^.*disk_cache,agc_shader_memory), 21 tests on Linux, and the 10 other shader tests built from the changed files: Linux: 31 run, 31 pass, 0 skip, 0 fail. Windows: 33 run, 21 pass, 12 skip (no Vulkan device), 0 fail. The libc and libkernel suites pass on both, run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.d82e3f9552, a merge ofmain16ff208dc3(run).main's #10440 records each element's 64-bit image atomics on the line before the sampler mask this PR widens to 64 bits; the merge keeps both, and this PR's changed lines are the same.FormatVersiononmainis still 47. The sampler, selected-record, disk-cache and image-table tests pass 10 runs in a row. Linux: 26 run, 26 pass, 0 skip, 0 fail. Windows: 28 run, 22 pass, 6 skip (theagc_driver_image_tabletests, no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (144 and 207) and on Windows (171 and 223). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.12b89239c7merged intotest/9749-null-storage(#9749 and #10906). Without this PR that branch stops at 214 s onsampler resource limit exceeded; with it, the run gets past #10906's 1,300 s stop and runs to 2,632 s, where a different compute shader, 0x116bb6ef00, stops onGetImageResource dword 0 is not a valid runtime value. That stop is outside this PR.fe85d6c4e3, a merge ofmain85f8e11372(run).main's #9989 adds its three result-memo budget tests to the Windowsset_tests_propertiesline incore/libs/prx/libSceAgcDriver/CMakeLists.txtwhere this PR addsagc_shader_sampler_limits; the merge keeps all four.FormatVersiononmainis still 47, and this PR's other changed lines are the same. Theagc_shader_tests with the tests built from the files the merge changes pass 10 runs in a row. Linux: 320 run, 310 pass, 10 skip (seven AGC tests on lavapipe and three video-out tests with no display or Vulkan device), 0 fail. Windows: 346 run, 259 pass, 87 skip (84 AGC tests and the same three video-out tests, no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (145 and 211) and on Windows (174 and 232). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.aa94587021:23194a4002, a merge ofmain0c5401dcbd, and two test-only commits (run).mainmovedFormatVersionto 48, the one conflict; this PR stays 52, which no other open PR uses (see Overlap). Its other changed lines are the same.8a7c326523drops the two refusal checks @oneandonlydean listed:agc_shader_sampler_limits' "65 samplers, 306 pairs and 33 direct samplers are refused" block andagc_driver_many_direct_samplers' opaque-black-border refusal. The widened-mask and 64-sampler cases and the point-clamp control stay.aa94587021makesagc_driver_many_direct_samplersskip on a device that binds fewer than 33 samplers per stage or per set. @jotitadev's run on an Apple M2 Max with MoltenVK (review) showed MoltenVK reports 16 samplers per stage, somain's per-stage check refuses the test's 33 sampler elements with or without this PR.agc_driver_image_table,agc_driver_many_direct_samplersandagc_driver_sample_order; no Vulkan device), 0 fail.exec_arguments,guest_timed_join_import_libkernel_sysandguest_timed_join_import_libkernel_webfail at their setup in the verify's Windows build (FileNotFoundErrorstarting the title, or copying the libraries they load), and pass inmain's own Windows job at1829def9bf(job). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.7f4e97c45f, a merge ofmain94fe1b5c5a(run).mainnow has #11507 (hugodearaujo's short-cube sampling), which takesFormatVersion49 (b9f4f65904); that line was the one conflict, and this PR keeps its 52 (see What). #11507 also adds anImageResourcefield,sampledOnly, whichShaderDiskCache.cppencodes without a conflict. This PR's diff overmainis the same apart from theFormatVersionline's old value. The sampler-limit, image-table and sample-order tests with the disk-cache, bindless and shader-memory tests and #11507'sagc_driver_image_sample_short_cuberan 10 times with no failure. Linux: 26 run, 26 pass, 0 skip, 0 fail. Windows: 28 run, 24 pass, 4 skip (the Vulkan device tests), 0 fail. Suites: libc and libkernel pass on Linux (166 and 265). On Windows libc passes (194), and libkernel passes 284 of 287:exec_arguments,guest_timed_join_import_libkernel_sysandguest_timed_join_import_libkernel_webfail at their setup in the verify's Windows build (FileNotFoundErrorstarting the title, or copying the libraries they load), withmain's code too, and pass inmain's own Windows job at1829def9bf(job). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.agc_shader_replay --materialize; Windows 11, RTX 3080 (driver 616.92). It covers CPU preparation of the capture only: no Vulkan pipeline was created or dispatched.main08a10d2253it fails withsampler resource limit exceeded.7f4e97c45fmerged onto thatmain(a clean merge), it prepares and materializes 5,573,305 SPIR-V words.VK_LAYER_KHRONOS_validation,ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1,agc_shader_bindless, the fouragc_shader_selected_records_*limit tests,agc_driver_bindless_images,agc_driver_image_sample_reductionandagc_driver_image_tablepass on both sides, and this PR'sagc_shader_sampler_limitsandagc_driver_many_direct_samplerspass. No VUID errors on either side.a803318e65, a merge ofmain0836dfdf4f(run, on 75d57e91db, which has the same tree). #12862 movedlibSceAgcDriver's test registrations intotests/cmake/; the conflict inCMakeLists.txtis resolved withtools/agc_test_split.py resolve, which moves this PR's registration ofagc_shader_sampler_limitsintotests/cmake/agc_shader_memory_tests.cmake(+3 −2). Nothing else conflicted. Apart from the move, this PR's diff is unchanged. With-DBUILD_TESTING=ON,ctest -Ngives 3077 tests:main's 3075 plus its 2 tests (agc_driver_many_direct_samplerscomes from the execution-test glob), each listed once. The 9 tests of this PR's verify set pass 10 runs in a row. Linux: 9 run, 9 pass, 0 skip, 0 fail. Windows: 9 run, 7 pass, 2 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (199 and 308) and on Windows (226 and 330). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.760a550294, a merge ofmain88e804b0a7(run).mainnow has Ondra97's #7694 (scalar-address descriptor Phis), which addsDescriptorSource::requiredBlocksto the shader plan encoding, and JJenkx's #6959, which movesFormatVersionto 51. The one conflict wasFormatVersioninShaderDiskCache.hpp:mainmoved to 51, and this PR keeps 52 (see Overlap). Git merged the rest without conflicts, including this PR'sagc_shader_sampler_limitsregistration beside #7694'sagc_shader_descriptor_phisinagc_shader_memory_tests.cmake. This PR's diff overmainis the same apart from theFormatVersionline's old value. The sampler-limit, selected-record, disk-cache and shader-memory tests, withagc_driver_image_sample_reductionandagc_driver_many_direct_samplers, pass 10 runs in a row. Linux: 11 run, 11 pass, 0 skip, 0 fail. Windows: 13 run, 11 pass, 2 skip (agc_driver_image_sample_reductionandagc_driver_many_direct_samplers; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.ba833f42c0: the pair-limit tests check the merge without compiling it, for @XairRrR's review (review), which timed them at about 38 s each when run alone, over the 30 s per-test limit. They read only the plans and the merged table's snapshot, but compiled the merged request too, which holds 264 image samples past the 256-pair limit. With SPIRV-Tools on, that compile was the time: at760a550294each took 11.9 to 13.6 s on GitHub's Linux runner, and 0.29 to 0.43 s there with SPIRV-Tools off (run). They now take the capture alone; the image-limit tests still compile theirs. On GitHub's runners (run), the two pair-limit tests take 0.05 to 0.14 s on Linux and 0.12 to 0.18 s on Windows, and this PR's tests pass 10 runs in a row. Linux: 11 run, 11 pass, 0 skip, 0 fail. Windows: 13 run, 11 pass, 2 skip (agc_driver_image_sample_reductionandagc_driver_many_direct_samplers; no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (210 and 310) and on Windows (237 and 331). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)FormatVersion: no other open PR uses 52 (see Overlap)sampler resource limit exceededafter #9749 (Tamalero's runs and oneandonlydean's 600 s run under Tested); its next stops are listed there; Ghostrunner (PPSA03685) #7320: compute shader 0x200c520000 pastsampler resource limit exceededwith #8939 and #9969, in frankea's replay (its next stop is the 64-image limit); My First Gran Turismo (PPSA24156): compute program 0x1258c12300 pastsampler resource limit exceededin Rengundom's replay (CPU preparation only)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T04:36:43Z.
Review: APPROVED
Reviewed the exact head and traced the widened sampler masks through descriptor planning, materialization, disk-cache encoding/content keys, driver iteration and image-table replay. The capacity check limits shifts to 64 bits, the loops enumerate only set bits, and the cache format change covers the serialized element width. The added CPU and llvmpipe tests exercise >32-bit masks, border/de-gamma handling, refusal paths, 64 samplers/256 pairs and the 17-direct-sampler execution case. CI eligibility/intake/conventions/labels/report pass; hosted product jobs are skipped by path policy. I could not independently run the Vulkan/GPU suite here, and the PR explicitly lists the Ratchet & Clank replay as pending, so I am not treating a title unblock as verified.
check_conventions.pyandgit diff --checkpass locally. No blocking issue found in the reviewed implementation.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:30:32Z.
Review: CHANGES_REQUESTED
Updating my earlier review: that approval covered the prior
maintip, but the exact PR head is now 394 commits behind currentmain.tools/check_main_sync.py --base upstream/main --head refs/reviews/pr-10000reports six touched files changed on both sides since merge base, includingShaderResources.cpp,ShaderMemory.cpp,ResourceMaterializer.cpp,Recompiler.hpp,ShaderDiskCache.cppand the AGC CMake target; the merge is clean, but these areas need integration review against current behavior. Please refresh from currentmain, preserve the sampler-mask and cache-format changes alongside newer edits, then rerun the required focused shader/AGC tests on both currentmainand the refreshed change withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1, andANYPS5_REQUIRE_VULKAN=1usingctest -Von the same machine/GPU. Compare the logs for newly introduced VUIDs and report GPU/driver/OS. I could not run those tests here: this checkout has no build directory and this host exposes no Vulkan tooling. The Ratchet & Clank replay remains explicitly pending in the PR body, so keep the title-unblock claim unverified until that run is reported. This request is for current-main integration and required validation, not PR volume.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T09:32:29Z.
Review: COMMENTED
Apple GPU run, through #10489's head
0fd6998a10, which contains this PR'sfe85d6c4e.agc_driver_many_direct_samplersfails on MoltenVK: the driver refuses the layout at the device's per-stage sampler limit, and it does that with or without this change.Setup: Apple M2 Max, macOS 27.2, x86-64 Release under Rosetta 2.
maindoesn't build and run on macOS, so this ismainb87d3d87e2+ the macOS port PRs (#7631 #11249 #11358 #10669 #10552 #7804 #11447 #11437 #11554) + one local patch (#11705's), with #10489 merged on top. The only conflict wasFormatVersion, which I resolved to 54. Two drivers: MoltenVK 1.4.2 from Vulkan SDK 1.4.363.0, and MoltenVKmainwith SPIRV-Cross#2704.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,ctest -j1 --timeout 30.maxPerStageDescriptorSamplers = 16, which is Metal's per-stage sampler limit; its update-after-bind sampler limit is 1024. The test's 17 direct samplers need 33 sampler elements.ShaderResources.cppchecks the direct sampler binding againstmaxPerStageDescriptorSamplers, so the draw is refused before it records. That check is already inmain, not added by this PR.MaxSamplersset back to 32 (andMaxImagesto 64), the test fails with the same text, 3 of 3 on both drivers. On a 16-sampler device, the test can't tell the change frommain.agc_shader_sampler_limits, the selected-records limits, the sampler, image-sample, image-table and disk-cache sets: 25 of 28 pass 3 of 3 on both drivers, with 1 skip. The other two failures areagc_driver_image_table_reuseand_reuse_draw_pipeline, known failures on macOS that also fail on the base. With the validation layer, the only VUID isVUID-vkCreateDescriptorSetLayout-support-09582, from the image-table layouts (KhronosGroup/MoltenVK#2573). It also shows up on the base.^agchas the same failures as the base on both drivers, plusagc_driver_many_direct_samplers, which doesn't exist on the base. The MoltenVKmainsuite run also had oneagc_driver_lds_subword_store_branchfailure (thread 96 (wave 3) read 673754884, expected 262176). That test passes 5 of 5 alone and is the LDS-barrier test that #10858 targets, so it isn't from this change.Suggestion: gate the device test on
maxPerStageDescriptorSamplers >= 33and skip with a message otherwise, like the tests that skip without a feature. Another option: on a device below 33, assert that the refusal names the limit. As it stands, the test fails on every macOS run. It also means that on Apple GPUs a shader whose direct sampler binding needs more than 16 elements (originals plus point copies) can't bind, whateverMaxSamplersis. Rift Apart's 3 direct samplers fit.GPUs tested: Apple M2 Max (MoltenVK 1.4.2 / MoltenVK main + SPIRV-Cross#2704), macOS 27.2
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T04:01:01Z.
Review: CHANGES_REQUESTED
Re-checked — new head, changes requested
The new My First Gran Turismo replay is useful, but its comparison uses
mainat08a10d2; the current-main merge contains later changes in two PR-touched files that the report does not validate.What I ran
7f4e97c45f75a01a765fecd34ab036c797e54102; PR base:94fe1b5c5a32ae97b43b65c6563a5b07fc91b721.main5ecef095b61e7a406b279c97896f3a8a6fbd6353; merge preview was clean, tree229c7c18beca2861ac7af95071d9e844822244a9.Results
229c7c18beca2861ac7af95071d9e844822244a9git diff --checkdocs/dev/debt/shader.mdhas a 1,068-character entryShaderMemory.cppandRecompiler.hppchanged; the latter changesimageSamplersfromuint32_ttouint64_t0x1258c12300succeeds with the PR wheremain08a10d2stopped at the sampler limit. Matched focused Windows RTX 3080 validation tests report no VUIDs on either arm. The report explicitly does not dispatch the new Vulkan pipeline.Unedited local command output
git diff --checkand the two-file comparison exited 0 with no output.Findings
Blocking
Please rerun the focused sampler-limit/AGC tests on the current-main merge, with
mainand the merged PR tested on the same GPU underVK_LAYER_KHRONOS_validation,ANYPS5_REQUIRE_VULKAN=1, andANYPS5_NO_SHADER_CACHE=1. The 08a-based replay does not cover the laterRecompiler.hppsampler-pair type change or theShaderMemory.cpptest refactor, so it cannot establish the result on today's integration.Non-blocking
The My First Gran Turismo capture demonstrates CPU-side preparation only; it does not verify Vulkan pipeline creation or GPU execution for that shader.
Sources
Recompiler.hppat main5ecef095ShaderMemory.cppat main5ecef095Not verified
I did not run a local build, GPU tests, or the replay. The hosted Linux product job is skipped, and the contributor report does not execute the captured shader on the GPU.
To get this to a good state
Run the same focused tests on current
mainand on its clean merge with this PR, on the same GPU and driver with the stated validation environment, then report both exact revisions, test counts, VUID comparison, GPU, driver, and OS. I will rerun the non-build checks and reassess the new head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T05:54:57Z.
Review: APPROVED
Re-checked — current-main validation, looks good
The matched validation run found no new failing tests or validation IDs, and the current-main merge is clean.
What I ran
Reviewed PR head
7f4e97c45f75a01a765fecd34ab036c797e54102against currentmain7440a6c9ca3dc90ee81413f6c948ed5c0304fa56; the merge preview is clean (5773930b86e3b3f98c7b9a91706794fd50c701c9). Environment: local Linux x86-64; no local compiler, build, or tests were run. I inspected the contributor's matched run separately; it used Linux/Ubuntu 24.04.5, llvmpipe (Mesa 25.2.8), and the Vulkan validation layer.Results
422f96b3a9; none of the eight PR-touched paths changed between that commit and current main7440a6c9caagc_driver_image_tabletest failed in both due to the existingVUID-VkDeviceCreateInfo-pNext-pNext; the two PR-specific tests passed and the run reports no new failures or VUID IDsUnedited check output
Findings
Blocking
None. The earlier validation concern is addressed by the matched baseline/merge run, and the one failure is the same on both arms.
Non-blocking
The conventions check reports a debt-length warning. The Linux comparison's single baseline failure is due to the validation layer not recognizing
VkPhysicalDeviceMaintenance8FeaturesKHR; it remains a failed test in both arms, rather than an all-pass run.Sources
Not verified
I did not run local tests, a build, a GPU run, or console behavior. The matched Linux and Windows results are contributor-provided and linked above. The hosted Linux product and specialized jobs are skipped by workflow policy. The run's author-reported mutation controls were not independently reproduced.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T21:29:52Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The widening of the image-to-sampler masks to 64 bits is correct and does what the PR says, but the two reworked selected-records pair-limit tests now take about 38 s each when run alone here, against 5–6 s on
main, which is over the project's 30 s limit per test.What I ran
Head
760a55029427f45d4bf438e855369b1b596f0b27,main9090972b7e91fd266819cbd77a8b058e177b5682, merged treedf2c89e223ca19988f76b7a8b752c002ef709a8d(Release, GCC 14.2.0, Ninja,BUILD_TESTING=ON). Debian 13 VM, 32 vCPU Xeon Gold 6136, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19), no GPU.Results
maingit diff --checkcheck_conventions.pydocs/dev/debt/shader.mdis 1,068 characters (it is already over the limit onmain, as the PR says)libsmainVUID-.layer_missing_inis emptyagc_shader_selected_records_pair_limit, alonetime, almost all of it user CPU on one threadagc_shader_selected_records_direct_pair_limit, alonemain's test file and production codeagc_shader_sampler_limitsagc_driver_many_direct_samplersTiming of the pair-limit test on the merged tree (run alone, twice)
Negative control
I restored the 11 production files from
main(Sampler.hpp/.cpp, ShaderResources.cpp, ShaderInfo.hpp, DescriptorBindingBuilder.hpp/.cpp, ResourceMaterializer.hpp/.cpp, Recompiler.hpp, ShaderDiskCache.hpp/.cpp) and kept the PR's tests. The test executables built.agc_shader_sampler_limitsfails withsampler resource limit exceeded.agc_driver_many_direct_samplersfails withShaderRecompiler::Recompile: prepared sampler mask capacity exceeded.MaxSampledPairs, so they follow whichever value the build has, which is expected.After restoring the merged files and rebuilding,
git status --porcelainwas empty. This matches the description's "Red" claim.Findings
Blocking
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp:4628-4629in the merged tree (at head).MaxSampledPairs = 256and 8 samplers per read, each test now plans and compiles 32 selected reads × 8 samplers (256 pairs) plus the reads one past the limit. Before, it was 32 reads × 2 samplers.agc_shader_selected_records_pair_limittakes 37.4 s andagc_shader_selected_records_direct_pair_limit37.7 s. That is almost entirely single-threaded user time (38.7 s user for 39.2 s wall).main's versions take 5.4 s and 6.5 s on the same machine. That is about 7× slower, in line with Lander0606's 0.8 s → 4.8 s on the 860M.Non-blocking
12b89239c792still saysFormatVersion is 49and that the test "checks the refusals past the limits: 65 samplers, 306 pairs and 33 direct samplers".8a7c32652309removed those refusal checks, and the tree hasFormatVersion = 52. If the PR is squash-merged, the message should match the final change.agc_shader_sampler_limits(51 images, 63 samplers, 112 pairs) takes about 15 s on this machine. The pair-limit tests grow about 7× for 4× the pairs. It would be worth saying whether per-shader preparation cost grows faster than linearly in sampled pairs, since raising the cap lets real shaders reach those sizes.Things I checked that are fine:
DescriptorBindingBuilder.cpp:575and:672;ResourceMaterializer.cpp:1888and:1927;ShaderResources.cpp:5125and:5381;Sampler.cpphelpers.DescriptorBindingBuilder.cpp:574compares against 64;MaxSamplers≤ 64 is enforced by thestatic_assertatResourceMaterializer.cpp:37;BindingAllocator.cpp:103caps samplers atSamplerHeapCapacity.breakonsampler >= sizeis equivalent to the old bound, and the throwing helpers keep their out-of-rangeRequire.VisitContentKeyandAppendContentKey, andFormatVersionis bumped for the serialized width.FoldOffsetBase,UnnormalizedBaseLevelBase,MirrorUnnormalizedBaseinPipelineSpecialization.hpp:48-51) are 64 wide, so 64 samplers still fit.BindingAllocator.cpp:163,ResourceTracker.cpp:2339and:2467.Earlier reviews:
main.ManyDirectSamplers.cpp(maxPerStageDescriptorSamplers/maxDescriptorSetSamplers< 33 skips).Not verified
To get this to a good state
agc_shader_selected_records_pair_limitandagc_shader_selected_records_direct_pair_limitwell under 30 s, for example by splitting the at-limit and past-limit cases or reducing what is compiled, and report their times onmainand on the change.FormatVersion52, no refusal checks).Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T23:38:24Z.
Review: APPROVED
Re-checked — approved
The new test-only commit
ba833f42c0stops the two selected-records pair-limit tests from compiling the merged request. They now take about 0.1 s each here, down from about 38 s, so my one blocking finding is resolved.What changed since my last review
ba833f42c0(test(shader): check the pair-limit merge without compiling it). It touches onlycore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp.CaptureTable, which runs theShaderMemory::Capturestep thatCompileTablealready runs, without theRecompilecall after it.pairs == true) now use it to get the merged table's snapshot. The image-limit cases still callCompileTable(...).capture.=.ba833f42c0.What I ran
Head
ba833f42c0f43142fbec50d0ee0ef8214c5faa29,main5cb015caaaaf83f8ee431414ee6a457b5b307d49, merged treefe395e2f0abc68a97fa7527ac862747d68937f07(Release, GCC 14.2.0, Ninja,BUILD_TESTING=ON). Debian 13 VM, 32 vCPU Xeon Gold 6136, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19), no GPU.Results
git diff --checkcheck_conventions.pydocs/dev/debt/shader.mdis 1,068 characters, already over the limit onmainlibs(build.json)layer_missing_inis empty. 0 tests with a newVUID-agc_shader_selected_records_pair_limit, alone760a550294)agc_shader_selected_records_direct_pair_limit, aloneagc_shader_selected_records_image_limit/_direct_image_limitagc_shader_sampler_limitsagc_driver_many_direct_samplersThe two failures build.json lists as new are from
main:agc_driver_image_sample_lod_clamp_shader_lanefails with the same message (thread 0 component 1 is 0.000000, expected 0.062500) after the PR's 11 production files are restored frommainand the test rebuilt. The test came intomainthrough #12980, after the failure baseline096c45570f.unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_groupfails onos.chownwithEINVALin the sandbox's/tmp. It is atools/test this PR does not touch, added tomainafter the baseline.Negative control
I restored the 11 production files from
mainand kept the PR's tests:agc_shader_sampler_limitsfails withsampler resource limit exceeded.agc_driver_many_direct_samplersfails withShaderRecompiler::Recompile: prepared sampler mask capacity exceeded.MaxSampledPairs.After restoring the merged files,
git status --porcelainwas empty. I rebuilt the targets, and the 6 tests pass.The new commit removes only the compile from the pair cases. Every
requirethey make is unchanged. The snapshot they check comes from the sameShaderMemory::Capturecall thatCompileTablemakes before it compiles. SeeCaptureTableand its use. The image-limit cases still compile their merged request, so the compile path is still covered.Previous findings
8a7c326523, which says what it removed. The tree and the description describe the final state. I accept that.agc_shader_sampler_limitsstill takes 16 s here because it compiles. That is under the limit, and the author reports 2.9 to 5.9 s on GitHub's runners.New findings
Blocking
None.
Non-blocking
None.
Not verified