Skip to content

[HLSL] Preserve coherence qualifiers on resource flat-conversions - #8583

Merged
Chris B (llvm-beanz) merged 1 commit into
microsoft:mainfrom
llvm-beanz:fix-flat-cast
Jun 30, 2026
Merged

Chris B (llvm-beanz) merged 1 commit into
microsoft:mainfrom
llvm-beanz:fix-flat-cast

Conversation

@llvm-beanz

@llvm-beanz Chris B (llvm-beanz) commented Jun 23, 2026 •

Copy link
Copy Markdown
Collaborator

PerformHLSLConversion forced the ICK_Flat_Conversion cast target to the structural/unqualified type, discarding the 'globallycoherent' (and 'reordercoherent') AttributedType. As a result, the converted expression's
type no longer reflected the coherence of its destination, forcing consumers
to reconstruct that information from declarations.

Re-apply the coherence AttributedType to the flat-conversion result when the
target is a resource type, so the converted expression's type carries the
coherence of its destination (e.g. a ResourceDescriptorHeap[] access used to
initialize a 'globallycoherent' resource).

Assisted by Claude Opus 4.8

PerformHLSLConversion forced the ICK_Flat_Conversion cast target to the
structural/unqualified type, discarding the 'globallycoherent' (and
'reordercoherent') AttributedType. As a result, the converted
expression's
type no longer reflected the coherence of its destination, forcing
consumers
to reconstruct that information from declarations.

Re-apply the coherence AttributedType to the flat-conversion result
when the
target is a resource type, so the converted expression's type carries
the
coherence of its destination (e.g. a ResourceDescriptorHeap[] access
used to
initialize a 'globallycoherent' resource).

@bob80905 Joshua Batista (bob80905) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but there are 2 probably basic questions I have.

  1. Oddly in the github view, globallycoherent is highlighted as a keyword in red, but reordercoherent is not. Why is that?
  2. ResourceDescriptorHeap isn't defined anywhere, yet the tests work. Is this a variable that exists implicitly in all shaders? I don't think I've seen this before.

@llvm-beanz

Copy link
Copy Markdown
Collaborator Author

LGTM, but there are 2 probably basic questions I have.

  1. Oddly in the github view, globallycoherent is highlighted as a keyword in red, but reordercoherent is not. Why is that?

It is because the GitHub syntax plugin isn't up-to-date with SM 6.9. I think GitHub uses this format grammar, which hasn't been updated in 7 years...

  1. ResourceDescriptorHeap isn't defined anywhere, yet the tests work. Is this a variable that exists implicitly in all shaders? I don't think I've seen this before.

ResourceDescriptorHeap and SamplerDescriptorHeap are part of SM 6.6's dynamic resources.

@SteveUrquhart

Copy link
Copy Markdown
Contributor

Thanks for doing this!

@hekota Helena Kotas (hekota) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@llvm-beanz
Chris B (llvm-beanz) merged commit dd3152d into microsoft:main Jun 30, 2026
15 checks passed
@llvm-beanz
Chris B (llvm-beanz) deleted the fix-flat-cast branch June 30, 2026 12:18
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants