microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] Memory access violation when trying to use inline SPIR-V for floating point atomics extension

Open
#7,698 0 comments 0 reactions 1 assignee View on GitHub

@s-perron is already working on this.

Since Aug 21, 2025.

bug spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description

I was trying to use the vulkan extension SPV_EXT_shader_atomic_float_add for my compute shader. I believe the code I wrote is correct. However trying to compile this segfaults the compiler without a helpful error.
Steps to Reproduce

try to compile this code.
& "path\to\dxc.exe" .\atomicfloat.hlsl -spirv -T cs_6_6 -E main
[Ive also provided a link to compiler explorer]


[[vk::ext_extension("SPV_EXT_shader_atomic_float_add")]]
[[vk::ext_capability(6033)]] 

[[vk::ext_instruction(/* OpAtomicFAddEXT */ 6035)]]
float AtomicFAdd(
    [[vk::ext_reference]] in out float target,
    float value,
    [[vk::ext_literal]] uint scope,
    [[vk::ext_literal]] uint semantics
);

// Example usage within a compute shader entry point.
[shader("compute")]
[numthreads(8, 8, 1)]
void main(uint3 DTid : SV_DispatchThreadID)
{
    RWStructuredBuffer<float> myBuffer;
    uint index = DTid.x;

    AtomicFAdd(myBuffer[index], 1.5f, 1, 64);
}

Actual Behavior

compiler gives error:
Internal compiler error: access violation. Attempted to read from address 0x0000000000000030
Environment

  • DXC version dxcompiler.dll: 1.9 - 1.8.2505.32 (b106a961d); dxil.dll: 1.9(1.8.2505.32)

  • Host Operating System Windows 11 Pro 10.0.26100 Build 26100

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.