Is your feature request related to a problem? Please describe.
When I attempt to use something like "InterlockedAdd64", dxc returns "error GCC929F7B: intrinsic 'InterlockedAdd64' method unimplemented" when targeting SPIR-V. (minimal reproducer: https://godbolt.org/z/oe1bG7T3d)
Describe the solution you'd like
We should instead request a -fspv-extension=SPV_KHR_shader_atomic_int64 in the compilation flags, then allow functions like InterlockedAdd64 to emit opcodes like OpAtomicIAdd with 64 bit types for inputs/output/comparands.
Describe alternatives you've considered
Perhaps it could theoretically be possible to emit custom SPIR-V, but OpAtomicIAdd requires a complex pointer type for the RWByteAddressBuffer that I'm trying to use, and I can't figure out how to actually write this with GL_EXT_spirv_intrinsics...
Additional context
64 bit atomic adds are necessary for certain operations when implementing a single pass parallel prefix sum, as described here: https://research.nvidia.com/sites/default/files/pubs/2016-03_Single-pass-Parallel-Prefix/nvr-2016-002.pdf. These prefix sums in turn are fundamental building blocks to many parallel algorithms relevant in ray tracing (eg, PLOC tree construction). Without 64 bit atomics, a single pass prefix sum is still possible, but requires some expensive memory fences.
Is your feature request related to a problem? Please describe.
When I attempt to use something like "InterlockedAdd64", dxc returns "error GCC929F7B: intrinsic 'InterlockedAdd64' method unimplemented" when targeting SPIR-V. (minimal reproducer: https://godbolt.org/z/oe1bG7T3d)
Describe the solution you'd like
We should instead request a
-fspv-extension=SPV_KHR_shader_atomic_int64in the compilation flags, then allow functions like InterlockedAdd64 to emit opcodes like OpAtomicIAdd with 64 bit types for inputs/output/comparands.Describe alternatives you've considered
Perhaps it could theoretically be possible to emit custom SPIR-V, but OpAtomicIAdd requires a complex pointer type for the RWByteAddressBuffer that I'm trying to use, and I can't figure out how to actually write this with GL_EXT_spirv_intrinsics...
Additional context
64 bit atomic adds are necessary for certain operations when implementing a single pass parallel prefix sum, as described here: https://research.nvidia.com/sites/default/files/pubs/2016-03_Single-pass-Parallel-Prefix/nvr-2016-002.pdf. These prefix sums in turn are fundamental building blocks to many parallel algorithms relevant in ray tracing (eg, PLOC tree construction). Without 64 bit atomics, a single pass prefix sum is still possible, but requires some expensive memory fences.