fix(agc): refuse 64-bit buffer atomics on devices without shaderBufferInt64Atomics #1213
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1213"
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 kr4y4 on 2026-10-07T17:52:44Z.
What
When a program uses a 64-bit buffer or global atomic, the recompiler emits
Int64andInt64Atomicswith 64-bitOpAtomic*on storage buffers and physical storage buffer pointers (SpirvModuleSetup.cpp). Nothing checks that the device supports them.VulkanDeviceenablesshaderBufferInt64Atomicswhen it is present, but never addsInt64Atomicsto the target's capabilities. On a device without the feature the module is invalid (VUID-VkShaderModuleCreateInfo-pCode-08740), so what the driver does with it is undefined. The 64-bit image atomics path a few lines below already fails emission in the same situation.The device now adds
Int64Atomicsto the target capabilities when it enablesshaderBufferInt64Atomics. Emission fails with64-bit buffer atomics need shaderBufferInt64Atomicswhen a program needs them on a device without it. The execution tests that use 64-bit buffer, global or image atomics skip on such devices, asImageSampleLodClampdoes forshaderResourceMinLod.Intel Raptor Lake-S Mobile Graphics (driver 32.0.101.6790) reports
shaderBufferInt64Atomics,shaderSharedInt64AtomicsandshaderImageInt64Atomicsall 0. On it the dispatch writes nothing, including its 32-bit stores:agc_driver_buffer_atomicslane 0 buffer_atomic_inc is 0xdeadbeef, expected 0x00000000agc_driver_buffer_atomics_floatlane 0 fcmpswap_ret0 is 0xdeadbeef, expected 0x00000000agc_driver_buffer_atomics_inc_dec64lane 0 inc_x2_ret0 is 0xdeadbeef, expected 0x00000000agc_driver_buffer_atomics_or_swap64lane 0 buffer_atomic_or_x2 returned lo is 0xdeadbeef, expected 0x6a6ae768agc_driver_look_back_scanlook-back from block 0: the counter is 0(buffer_atomic_swap_x2publish)agc_driver_global_atomics64,agc_driver_global_atomics_float,agc_driver_global_atomics_lanesInt64Atomicswithout the featureagc_driver_image_atomics6464-bit image atomics need VK_EXT_shader_image_atomic_int64Before the skips were added,
global_atomics_float,global_atomics_lanesandlook_back_scanfailed withSPIR-V module emission failed: 64-bit buffer atomics need shaderBufferInt64Atomics.A plain Vulkan compute shader (GLSL, no AnyPS5 code) on the same device shows the same result:
atomicAddon auint64_tSSBO member lands none of its 32 plain stores.vkQueueSubmitreturnsVK_ERROR_DEVICE_LOST.Tested
Windows 11 (26200), WinLibs GCC 15.2.0 r7, CI configure flags, main at
cea1ef13,ctest --output-on-failure --timeout 120 --repeat until-fail:3:ANYPS5_GPU=Intel: the nine tests above skip. The 24 remaining failures also fail on main and have other causes on this device:shaderFloat64;V_FRACT_F32rounding;OpSMulExtendedby some constants.Notes:
supportedCapabilitiesis part of the shader cache key, so cached shaders on devices with the feature are recompiled once.buffer_atomicsalso covers 32-bit inc/dec. On devices without the feature those cases are skipped together with the 64-bit ones.Int64Atomicswhen the device enables it. This change makes emission refuse it when the device does not. The two are independent, and the branches merge without conflicts (git merge-tree, checked against the 22 open PRs that touch these files).Checklist
main; no other open PR implements the same thing🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T08:56:32Z.
Checked on the PR merged onto current main: build + ctest 428/428 green, and the nine tests pass on a device that has the feature. With the
Int64Atomicspush inVulkanDevice.cppremoved, the buffer/global/look-back tests report Skipped, so the skip path works. Linux, Windows and conventions CI are green; merging.Nothing blocking, for a later PR: nothing pins the new
FailEmitinSpirvModuleSetup.cpp(the image-atomics one next to it has no test either), and the12/5016capability constants are repeated in each test.Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-08T12:43:55Z.
Both follow-ups from your review are up: #1563 pins the 64-bit buffer and image atomics
FailEmitmessages, and #1558 replaces the repeated capability constants withspv::Capabilitynames through a shared helper.