Skip to content

[SM6.10] Make DxilStructAnnotation aware of target types#8282

Merged
hekota merged 5 commits intomicrosoft:mainfrom
hekota:target-types-in-structs
Mar 26, 2026
Merged

[SM6.10] Make DxilStructAnnotation aware of target types#8282
hekota merged 5 commits intomicrosoft:mainfrom
hekota:target-types-in-structs

Conversation

@hekota
Copy link
Copy Markdown
Member

@hekota hekota commented Mar 20, 2026

Update DxilStructAnnotation to be aware of target types. Otherwise the annotation would declare a struct with a single LinAlg Matrix type as empty, leading to invalid codegen.

Declaration names match the style of the surrounding code.

Fixes #8279

Copy link
Copy Markdown
Member

@damyanp damyanp left a comment

Choose a reason for hiding this comment

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

A few nits, but I think it's mostly around following existing style in this file, which seems somewhat appropriate given the nature of this change.

Comment thread include/dxc/DXIL/DxilTypeSystem.h Outdated
Comment thread include/dxc/DXIL/DxilTypeSystem.h
Comment thread include/dxc/DXIL/DxilTypeSystem.h Outdated
Comment thread lib/DXIL/DxilTypeSystem.cpp Outdated
Comment on lines +895 to +898
if (Ty->isPointerTy())
Ty = Ty->getPointerElementType();
if (Ty->isArrayTy())
Ty = Ty->getArrayElementType();
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.

Is it deliberate that this only handles pointers to arrays, and not arrays of pointers or other more complicated nestings?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think so. We don't support array of pointers to resources or target types.

Comment thread tools/clang/test/CodeGenDXIL/hlsl/linalg/matrix-target-type-in-struct.hlsl Outdated
Comment thread lib/DXIL/DxilTypeSystem.cpp Outdated
Comment thread tools/clang/test/CodeGenDXIL/hlsl/linalg/matrix-target-type-in-struct.hlsl Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 26, 2026

✅ With the latest revision this PR passed the C/C++ code formatter.

@hekota hekota enabled auto-merge (squash) March 26, 2026 04:47
Comment thread lib/DXIL/DxilTypeSystem.cpp
@hekota hekota merged commit d013457 into microsoft:main Mar 26, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Mar 26, 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.

[SM6.10] Invalid codegen when LinAlgMatrix type is used in a class

4 participants