Repository navigation
[SM6.10] LinAlg Validation: MatrixLoadFromDescriptor #8641
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
Merged
Ashley Coleman (V-FEXrt)
merged 1 commit into
microsoft:main
from
V-FEXrt:linalg-validation-matrixloadfromdescriptor
Jul 29, 2026
Merged
Changes from all commits
Commits
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
94 changes: 94 additions & 0 deletions
94
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixloadfromdescriptor.ll
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,94 @@ | ||
| ; REQUIRES: dxil-1-10 | ||
| ; RUN: not %dxv %s 2>&1 | FileCheck %s | ||
| target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64" | ||
| target triple = "dxil-ms-dx" | ||
|
|
||
| %dx.types.Handle = type { i8* } | ||
| %dx.types.ResBind = type { i32, i32, i32, i8 } | ||
| %dx.types.ResourceProperties = type { i32, i32 } | ||
| %dx.types.LinAlgMatrixC8M4N4U2S2 = type { i8* } | ||
| %dx.types.LinAlgMatrixC8M4N4U2S0 = type { i8* } | ||
| %dx.types.ResRet.i32 = type { i32, i32, i32, i32, i32 } | ||
| %dx.types.LinAlgMatrixC8M8N8U2S0 = type { i8* } | ||
| %dx.types.LinAlgMatrixC8M16N16U2S0 = type { i8* } | ||
| %dx.types.LinAlgMatrixC8M4N8U2S0 = type { i8* } | ||
| %struct.ByteAddressBuffer = type { i32 } | ||
|
|
||
| define void @main() { | ||
| %1 = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind zeroinitializer, i32 0, i1 false) ; CreateHandleFromBinding(bind,index,nonUniformIndex) | ||
| %2 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer | ||
|
|
||
| ; CHECK: Function: main: error: Matrix scope 'ThreadGroup' requires layout RowMajor or ColumnMajor. | ||
| ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S2 | ||
| %3 = call %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S2(i32 -2147483634, %dx.types.Handle %2, i32 0, i32 0, i32 4, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) | ||
| %4 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer | ||
| ; CHECK-NEXT: Function: main: error: Matrix layout 'OuterProductOptimal' requires stride 0. | ||
| ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S0 | ||
| %5 = call %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S0(i32 -2147483634, %dx.types.Handle %4, i32 0, i32 4, i32 4, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) | ||
| %6 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer | ||
| %7 = call %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32 139, %dx.types.Handle %6, i32 0, i32 undef, i8 1, i32 4) ; RawBufferLoad(srv,index,elementOffset,mask,alignment) | ||
| %8 = extractvalue %dx.types.ResRet.i32 %7, 0 | ||
| ; CHECK-NEXT: Function: main: error: Layout of LinAlgMatrixLoadFromDescriptor must be an immediate constant. | ||
| ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixLoadFromDescriptor.mC8M8N8U2S0 | ||
| %9 = call %dx.types.LinAlgMatrixC8M8N8U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M8N8U2S0(i32 -2147483634, %dx.types.Handle %6, i32 0, i32 0, i32 %8, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) | ||
| %10 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer | ||
| ; CHECK-NEXT: Function: main: error: Stride of LinAlgMatrixLoadFromDescriptor must be an immediate constant. | ||
| ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixLoadFromDescriptor.mC8M16N16U2S0 | ||
| %11 = call %dx.types.LinAlgMatrixC8M16N16U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M16N16U2S0(i32 -2147483634, %dx.types.Handle %10, i32 0, i32 %8, i32 4, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) | ||
| %12 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %1, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer | ||
| ; No error expected for non-imm arg stride on row/col layout | ||
| %13 = call %dx.types.LinAlgMatrixC8M4N8U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N8U2S0(i32 -2147483634, %dx.types.Handle %12, i32 0, i32 %8, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align) | ||
| ret void | ||
| ; CHECK-NEXT: Validation failed. | ||
| } | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare %dx.types.LinAlgMatrixC8M4N4U2S2 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S2(i32, %dx.types.Handle, i32, i32, i32, i32) #0 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare %dx.types.LinAlgMatrixC8M4N4U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N4U2S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 | ||
|
|
||
| ; Function Attrs: nounwind readonly | ||
| declare %dx.types.ResRet.i32 @dx.op.rawBufferLoad.i32(i32, %dx.types.Handle, i32, i32, i8, i32) #1 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare %dx.types.LinAlgMatrixC8M8N8U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M8N8U2S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare %dx.types.LinAlgMatrixC8M16N16U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M16N16U2S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 | ||
|
|
||
| ; Function Attrs: nounwind | ||
| declare %dx.types.LinAlgMatrixC8M4N8U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N8U2S0(i32, %dx.types.Handle, i32, i32, i32, i32) #0 | ||
|
|
||
| ; Function Attrs: nounwind readnone | ||
| declare %dx.types.Handle @dx.op.annotateHandle(i32, %dx.types.Handle, %dx.types.ResourceProperties) #2 | ||
|
|
||
| ; Function Attrs: nounwind readnone | ||
| declare %dx.types.Handle @dx.op.createHandleFromBinding(i32, %dx.types.ResBind, i32, i1) #2 | ||
|
|
||
| attributes #0 = { nounwind } | ||
| attributes #1 = { nounwind readonly } | ||
| attributes #2 = { nounwind readnone } | ||
|
|
||
| !dx.targetTypes = !{!0, !1, !2, !3, !4} | ||
| !llvm.ident = !{!5} | ||
| !dx.version = !{!6} | ||
| !dx.valver = !{!6} | ||
| !dx.shaderModel = !{!7} | ||
| !dx.resources = !{!8} | ||
| !dx.entryPoints = !{!11} | ||
|
|
||
| !0 = !{%dx.types.LinAlgMatrixC8M4N4U2S2 undef, i32 8, i32 4, i32 4, i32 2, i32 2} | ||
| !1 = !{%dx.types.LinAlgMatrixC8M4N4U2S0 undef, i32 8, i32 4, i32 4, i32 2, i32 0} | ||
| !2 = !{%dx.types.LinAlgMatrixC8M8N8U2S0 undef, i32 8, i32 8, i32 8, i32 2, i32 0} | ||
| !3 = !{%dx.types.LinAlgMatrixC8M16N16U2S0 undef, i32 8, i32 16, i32 16, i32 2, i32 0} | ||
| !4 = !{%dx.types.LinAlgMatrixC8M4N8U2S0 undef, i32 8, i32 4, i32 8, i32 2, i32 0} | ||
| !5 = !{!"dxc(private) 1.9.0.5397 (linalg-validation-matrixaccumulate, b4a61ea75-dirty)"} | ||
| !6 = !{i32 1, i32 10} | ||
| !7 = !{!"cs", i32 6, i32 10} | ||
| !8 = !{!9, null, null, null} | ||
| !9 = !{!10} | ||
| !10 = !{i32 0, %struct.ByteAddressBuffer* undef, !"", i32 0, i32 0, i32 1, i32 11, i32 0, null} | ||
| !11 = !{void ()* @main, !"main", null, !8, !12} | ||
| !12 = !{i32 0, i64 16, i32 4, !13} | ||
| !13 = !{i32 1, i32 1, i32 1} |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Even though I guess this is a one-off bit of validation, wondering if this would be clearer if it were factored out into a function rather than inlined in this massive switch statement?
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.
I've been going back and forth a lot on this lol!
There is very little reuse between cases but I still think pulling it out into set functions is probably worth it for readability. Do you mind if I do that cleanup after getting the current gamut of PRs go in?
(Doing the function thing will also help a lot with merge conflict avoidance)
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.
Yeah, no worries with doing this later.