-
Notifications
You must be signed in to change notification settings - Fork 828
[SM6.10] Add built-in type for LinAlg Matrix handle #8090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hekota
wants to merge
10
commits into
microsoft:main
Choose a base branch
from
hekota:matrix-builtin-handle-type
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5390e54
[SM6.10] Add built-in type for LinAlg Matrix handle
hekota be693b2
Fallback to default debug infor handling
hekota ed855c6
Fix type name string
hekota 9b6f7a7
chore: autopublish 2026-01-29T18:27:59Z
github-actions[bot] deaac93
Merge branch 'main' of https://github.com/microsoft/DirectXShaderComp…
hekota 716c63a
Move tests back under linalg/builtins
hekota 8e956a8
Update __buitin_LinAlg_Matrix codegen
hekota 2e32605
Merge branch 'main' of https://github.com/microsoft/DirectXShaderComp…
hekota e9a6bb6
Code review feedback
hekota eea0b2b
Rename the type to __builtin_LinAlgMatrix
hekota File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,9 @@ serialization::TypeIdxFromBuiltin(const BuiltinType *BT) { | |
| case BuiltinType::OCLImage3d: ID = PREDEF_TYPE_IMAGE3D_ID; break; | ||
| case BuiltinType::OCLSampler: ID = PREDEF_TYPE_SAMPLER_ID; break; | ||
| case BuiltinType::OCLEvent: ID = PREDEF_TYPE_EVENT_ID; break; | ||
| case BuiltinType::LinAlgMatrix: | ||
| ID = PREDEF_TYPE_LINALG_MATRIX_ID; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine, but we never supported AST serialization in this code base, and there are many missing pieces already. That's why we never added the other HLSL types here. |
||
| break; | ||
| case BuiltinType::BuiltinFn: | ||
| ID = PREDEF_TYPE_BUILTIN_FN; break; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tools/clang/test/SemaHLSL/hlsl/linalg/builtins/builtin-matrix-handle-type-ast.hlsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T lib_6_10 -ast-dump %s | FileCheck %s | ||
|
|
||
| // CHECK: CXXRecordDecl {{.*}} struct S definition | ||
| // CHECK: FieldDecl {{.*}} handle '__builtin_LinAlgMatrix':'__builtin_LinAlgMatrix' | ||
| struct S { | ||
| __builtin_LinAlgMatrix handle; | ||
| }; | ||
|
|
||
| // CHECK: VarDecl {{.*}} global_handle '__builtin_LinAlgMatrix':'__builtin_LinAlgMatrix' | ||
| __builtin_LinAlgMatrix global_handle; | ||
|
|
||
| // CHECK: FunctionDecl {{.*}} f1 'void (__builtin_LinAlgMatrix)' | ||
| // CHECK: ParmVarDecl {{.*}} m '__builtin_LinAlgMatrix':'__builtin_LinAlgMatrix' | ||
| void f1(__builtin_LinAlgMatrix m); | ||
|
|
||
| // CHECK: FunctionDecl {{.*}} f2 '__builtin_LinAlgMatrix ()' | ||
| __builtin_LinAlgMatrix f2(); | ||
|
|
||
| // CHECK: FunctionDecl {{.*}} main 'void ()' | ||
| // CHECK-NEXT: CompoundStmt | ||
| // CHECK-NEXT: DeclStmt | ||
| // CHECK-NEXT: VarDecl {{.*}} m '__builtin_LinAlgMatrix':'__builtin_LinAlgMatrix' | ||
| [shader("compute")] | ||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix m; | ||
| } |
47 changes: 47 additions & 0 deletions
47
tools/clang/test/SemaHLSL/hlsl/linalg/builtins/builtin-matrix-handle-type.hlsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T lib_6_10 -verify %s | ||
|
|
||
| __builtin_LinAlgMatrix global_handle; | ||
|
|
||
| static __builtin_LinAlgMatrix static_handle; | ||
|
|
||
| groupshared __builtin_LinAlgMatrix gs_handle; | ||
|
|
||
| __builtin_LinAlgMatrix array[2]; | ||
|
|
||
| cbuffer CB { | ||
| __builtin_LinAlgMatrix cb_handle; | ||
| }; | ||
|
|
||
| struct S { | ||
| __builtin_LinAlgMatrix handle; | ||
| }; | ||
|
|
||
| S s; | ||
|
|
||
| void f1(__builtin_LinAlgMatrix m); | ||
|
|
||
| __builtin_LinAlgMatrix f2(); | ||
|
|
||
| // expected-error@+1 {{typedef redefinition with different types ('int' vs '__builtin_LinAlgMatrix')}} | ||
| typedef int __builtin_LinAlgMatrix; | ||
|
|
||
| [shader("compute")] | ||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix m; | ||
|
|
||
| m = s.handle; | ||
|
|
||
| f1(m); | ||
| m = f2(); | ||
|
|
||
| // expected-error@+1 {{numeric type expected}} | ||
| m++; | ||
|
|
||
| // expected-error@+1 {{numeric type expected}} | ||
| m = m * 2; | ||
|
|
||
| // expected-error@+1 {{numeric type expected}} | ||
| bool a = m && s.handle; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before, don't we need to capture matrix properties into mangling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mangling of just the base built-in type, which can be spell out in the code, although the
__builtinprefix should discourage people from doing that. The attributes are added in a separate PR.