[SPIR-V][HLSL] Crash compiling 64-bit InterlockedOr/Xor on typed RWBuffer
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Clang crashes during SPIR-V instruction selection when compiling 64-bit bitwise atomic operations on typed `RWBuffer` resources.
Minimal reproducer:
```hlsl
RWBuffer B : register(u0);
[numthreads(1, 1, 1)]
void main() {
InterlockedXor(B[0], 1ull);
// InterlockedOr(B[0], 1ull) also crashes.
}
```
https://godbolt.org/z/GPYbvEMx3
Command:
`clang-dxc -spirv -fspv-target-env=vulkan1.3 -fspv-extension=DXC -HV 202x -T cs_6_6 source.hlsl`
Both `InterlockedOr` and `InterlockedXor` crash in `InstructionSelect` while targeting `spirv1.6-unknown-vulkan1.3-compute`.
The failure is compile-time and independent of the GPU vendor. It reproduces on an NVIDIA GPU reporting `shaderImageInt64Atomics` and `VK_EXT_shader_image_atomic_int64`. Non-atomic 64-bit typed-resource stores compile successfully.
Contributor guide
Research direction
Reproduce the crash with the provided clang-dxc command and minimal HLSL example, then inspect the failure in InstructionSelect for the SPIR-V Vulkan compute target. Verify the fix by compiling both InterlockedXor and InterlockedOr on the typed 64-bit RWBuffer without a compiler crash.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100