Skip to content

[SM6.10] LinAlg Validation: MatrixLoadFromDescriptor (new rules) - #8721

Open
V-FEXrt wants to merge 3 commits into
microsoft:mainfrom
V-FEXrt:linalg-vali-matrixloadfromdescriptor
Open

[SM6.10] LinAlg Validation: MatrixLoadFromDescriptor (new rules)#8721
V-FEXrt wants to merge 3 commits into
microsoft:mainfrom
V-FEXrt:linalg-vali-matrixloadfromdescriptor

Conversation

@V-FEXrt

@V-FEXrt V-FEXrt commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #8496

New validation rules were added to the spec for MatrixLoadFromDescriptor. This PR implements them and updates the tests

Copilot AI review requested due to automatic review settings July 30, 2026 22:46
; 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 datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There is a lot of test churn in the next 3 files. The majority of this is because when I wrote the tests initially, I directly wrote the DXIL which turned out to be wrong in a couple ways.

  • I was using RWByteAddressBuffer as the template (which is disallowed)
  • I was missing pretty much every annoteHandle which is also illegal DXIL

The new tests have the same CHECKs as before on the same operations so that should be the review focus over the exact test churn

%14 = call %dx.types.LinAlgMatrixC8M4N8U2S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M4N8U2S0(i32 -2147483634, %dx.types.Handle %13, i32 0, i32 %9, i32 0, i32 0) ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)
%15 = call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle %2, %dx.types.ResourceProperties { i32 11, i32 0 }) ; AnnotateHandle(res,props) resource: ByteAddressBuffer


Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is where the new test for the new rules are!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements new SM 6.10 validation rules for MatrixLoadFromDescriptor.

Changes:

  • Adds alignment and Thread-scope resource validation.
  • Adds validation diagnostics and documentation.
  • Updates DXIL and code-generation tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lib/DxilValidation/DxilValidation.cpp Implements the new validator checks.
utils/hct/hctdb.py Defines the new validation rule.
docs/DXIL.rst Documents the diagnostic.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixloadfromdescriptor.ll Tests descriptor-load validation.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-max-k-dim.ll Updates resource setup for existing dimension tests.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-illegal-component-type.ll Updates the illegal-component test resource.
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixloadfromdescriptor/nominal.hlsl Uses a valid 128-byte alignment.
Comments suppressed due to low confidence (1)

tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixloadfromdescriptor.ll:63

  • This negative case uses a raw buffer and therefore tests only UAV versus SRV. Add a Thread-scope load from a non-raw SRV (for example a typed or structured buffer) and expect rejection, so the ByteAddressBuffer half of the new rule cannot regress unnoticed.
  ; CHECK-NEXT: Function: main: error: Loading matrix with Thread scope requires SRV resource.
  ; CHECK-NEXT: note: at {{.*}} @dx.op.linAlgMatrixLoadFromDescriptor.mC8M16N16U0S0
  %18 = call %dx.types.LinAlgMatrixC8M16N16U0S0 @dx.op.linAlgMatrixLoadFromDescriptor.mC8M16N16U0S0(i32 -2147483634, %dx.types.Handle %17, i32 0, i32 %9, i32 0, i32 0)  ; LinAlgMatrixLoadFromDescriptor(handle,offset,stride,layout,align)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Comment thread utils/hct/hctdb.py Outdated
Comment thread docs/DXIL.rst Outdated
Comment thread tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-max-k-dim.ll Outdated
Comment thread lib/DxilValidation/DxilValidation.cpp Outdated

!0 = !{%dx.types.LinAlgMatrixC8M1025N1025U2S0 undef, i32 8, i32 1025, i32 1025, i32 2, i32 0}
!1 = !{%dx.types.LinAlgMatrixC8M16N129U0S0 undef, i32 8, i32 16, i32 129, i32 0, i32 0}
; Below is intentionally removed to cause a missing metadata error

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.

I don't see a check for this missing metadata error?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Its on line 41!

; CHECK: Function: main: error: Metadata must be well-formed in operand count and types.

Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Copilot AI review requested due to automatic review settings July 31, 2026 18:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

Comment thread docs/DXIL.rst Outdated
Copilot AI review requested due to automatic review settings July 31, 2026 21:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

LinAlg Validation: MatrixLoadFromDescriptor

3 participants