feat(agc): look up table images at run time through a device image table on the GPU heap (APS5_GPU_PATH) #7642
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7642"
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-18T19:16:54Z.
What
Shaders that load a T# from an image table at a key they compute (bindless tables, V#-addressed T# arrays) can only be bound today if the CPU snapshots and resolves every table record for every draw: the CPU table path. With large tables that's most of a draw's cost. On a Village-shaped lavapipe bench (a 32,768-record V# table, 256 textures, 850 indirect draws per frame), the CPU table path spends 14.7–16.5 ms per draw in
descriptorsalone, and runs out of memory within 30 s. Lavapipe's 256-byte descriptors make that larger than a GPU driver would, so the title measurement under Pending is the number that counts.With
APS5_GPU_HEAP=1 APS5_GPU_PATH=1, such a T# is looked up on the GPU instead.BindlessHeap::TextureSlot), and the shader samples through that slot.ExpectedDeviceImages) and inserts those keys first. A per-thread memo keeps that at about 4 µs per draw in steady state on the bench.BindlessHeap::TextureSlotand itsNearlyFullmargin as they are. The table takes no slot whileNearlyFullholds and reserves none. Each entry holds its texture, and eachPreparemarks the live entries' slots used in the heap's epoch (92c6dab397), so #9508's idle-slot eviction doesn't take a slot the table serves. The table drops every key whoseSlotGenerationmoved, after the last point inPreparethat can submit and before it uploads.map[HeaderElementBase]in the heap table map, the bucket buffer's device address and the open batch's miss-ring chunk address. They're all zero when no device table is attached, so maps without a table behave as now.ImageTableAbi::Versiongoes 2 → 3, and every heap map carries the trailer, which adds 16 bytes per stage map. A column served by the device table writes no per-element slot parts. Raghav314 agreed to the trailer and the version bump (reply).APS5_GPU_PATH=1turns it on. WithoutAPS5_GPU_HEAP=1and a device withVK_EXT_descriptor_heap, it stays off and says why;APS5_NO_DEVICE_IMAGE_EXPECT=1leaves first uses to the miss ring;[device-images]lines underAPS5_PROFILE_DRAW=1.Credit:
wip/new-gpu-path.d48d173c93) is here under his authorship.3aa9bc59c2,bdea78a4d9,85b3d403d9,aef54d98b3and8cf949d971) name his commits in their bodies.Pending
92c6dab397the table also marks its live slots used each heap epoch, so they leave only through the table's own budget eviction, not #9508's idle eviction.APS5_GPU_HEAP=1 APS5_GPU_PATH=1the Vulkan device was lost in 3 of 3 runs before the title menu stood. With neither switch, the menu stood in both runs.APS5_GPU_HEAP=1alone, and 1,096 with both. SoAPS5_GPU_PATHadds about 70 MB/min, within run-to-run spread. Both runs with both switches stopped at the 2.5 GB commit floor; the run withAPS5_GPU_HEAP=1alone reached menu + 12 min without stopping. A later run on #9508's5645b5be5bwith two heap counters on top (counts) found the heap's holds flat from 2 minutes after the menu appeared: 1,907 slots, 1,490 textures (667 MiB) and 49 storage images (526 MiB), none held only by the heap. Memory still grew 1,149 MB/min. So the growth comes withAPS5_GPU_HEAP=1but isn't the heap's holds; its cause is pending a comparison of where the memory goes with the heap on and off.Limitations
VulkanDevice::Drawoutside the driver with device-table results isn't served, soagc_driver_image_table's graphics part fails with the switch on. Only tests and tools draw that way.agc_driver_bindless_imagesasserts CPU table behaviour, so it fails with the switch on./dev/udmabuf), a draw copies its V# table and rebuilds its resources every draw.Tested
NVIDIA GeForce RTX 3070 Laptop GPU at edc61087bc (driver 617.42, Windows 11, WinLibs GCC 15.2.0, Release,
ANYPS5_REQUIRE_VULKAN=1; GPU clocks weren't held, pass/fail only). #9508's heap is live there: every run logs "Vulkan descriptor heap: GPU-mode draws and dispatches bind from VK_EXT_descriptor_heap".agc_driver_device_image_table_heap, which checks that #9508's sweep keeps the slots the table holds, andagc_driver_device_image_path_gpu_pathpass 5 runs in a row.agc_driver_device_image_table,agc_driver_device_image_pathandagc_driver_device_image_path_without_heappass 3.agc_driver_device_image_table_heapandagc_driver_device_image_tablepass 5 runs in a row.device.reset(), so its buffer pool freed memory on a destroyed device. The test now scopes that context, and the product code is unchanged.Linux (lavapipe, CI's flags), per commit: each of the 8 commits builds, registers with nothing new left unrun, and passes
ctest -R 'table_trailer|device_image'5 runs in a row. lavapipe has noVK_EXT_descriptor_heap, so the two GPU-heap tests skip 77 there with "the device lacks VK_EXT_descriptor_heap…".Eight reds, each with the code under test broken and the named test kept:
agc_shader_table_traileragc_shader_table_traileragc_driver_device_image_tableOwnWriteSerialdroppedagc_driver_device_image_tableagc_driver_device_image_tableagc_shader_device_image_tablesagc_shader_device_image_tablesAPS5_GPU_PATHAPS5_GPU_HEAPagc_driver_device_image_tableCI's Linux job, mirrored, on the head before the teardown fix (66b470c3cf, which differs from this head only in that test): 1,919 of 1,930.
agc_driver_image_table_atomicstests.agc_driver_pipelined_fill_gpu_heap, a #9508 test none of these commits touch, under the run's load. It passes 10 of 10 alone.check_skips.pyflags onlyguest_sce_net, as on every branch on that machine.agc_driver_pipelined_fill_gpu_heapunder load: a #9508 test, run on cloud Linux machines with lavapipe, its ctest environment and 6 concurrent loops, at the rebase 9e843c1a9e on #9508's 5547aa11ef.9587c4467b, now onmain) cherry-picked onto both trees, both pass 360 of 360. So it's a race in the test, which #9697 fixes, and this PR doesn't change its rate.MinGW (
x86_64-w64-mingw32-g++-posix,-fsyntax-only -Wall -Wextra) on the 27 changed sources, against the same files at 23b2a3fc2d: no new diagnostics.GitHub's runners at 67c1aea6b8, this PR's 9 commits on #9508's head
5645b5be5b(run):5645b5be5b, whose image slots are one shared pool.git range-diffagainst the previous head 4e3a10de4e shows 7 commits unchanged. Commit 1 takes #9508'sFormatVersion49 as its base and keeps #9508's new slot sentence indocs/dev/ARCHITECTURE.mdwith this PR's trailer line. Commit 4 calls #9508'sSlotGeneration(slot), since its slots became one shared pool: in the table's heap slots and in its heap test, three lines.agc_driver_device_image_*tests,agc_device_image_keysand the shader tests built from the changed files, 10 runs in a row. Linux: 24 run, 22 pass, 2 skip (agc_driver_device_image_path_gpu_pathandagc_driver_device_image_table_heap, which needVK_EXT_descriptor_heap), 0 fail. Windows: 26 run, 21 pass, 5 skip (the fiveagc_driver_device_image_*tests; the runner has no Vulkan device), 0 fail.agc_driver_image_table_vouched_lookups). Commit 4 (run) on Linux 21 run, 20 pass, 1 skip, and on Windows 23 run, 20 pass, 3 skip. Commit 6 (run) on Linux 22 run, 21 pass, 1 skip, and on Windows 24 run, 21 pass, 3 skip. None failed. The skips are the GPU-heap test on Linux, and on Windows the Vulkan tests.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.Validation, #9508's
5645b5be5bagainst 67c1aea6b8 (CONTRIBUTING's AGC rule), on one GitHub Linux runner (run), withVK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andctest -Von llvmpipe: the loader inserted the layer 2 times on #9508's tree and 9 times with this PR, neither log haswas not found, and both report onlyVUID-VkDeviceCreateInfo-pNext-pNext, so this PR adds noVUID-message.GitHub's runners at 594b34659a, this PR's 8 commits rebased onto #9508's head 1b09774f07 (run):
mainand gained one commit, 1b09774f07 ("keep GPU heap pipelines in their own journal"). Its other 36 commits carry over: 34 unchanged, and 2 adjusted wheremainchanged the same pipeline-library lines.git range-diffagainst the previous head 0aaf2b962b: 6 commits unchanged, and 2 whose only changes are context lines frommain. Those are aGuestMemory.cpphunk header, aftermainsplitMarkWritten, and an include line inResourceMaterializer.cpp. Against the rebase the load runs below used (9e843c1a9e, on #9508's 5547aa11ef), all 8 are unchanged.agc_driver_device_image_*tests,agc_device_image_keysand the shader tests built from the changed files pass 10 runs in a row on Linux, with the two GPU-heap tests skipping there. On Windows they build and pass, with 5 Vulkan tests skipping.guest_raise_in_system_callfailed in the job's first attempt, and the job's second attempt passed both suites (144, 208). That test also timed out twice onmain's own Windows Build today (run, run), and this PR changes nothing in libkernel.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.Validation, #9508 against this head (CONTRIBUTING's AGC rule), on one GitHub Linux runner (run):
VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andctest -V, on llvmpipe.agc_driver_image_table_vouched_lookupsand the shader tests it has; this head ran those and this PR's tests.was not found.VUID-VkDeviceCreateInfo-pNext-pNext, so this PR adds noVUID-message.Earlier heads on GitHub's runners:
git range-diff: all 8=). The fiveagc_driver_device_image_*tests and the shader tests built from the changed files pass 10 runs in a row on Linux, with the two GPU-heap tests skipping there. On Windows they build and pass, with the Vulkan tests skipping. The libkernel suite passes on both and libc's on Windows. On Linux libc's one failure isprecise_wait, a timing test this PR doesn't touch, which also failed withmain's implementation in another run today (run).On #6947 (the previous base, up to 05502ba6a5): the CI Linux mirror with the switch unset changed no test's status,
^(agc|shader|recompiler)with it on passed 749 of 751 (the two test limitations above), the device image harness passed in 8 configurations with a red per case, and the fork's full Windows build passed 1,572 tests.Astro's Playroom (PPSA01325), by @fma-rc (comment), on the previous head (05502ba6a5, on #6947), as the no-change check: Linux, RTX 5080 (driver 615.78.08), one run each into the first level, with and without
APS5_GPU_PATH=1. No program in that scene read an image table this path serves, the 12 captured frames of each run show the same scenes with no black or missing textures, and one round each within 10% is not a speedup, as they read it.Not tested: the watched-import half of
agc_storage_clear_hand_over. On lavapipe it runs the unwatched hand-over, which passes 10 of 10 on #9508 and with this PR, then skips the watched case, since lavapipe's host imports are compared rather than write-watched.check_conventions.pypasses at 594b34659a against 1b09774f07, with no comment lines added. It passed at 0aaf2b962b against f85d0b3285, and at 66b470c3cf against 23b2a3fc2d and againstmain.88ad9e88d8, a merge ofmain2b1ae87c69, which brings milescoviello's #12039 (run).ShaderDiskCache.cpp. #12039 growsIrValueto 144 bytes, and this PR'sIrResourcePlanis 752. Each side changed only its own struct, so the merge keeps both values, and the build compiles both asserts. The merge commit's message says so.ShaderInfo25,ImageResource47,DeviceImageUse4) stay this PR's; no struct gained fields from both sides.FormatVersionstays 62. This PR's own diff is unchanged.agc_shader_device_image_tablesand every^agc_driver_bda_test.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.VK_EXT_descriptor_heap).ctest -R '^(agc|shader)': 1,246 passed, 0 failed, 98 skipped.0f3e74aa41:6407d568ba, a merge of #9508's headdd7120c648, and a heap-slot test fix on top.28c310dc06(out-of-range GPU heap address loads keep returning zero),68c1327a6a(the image table store test skips without the GPU heap),9263a4bdce(the GPU heap is gated on the descriptor heap extension's revision, not the driver's Vulkan version) and its two merges ofmain, the last of6a691f69ee.docs/dev/ENVIRONMENT.md's rows, nowAPS5_GPU_HEAP,APS5_GPU_HEAP_EXCLUDEandAPS5_GPU_PATHin name order; the WIN32 PATHset_tests_propertieslist inCMakeLists.txt; andVulkanDevice::Target(), which takes both assignments.ShaderResources.cppmerged on its own and keeps #9508's resolution of #8105, so a build with an HTILE mask clear is never reusable, address-space reuse included.0f3e74aa41setsAPS5_HEAP_SLOT_CAPwithAPS5_GPU_HEAPinBindlessHeapSlots.cpp, before the test opens its device. WithAPS5_GPU_PATH=1the device creates the device image table at open, and that builds the device's heap.BindlessHeapreads the cap once, in its constructor, so the heap kept its full slot count and none of the test's refusals at 1 or 8 slots happened.ANYPS5_REQUIRE_VULKAN=1; GPU clocks weren't held, pass/fail only). #9508's heap is live there: every run logs "Vulkan descriptor heap: GPU-mode draws and dispatches bind from VK_EXT_descriptor_heap".APS5_GPU_HEAP=1 APS5_GPU_PATH=1, the sixagc_driver_heap_slots*tests fail 6 of 6 with the test file before this commit, for example "bindless heap slot reuse tests failed: one free slot of eight refuses the heap". With it, they pass 3 runs of 3.agc_driver_device_image_*tests,agc_driver_device_image_table_heapandagc_driver_device_image_path_gpu_pathincluded, pass 3 runs of 3 with the switches and without them.^agc_driver_heap_slotsand^agc_driver_image_tabletest.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.^agc|^shaderonce (run):agc_driver_pipeline_journaltimed out at 120 s, the cold-compile timeout #13858's sweep also hit. Alone ×5 (run) it passes 5 of 5 on Linux: 83.60 s for the first run, and 6.10 to 6.14 s for each after.dd7120c648against this head, on GitHub's Linux runner (llvmpipe), withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationand the runner's layer 1.3.275 (run). It ranagc_driver_depth_clear_hletwice, with the tests the verify adds for the files this head changes over #9508: 25 tests.was not found.VUID-VkDeviceCreateInfo-pNext-pNext,VUID-vkCmdCopyImage-srcImage-01548andVUID-vkCmdCopyImage-srcImage-01551, so this head adds none.agc_driver_depth_clear_hlealso passes 30 runs of 30 under layer 1.4.363, with no validation message.6407d568ba:VK_EXT_descriptor_heap);^agc_driver_heap_slots|^agc_driver_image_table: 12 pass, 7 skip;ctest -R '^(agc|shader)'withoutGALLIUM_OVERRIDE_CPU_CAPS=avx: 1,176 passed, 99 skipped, 0 failed.22cead42b2:525408ab29, a merge ofmain5fb1747fa7, then a merge of #9508's0ab5f157a8.525408ab29: one conflict, at the end ofShaderResources.cpp, where JJenkx's #13648 addsSampledTexturesCleared()and this PR addsLookupDeviceTableTextureandDeviceTableTextureCurrent. Both are kept, with no other edit.DeviceTableTextureCurrentreturn false, so the table looks it up again, as it did for every DCC-keyed entry before.SHADER_READ_ONLY_OPTIMAL) are those of an uploaded one.22cead42b2takes #9508'saa86660b4c("free retired depth surfaces that only GPU heap slots sample") and its merge ofmain, which brings chitters2004's #13667. #9508's own resolution of #13667's newPrebuildStageLibraryargument comes with it unchanged. Clean.+/-lines over #9508 andmain.^agc_driver_heap_slotsand^agc_driver_image_tabletest,agc_driver_sampled_clear_keysandagc_driver_depth_clear_hle.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.0ab5f157a8against this head, the same tests, on GitHub's Linux runner withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(layer 1.3.275) (run).VUID-VkDeviceCreateInfo-pNext-pNext,VUID-vkCmdCopyImage-srcImage-01548andVUID-vkCmdCopyImage-srcImage-01551, so this head adds none. The loader inserted the layer 28 times on #9508 and 35 times with this head.agc_driver_image_tablefails its ctest check for validation messages. ItsFAIL_REGULAR_EXPRESSIONmatches theVUID-VkDeviceCreateInfo-pNext-pNextline that layer 1.3.275 logs forVkPhysicalDeviceMaintenance8FeaturesKHRin the device's feature chain. Both the check and that feature chain aremain's.525408ab29:VK_EXT_descriptor_heap, or no uint storage view);agc_driver_sampled_clear_keyspasses 10 of 10;^(agc|shader): 1,278 run, 1,178 pass, 99 skip, 1 fail. The failure isagc_driver_idle_store_yields, from #13621, which failed 14 of 30 runs onmain5fb1747fa7alone there.06eba99c50: every field the device image interface's duplicate check compares is in its id, for @mrfelek's Death Stranding 2 (PPSA02015) stop on #10193 (comment):device image interface: two image interfaces share the id.RegisterDeviceImageInterfacecompares entries withImageResource's defaultedoperator==, butmixImageInterfacedidn't mix five of its fields, anddeviceInterfaceImagedidn't clear them. Two device-table images, or mode lists, that differed only in one of those fields got one id, and the second registration threw.ResourceMaterializer.cpp, decides each field by whether the interface depends on it:dimensionQueryOnlyandsampledOnly:inspectImageDescriptorreads both on the stored interface image whenDeviceImageTable::lookupKeypicks a mode throughTryRuntimeImageMode;targetMerge: it changes the modes and the SPIR-V declarations.adjustedSample: it only decides which modesRuntimeImageModesadds, and the modes are already part of the id;optionalDescriptor: only the per-draw snapshot reads it, on the program's own copy.deviceTableimages, so nothing else changes.FormatVersionandSourceVersion()both match (ShaderDiskCache.cpp1478 and 1491), and its directory and key are named afterSourceVersion()(1514, 1950-1951).SourceVersion()is a SHA-256 over the recompiler's sources (ShaderCacheVersion.cmake),ResourceMaterializer.cppincluded. So no entry with an old id can be read, and the layout is unchanged.agc_driver_device_image_table's interface case now registers, for each of the five fields, an image that differs from the base only in that field.sampledOnlygets its own id.22cead42b2the case stops at "device image interface: two image interfaces share the id 0xa1ad8eab5dcb3e9d".ImageResource::volumeGather. Whichever of #9183 and this PR merges second gives it a mixed-or-cleared call, with a test case.0ab5f157a8(run): the same set as above.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.0ab5f157a8against this head, the same tests, on GitHub's Linux runner (layer 1.3.275) (run).VUID-VkDeviceCreateInfo-pNext-pNext,VUID-vkCmdCopyImage-srcImage-01548andVUID-vkCmdCopyImage-srcImage-01551, so this head adds none.agc_driver_image_tablefails its validation-message check on both arms, as above. The only "was not found" in either log is that check's own regex, echoed in its failure line.^(agc|shader): 1,279 run, 1,180 pass, 99 skip, 0 fail. A first run had 6 failures: five frame-capture tests stopping on that machine's full disk ("less than 4 GiB free on the capture volume"), andagc_driver_idle_store_yields,main's flaky test. All 6 passed alone, and the rerun after freeing space is the one above.715097ee91:b5065a1fe9and715097ee91, merges of #9508's31f5d0e8ddand09cc865e29, which bring Raghav314's commits since0ab5f157a8and #9508's merges ofmain, with #12862's test split.b5065a1fe9keeps both sides, with two edits for what #9508 changed:DeviceImageTable::HeapSlotspassestexture.get()to #9508'sTextureSlot(Texture*)(dd83293174). That's the change milescoviello named in their Ghost of Tsushima run on #10193 (below).docs/dev/ARCHITECTURE.md'sAPS5_GPU_HEAPbullet keeps #9508's sentences and this PR's trailer words.715097ee91:CMakeLists.txtis resolved withtools/agc_test_split.py resolve, which moves this PR's registrations intotests/cmake/. #9508 already registers the_gpu_heapvariants throughagc_add_gpu_heap_test().ShaderDiskCache.cpp: #9508's866bd70c70drops the seconduserDataRegisterReads, and this PR's two lists followimageTableFaultsin both directions;Dispatch.cppandDrawCapture.cpp;ShaderResources.cpp's includes;tests/BindlessHeapSlots.cpp: #9508's helpers, with both settings made before the device opens;PATHline inagc_shader_memory_tests.cmake.0f4b636d04and675e23803drename what this PR's lines call (LoadTableMap,TableHeap(),TableMapAddressed(),context.localDevice,graphicsContext()), so this PR's lines follow.BufferSpecializationFields) comes in through #9508's own merge ofmain, which adds it to the binding-plan key and the snapshot hash. This PR'sRecompiler.cpplines don't touch those functions.-DBUILD_TESTING=ON,ctest -Ngives 3,227 tests: #9508's 3,219 plus this PR's 8, each listed once, with all 22_gpu_heapvariants.LoadTableMap'sTableMapAddressed()branch, never the table-map buffer branch.agc_shader_device_image_tablescompiles and validates it. The GPU tests that run it,agc_driver_device_image_table_heapandagc_driver_device_image_path_gpu_path, skip on lavapipe, which has noVK_EXT_descriptor_heap.^agc_driver_heap_slotsand^agc_driver_image_table.VK_EXT_descriptor_heap.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.main31034785f8against this head, the same tests, on GitHub's Linux runner (run).VUID-VkDeviceCreateInfo-pNext-pNext,VUID-vkCmdCopyImage-srcImage-01548andVUID-vkCmdCopyImage-srcImage-01551, so this head adds none.mainand 35 times with this head.agc_driver_image_tablefails its validation-message check on both arms, as above.31f5d0e8dd, ×10: 328 pass, 38 skip, 0 fail;^(agc|shader): 1,292 run, 1,121 pass, 171 skip, 0 fail. The skips rise from 104 atb5065a1fe9because #9508's09cc865e29makes its GPU heap variants skip, instead of passing on the per-draw path, when the device has no descriptor heap (95 of the 171).APS5_GPU_HEAP=1 APS5_GPU_PATH=1. On the CPU table path it creates ~17,000 sampled textures and spends ~85 ms per draw, until memory runs out. On the GPU path it creates 800 sampled textures, at ~2.8-15 ms per draw, until the interface id stop that06eba99c50fixes. With06eba99c50merged into the same stack, mrfelek reports the id stop gone in 2 of 2 runs (comment); the next limit there is 20 programs on the CPU table path and host memory.APS5_GPU_HEAP=1 APS5_GPU_PATH=1 APS5_KEEP_UNEXPECTED_DEVICE_IMAGES=1, an RTX 4070 Ti, Linux.APS5_NO_HEAP_DATA_UNIFORM=1, the 20-minute session runs to the end. Its interface id clash at 101 s is the one06eba99c50fixes.67420fb18b:7e88d62913and67420fb18b, merges of #9508'sde1bbf1af3andfbab1c1619, with92c6dab397, a fix for the device image table's eviction window, between them.7e88d62913brings Raghav314's commits since09cc865e29and #9508's merges ofmain. Among the commits:a6ecdf81e4: heap stages' root and shader data are pushed like vkd3d's root signature;36caa8b0fe: idle GPU heap image slots are evicted;097833507b: an evicted slot counts as free only once a submission covers it;de1bbf1af3: a batch is submitted early once it holds half the descriptor ring.RecompileImplbuilds the result as a value, setsdeviceImagePlan, then makes itshared_ptr<const>;ResourceMaterializer's!deviceTableguard goes on #9508's newfill(...)call.92c6dab397,fix(agc): keep device image table slots from retiring while a batch still reads them.DeviceImageTable::Prepareswept its keys (retainSlots) and uploaded, then took a miss-ring chunk withchunkFor(recorder, true), which canSyncand submit.Preparenow sweeps again and uploads once, afterchunkFor, so nothing that can submit sits between the last sweep and the upload. That also covers a flush insideresolve's texture lookup.Expectnever uploads, so it needs no change.Slots::touchmember, mapped toBindlessHeap::TouchSlots, marks every live entry's slot used once per heap epoch. #9508'sevictLockedtakes only slots withuse + 2 <= epoch, so it no longer takes one the table serves.agc_driver_device_image_table:SweptWhileWaitingForAChunkholds all 16 miss-ring chunks and moves a live key's slot insidechunkFor's wait. On the merge without the fix it fails with "a prepare serves no key whose heap slot moved while it waited for a miss-ring chunk (slot 2, 0 swept)", and with the fix it passes.LiveSlotsTouchedchecks the touch once per epoch.67420fb18bmergesfbab1c1619, Dean's merge ofmain87448b3c91into #9508. Three conflicts, each resolved by keeping both sides:tests/ShaderMemory.cpp: the--device-image-tablesand--table-trailerdispatch, thenmain's--registered-view-churn;IrMetadata/Resources.hpp:NoSamplerandDeviceImageUse, thenmain'sAppliesLodBiasInShader;PipelineSpecialization.hpp:main'sSamplerLodBiasBase57728 andSamplerLodBiasShaderThreshold, thenDeviceSamplerClassBase58368.git diff de1bbf1af3 92c6dab397andgit diff fbab1c1619 67420fb18bboth give 59 files, +4,252/-30.FormatVersionstays 62.3rdparty/SDL2move and the new3rdparty/sqlitearemain's, through #9508.main, the bases from 57344 to 57791 are contiguous. The device sampler classes take 58368 to 58431, after 576 unused IDs.info.samplersstops atShaderInfo::MaxSamplers(ResourceTracker.cpp:2461-2464).SpirvImageEmitter.cpp:2371).main's shader-side bias (AppliesLodBiasInShader,SamplerLodBiasBaseplus the sampler index).^agc_shader_memory,^agc_shader_registered_view_churn,^agc_driver_image_sample_lod_bias,^agc_shader_sampler_limitsand^agc_shader_disk_cache.VK_EXT_descriptor_heap.agc_driver_device_image_tablepasses 10 of 10.APS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.main87448b3c91against this head, the same tests, on GitHub's Linux runner (run).main's arm ran 15 tests and this head's arm 36, all passing, with 15 skipped on this head.VUID-VkDeviceCreateInfo-pNext-pNext, so this head adds none.mainand 27 times with this head, and neither log haswas not found.92c6dab397:09cc865e29change, ×10: 83 pass, 26 skip, 0 fail;^(agc|shader): 1,482 run, 1,289 pass, 193 skip, 0 fail.67420fb18b:^(agc|shader): 1,494 run, 1,301 pass, 193 skip, 0 fail. 106 of the skips needVK_EXT_descriptor_heap.agc_driver_device_image_table_heapandagc_driver_device_image_path_gpu_pathneedVK_EXT_descriptor_heap, which lavapipe and GitHub's runners lack, and the RTX 3070 above wasn't rerun at this head.Checklist
mainthrough #9508 (Raghav314,fbab1c1619, which this head merges); #9508's image tables are CPU-resolved into heap slots, and fable-void's branch is not an open PR. #7223, #7395 and #7550 extend the CPU table path in the same recompiler files (ResourceMaterializer.cpp,ResourceTracker.cpp); they compose with this. No other open PR implements these 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)Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T07:29:40Z.
Rebase handoff for the 82-commit GPU-path series — the full series is rebased onto
main(cc5b79868, authorship unchanged). This is a deep architectural reconciliation; the resolutions:main's const-correctwritesPrograms/writableProgramsform with yourtail/finisher threading,tail.programssynced aftersetMeshIndexBufferso mesh words reach the finisherFormatVersionbumped 40→44 (one per format-affecting change in the series — reviewers may prefer a single final value);DescriptorBinding656,ShaderInvocation312,RecompileResultpinned to probe-derived merged sizesShaderRegistry'sconvertedSamplesflag promoted intolinkedSource(mutable copy only when linked code or converted samples exist) — the most semantic rewrite, worth a reviewer's eyeHostThread.hpp,AtomicSharedPtr.hpp) added to the recompiler's cache key with theshader_cache_runtime_sourcestest fixture generalized to create themRecompileImplforward declaration, a duplicatedGuardRead, a staleread.bytesspelling)Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the four knownmainregressions (#5444 Mesa, #7584 BDA, #7766 image-table vouch, #7784 guest-memory lifetime — all bisected today), none from this PR.To pick it up:
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-19T14:09:40Z.
@EagleBearerYS here's Astro's Playroom (PPSA01325) on this head (05502ba6a5), Linux, RTX 5080 (driver 615.78.08), one run each into the first level with Cross pressed, and a 10 s trace window in the same gameplay scene. Both runs had
APS5_PROFILE_DRAW=1; one addedAPS5_GPU_PATH=1.With the switch on, the log has no
[device-images]line at all in 190 s: no 10-second counters, no "takes the CPU table path" line and no "stays off on this device" line. So the device image table logged no activity on this title, and I can't attribute anything below to the lookup itself.The 12 captured frames of each run show the same intro and gameplay scene, with no black or missing textures in either. The trace window had 135 frames with the switch and 124 without. The GPU ran at P0 for most of both runs, median graphics clock 2812 MHz in each. That's one round each, and the two are within 10%, so I wouldn't read the gap as a speedup.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T02:39:28Z.
@fma-rc Thanks for the Astro's Playroom (PPSA01325) run. No
[device-images]line means no program in that scene reads an image table the path serves. The 10-second counters print only once a device image table exists, and the per-program line prints for each program recompiled with device tables. The "stays off on this device" line didn't print either, so the switch was on and the device supports the path. That makes your pair the no-change check: the same frames, and frame counts within noise, as you read them, on a title whose shaders don't use the bindless image tables this moves onto the GPU heap. I'll add it to Tested as that.@blawesom Thanks for rebasing the series and for the notes. We won't take the rebased copy into this PR. It carries the 31 commits of Raghav314's #6947, which this draft is stacked on, and rebasing those is his call on his PR. This PR follows #6947 when it moves, with a merge of main of its own if needed. Your resolution notes (the finisher threading,
convertedSamplesmoving intolinkedSource, and the key-source headers) are a useful reference for that merge. If we use one, the commit credits you. On the format numbers, one FormatVersion step per format change is what we do too, but main has moved since, so the values will change again.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T13:46:49Z.
Review: CHANGES_REQUESTED
Reviewed the 8 commits on top of #9508; it can't land before that one does.
docs/dev/debt/libSceAgcDriver.md, new line). fma-rc's Death Stranding 2 run shows five programs doing this during loading. Please say how often it happens on a real title and whether it is visible (a missing frame of texture), or record the draw again through the CPU map.ShaderDiskCache::FormatVersionis 49 here,mainis 45 and #7223 takes 46. Re-pick it when #9508 and #7223 land.maincome from #9508; rebase once it merges.Everything else checked (trailer ABI v3 layout and its tests, docs and debt updates, no added code comments, conventions) looks fine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-31T04:11:08Z.
Review: COMMENTED
Linux NVIDIA run of head
88ad9e88d8. As far as I can tell from the thread, it's the first Linux test run with the descriptor heap live: lavapipe skips the GPU-heap tests, and the 3070 runs in the body are Windows.Setup: Ubuntu 26.04, GCC 15.2, Release. RTX 3070 with NVIDIA 595.99.02 and lavapipe (Mesa 26.0.3), one at a time via
VK_DRIVER_FILES. The head is merged--no-ffontomain539c3425f8with no conflicts.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,ctest -j1. This head carries #9508 at82f76ffa75, so the heap turns on with this driver (GPU-mode draws and dispatches bind from VK_EXT_descriptor_heap).all(size asserts and field counts) builds with no new warnings.public_headerspasses 65/65.heap|device_imagepass 115/115 in 3 of 3 runs.agc_driver_device_image_table_heapandagc_driver_device_image_path_gpu_pathwith the heap live.GPU-mode compute stages 10, ... expected 10, inserted 10 / 0, miss records 0, fallbacks 0.agc_shader_table_trailer,agc_shader_device_image_tables,agc_device_image_keys, and the fiveagc_driver_device_image_*), with noVUID-from them.*_gpu_heap/heap_*tests segfault, a different subset each run. The heap VUIDs (11236,11228,maintenance4-08602) also appear. That's #9508's base at82f76ffa75under this layer, which I reported on #9508. #9508's newer head turns the heap off under layers older than 1.4.363.device_image_table_heapanddevice_image_path_gpu_path(SEGFAULT). The layer doesn't know the extension. Once this branch restacks on #9508's current head, these tests will skip on that machine, because #9508's current head keeps the heap off on 595.99.02, which reports Vulkan 1.4.329.^agc, no layer: 1221/1221 on the 3070 and 1221/1221 on lavapipe.^agcwith the switches set for the whole run, 3070:APS5_GPU_HEAP=1alone: 14 fail, none of them this PR's tests. Four are the ones #9508 fixed indfe95cc969:tessellation_depth_range_remap,prepared_graphicsand bothlazy_resolved_abi. Four are multisample tests that also fail on #9508'sec6c2f384fonce its driver check is relaxed locally so the heap goes live.APS5_GPU_HEAP=1 APS5_GPU_PATH=1: 23 fail. The 9 extra failures are this PR's:bindless_images(plain,_gpu_heap,_heap), as the Limitations section says;agc_driver_heap_slots*tests, which pass withoutAPS5_GPU_PATH. In that run they fail witha full heap refuses another owner's view,one free slot of eight refuses the heap,storage owners that leave one free slot of eight refuse the heapandviews that leave one free slot of eight refuse the heap.DeviceImageTable.hppand others), so they can't run onmain. Instead I broke the code under test: the table entry no longer holds its texture (entry = {nullptr, ...}inDeviceImageTable::lookupKey).agc_driver_device_image_table_heapthen fails withthe heap slot holds the entry's texture, andagc_driver_device_image_tableandagc_driver_device_image_path_gpu_pathfail too. With the code restored, all pass.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux), lavapipe (Mesa 26.0.3).
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-11-23T02:40:24Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: the author must complete a broad review of the changed code and resolve any issues found.
What I ran
Reviewed the prepared diff for head
2eb37516af1e94aa481a1c34f8cead9cdab7ef90and inspected selected diff sections. No tests or builds were run. Repository source reads throughrepo_read.pywere not available in this session.Results
Findings
Blocking
None verified.
Non-blocking
No code finding is offered because the relevant repository source was not verified.
Not verified
The review is incomplete: no repository source at the pinned head was read, and no tests or builds were run. I inspected
description.md,manifest.json, and selected portions ofdiff.patch; I did not inspectcommits.mdorfiles.json. Most changed files listed in the manifest were not read, and some changed files were excluded from the review bundle because they were too large or unsupported. The stated behavior and test claims in the description remain unverified.To get this to a good state
Complete a source-level review of the changed files at the pinned head and run the relevant checks before making a merge decision.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.