Skip to content

[SPIR-V] Incorrect ignoring globallycoherent with ResourceDescriptorHeap approach #7740

Closed

Description

Description
I think the latest DXC incorrectly handles globallycoherent with combination ResourceDescriptorHeap. Resulting SPIR-V does not contain Coherent keyword.

Steps to Reproduce
The most trivial examples

  • ✅ Using OG descriptor set approach
[[vk::binding ( 7, 0 )]]
globallycoherent RWStructuredBuffer<uint32_t>       g_global:       register ( u0 );


[numthreads ( 8, 8, 1 )]
void CS ( in uint32_t threadID: SV_GroupIndex, in uint32_t3 workGroupID: SV_GroupID )
{
    if ( threadID.x + workGroupID.y + workGroupID.z + threadID == 0U )
    {
        g_global[ 0U ] = 42U;
    }
}
  • ❌ Using ResourceDescriptorHeap
[numthreads ( 8, 8, 1 )]
void CS ( in uint32_t threadID: SV_GroupIndex, in uint32_t3 workGroupID: SV_GroupID )
{
    globallycoherent RWStructuredBuffer<uint32_t> g_global = ResourceDescriptorHeap[ 7U ];

    if ( threadID.x + workGroupID.y + workGroupID.z + threadID == 0U )
    {
        g_global[ 0U ] = 42U;
    }
}

DXC parameters in both cases:

-HV 2021
-spirv
-fvk-use-dx-layout
-fspv-reduce-load-size
-fspv-target-env=vulkan1.1
-ffinite-math-only
-enable-16bit-types
-WX
-O3
-E CS
-T cs_6_9

Actual Behavior

❌ No compilation warnings or errors. The SPIR-V neck by neck:

Image

Expected

Coherent should present somewhere in SPIR-V output when using descriptor indexing + ResourceDescriptorHeap strategy. Without it it's impossible to use modern approach with the following features:

Environment

  • git submodule update --init has been invoked before build
  • hctbuild build parameters: -official -rel -x64 -vs2022 -speak-up -no-dxilconv -spirv
  • Visual Studio 2022 Community components were up to date.
  • Windows 11 Pro (24H2, Build 26100.4351)
  • dxc.exe v1.8.2505.10062 executable, commit SHA-1 94abfe972ad839185965f670329bcf33cd7bccbd

Activity

  1. added
    bug
    spirv
    needs-triage
    on Sep 6, 2025
  2. changed the title [-][SPIR-V] globallycoherent with ResourceDescriptorHeap approach[/-] [+][SPIR-V] Incorrect ignoring globallycoherent with ResourceDescriptorHeap approach[/+] on Sep 10, 2025
  3. Goshido commented on Sep 11, 2025

    @Goshido
    Author

    I found workaround to mitigate the issue for DXC 94abfe972ad839185965f670329bcf33cd7bccbd.

    Image
    #define RESOURCE_DESCRIPTOR_HEAP_SET                0
    #define RESOURCE_DESCRIPTOR_HEAP_BIND               0
    
    
    [[vk::binding ( RESOURCE_DESCRIPTOR_HEAP_BIND, RESOURCE_DESCRIPTOR_HEAP_SET )]]
    globallycoherent RWStructuredBuffer<uint32_t>       g_coherentGlobal[]:     register ( u0 );
    
    [numthreads ( 8, 8, 1 )]
    void CS ( in uint32_t threadID: SV_GroupIndex, in uint32_t3 workGroupID: SV_GroupID )
    {
        globallycoherent RWStructuredBuffer<uint32_t> g_global = g_coherentGlobal[ 7U ];
    
        if ( threadID.x + workGroupID.y + workGroupID.z + threadID == 0U )
        {
            g_global[ 0U ] = 42U;
        }
    }

    As you can see it's inspired glslangValidator approach. My suggestion is to add globallycoherent variants into existing codegen of DXC. This will allow to use ResourceDescriptorHeap naturally.

    More complex example also works

    Image
  4. vntec commented on Dec 1, 2025

    @vntec

    I encountered this today too. I think another limitation with the current design is the inability to use image format attributes like [[vk::image_format("rgba8")]] in conjunction with ResourceDescriptorHeap directly...

  5. Keenuts commented on Dec 15, 2025

    @Keenuts
    Collaborator

    The globallycoherent bit seems possible, but I'll need to figure out how to correctly pass the attribute to the implicit cast, which for now only takes the type of the variable.
    But since we create a single resource per heap load, it should be OK.
    For the other attribute, I'll need to look into them. Might be the same story.

  6. SteveUrquhart commented on Mar 18, 2026

    @SteveUrquhart
    Contributor

    Nathan Gauër (@Keenuts) , any updates on this bug? We're also interested in this.

  7. alsepkow commented on Sep 12, 2026

    @alsepkow
    Contributor

    Resolved by PR 8513

  8. moved this from For Google to Triaged in HLSL Triageon Sep 12, 2026
  9. Goshido commented on Sep 16, 2026

    @Goshido
    Author

    Tested in version b9e9f840b3ed530a7f67010ee899a02a613d3586. No issues. Thx guys! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugspirv

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions