-
Notifications
You must be signed in to change notification settings - Fork 854
[SM6.10] Implement LinAlg groupshared Builtins #8254
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
Changes from 2 commits
e520d0a
28f9487
6ff022c
36b93d5
def194e
8fd6c3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T cs_6_10 -HV 202x -E main %s | FileCheck %s | ||
|
|
||
| // CHECK: @{{.*}} = external addrspace(3) global [64 x float] | ||
| groupshared float SharedArr[64]; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| // CHECK-LABEL: define void @main() | ||
|
|
||
| // CHECK: call void @dx.op.linAlgMatrixAccumulateToMemory.mC4M5N4U1S2.f32(i32 -2147483620, %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, [64 x float] addrspace(3)* nonnull @{{.*}}, i32 1, i32 2, i32 3) ; LinAlgMatrixAccumulateToMemory(matrix,memory,offset,stride,layout) | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
| __builtin_LinAlg_MatrixAccumulateToMemory(mat, SharedArr, 1, 2, 3); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T cs_6_10 -HV 202x -E main %s | FileCheck %s | ||
|
|
||
| // CHECK: @{{.*}} = external addrspace(3) global [64 x float] | ||
| groupshared float SharedArr[64]; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| // CHECK-LABEL: define void @main() | ||
|
|
||
| // CHECK: call %dx.types.LinAlgMatrixC4M5N4U1S2 @dx.op.linAlgMatrixLoadFromMemory.mC4M5N4U1S2.f32(i32 -2147483633, [64 x float] addrspace(3)* nonnull @{{.*}}, i32 1, i32 2, i32 3) ; LinAlgMatrixLoadFromMemory(memory,offset,stride,layout) | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
| __builtin_LinAlg_MatrixLoadFromMemory(mat, SharedArr, 1, 2, 3); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T cs_6_10 -HV 202x -E main %s | FileCheck %s | ||
|
|
||
| // CHECK: @{{.*}} = external addrspace(3) global [64 x float] | ||
| groupshared float SharedArr[64]; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| // CHECK-LABEL: define void @main() | ||
|
|
||
| // CHECK: call void @dx.op.linAlgMatrixStoreToMemory.mC4M5N4U1S2.f32(i32 -2147483627, %dx.types.LinAlgMatrixC4M5N4U1S2 {{.*}}, [64 x float] addrspace(3)* nonnull @{{.*}}, i32 1, i32 2, i32 3) ; LinAlgMatrixStoreToMemory(matrix,memory,offset,stride,layout) | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
| __builtin_LinAlg_MatrixStoreToMemory(mat, SharedArr, 1, 2, 3); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T lib_6_10 -E main %s -ast-dump-implicit | FileCheck %s | ||
|
|
||
| // CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixAccumulateToMemory 'void (__builtin_LinAlgMatrix {{.*}}, float const __attribute__((address_space(3))) (&)[64], unsigned int, unsigned int, unsigned int)' extern | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} memory 'float const __attribute__((address_space(3))) (&)[64]' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int' | ||
| // CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 420 | ||
| // CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 "" | ||
|
|
||
| groupshared float SharedArr[64]; | ||
|
|
||
| [shader("compute")] | ||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
| __builtin_LinAlg_MatrixAccumulateToMemory(mat, SharedArr, 0, 0, 0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // RUN: %dxc -T cs_6_9 -HV 202x -E main %s -verify | ||
|
|
||
| groupshared float SharedArr[64]; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
|
|
||
| // expected-error@+1{{intrinsic __builtin_LinAlg_MatrixAccumulateToMemory potentially used by ''main'' requires shader model 6.10 or greater}} | ||
| __builtin_LinAlg_MatrixAccumulateToMemory(mat, SharedArr, 0, 0, 0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T lib_6_10 -E main %s -ast-dump-implicit | FileCheck %s | ||
|
|
||
| // CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixLoadFromMemory 'void (__builtin_LinAlgMatrix {{.*}}, float const __attribute__((address_space(3))) (&)[64], unsigned int, unsigned int, unsigned int)' extern | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} ret '__builtin_LinAlgMatrix {{.*}}' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} memory 'float const __attribute__((address_space(3))) (&)[64]' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int' | ||
| // CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 411 | ||
| // CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 "" | ||
|
|
||
| groupshared float SharedArr[64]; | ||
|
|
||
| [shader("compute")] | ||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
| __builtin_LinAlg_MatrixLoadFromMemory(mat, SharedArr, 0, 0, 0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // RUN: %dxc -T cs_6_9 -HV 202x -E main %s -verify | ||
|
|
||
| groupshared float SharedArr[64]; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
|
|
||
| // expected-error@+1{{intrinsic __builtin_LinAlg_MatrixLoadFromMemory potentially used by ''main'' requires shader model 6.10 or greater}} | ||
| __builtin_LinAlg_MatrixLoadFromMemory(mat, SharedArr, 0, 0, 0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T lib_6_10 -E main %s -ast-dump-implicit | FileCheck %s | ||
|
|
||
| // CHECK: FunctionDecl {{.*}} implicit used __builtin_LinAlg_MatrixStoreToMemory 'void (__builtin_LinAlgMatrix {{.*}}, float const __attribute__((address_space(3))) (&)[64], unsigned int, unsigned int, unsigned int)' extern | ||
|
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. I think the
Collaborator
Author
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. Tried
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. Oh, yeah that's strange. Now that I think about it, maybe the const refers to the address as opposed to the memory it references. Also, I think groupshared might be adding the reference elsewhere, and adding REF might double that up, which would be bad. I think that function just needs to be updated to handle groupshared. I think that function is only used for intrinsics, which would be why the earlier change that added groupshared support for user function parameters didn't update it.
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. Actually, I think const does apply to the elements. And
Collaborator
Author
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. What would you consider the "right" thing here? Happy to work on the function but I need to know what to work towards lol
Collaborator
Author
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. Maybe another question, is this particular issue something we can push off to an immediate follow up? Helena has a couple PRs blocked on this going in and I have some work that would be nice to build on top of Helena's PRs. Getting this PR in unclogs the system, but I am committed to getting the signature right here.
Collaborator
Author
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. Okay here are all the breakdowns for current possible ParameterModifier::Kind values None of them result in the const not being added so I'm not sure how to move forward here
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. Let's go with IN and file an issue for follow-up.
Collaborator
Author
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. |
||
| // CHECK-NEXT: ParmVarDecl {{.*}} matrix '__builtin_LinAlgMatrix {{.*}}' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} memory 'float const __attribute__((address_space(3))) (&)[64]' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} offset 'unsigned int' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} stride 'unsigned int' | ||
| // CHECK-NEXT: ParmVarDecl {{.*}} layout 'unsigned int' | ||
| // CHECK-NEXT: HLSLIntrinsicAttr {{.*}} Implicit "op" "" 414 | ||
| // CHECK-NEXT: AvailabilityAttr {{.*}} Implicit 6.10 0 0 "" | ||
|
|
||
| groupshared float SharedArr[64]; | ||
|
|
||
| [shader("compute")] | ||
| [numthreads(1,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
| __builtin_LinAlg_MatrixStoreToMemory(mat, SharedArr, 0, 0, 0); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // RUN: %dxc -T cs_6_9 -HV 202x -E main %s -verify | ||
|
|
||
| groupshared float SharedArr[64]; | ||
|
|
||
| [numthreads(4,1,1)] | ||
| void main() { | ||
| __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; | ||
|
|
||
| // expected-error@+1{{intrinsic __builtin_LinAlg_MatrixStoreToMemory potentially used by ''main'' requires shader model 6.10 or greater}} | ||
| __builtin_LinAlg_MatrixStoreToMemory(mat, SharedArr, 0, 0, 0); | ||
| } |
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.
Since this function no longer has any functional changes, this is now a pure refactor. In fact, there are no other changes in this file that are not a result of generated code changes.
That's fine, but I thought it might be good to call that out. Think of this as just a review note.