Skip to content

[SM6.10] LinAlg Validation: Fill GetElem SetElem GetCoord - #8759

Merged
Ashley Coleman (V-FEXrt) merged 4 commits into
microsoft:mainfrom
V-FEXrt:linalg-vali-nothread
Aug 13, 2026
Merged

[SM6.10] LinAlg Validation: Fill GetElem SetElem GetCoord#8759
Ashley Coleman (V-FEXrt) merged 4 commits into
microsoft:mainfrom
V-FEXrt:linalg-vali-nothread

Conversation

@V-FEXrt

Copy link
Copy Markdown
Collaborator

Fixes #8698
Fixes #8699
Fixes #8700
Fixes #8701

Implements validation rules for Fill, GetElement, SetElement, and GetCoordinate that all share the same singular rule

Copilot AI balanced review requested due to automatic review settings August 10, 2026 21:31

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

Adds SM 6.10 validation requiring selected LinAlg matrix operations to use Wave or ThreadGroup scope.

Changes:

  • Adds scope validation and diagnostics for Fill, GetElement, SetElement, and GetCoordinate.
  • Adds invalid Thread-scope validation coverage.
  • Updates affected LinAlg tests to use valid initialization paths and scopes.

Reviewed changes

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

Show a summary per file
File Description
utils/hct/hctdb.py Defines the new scope-mismatch rule.
lib/DxilValidation/DxilValidation.cpp Implements scope validation.
docs/DXIL.rst Documents the diagnostic.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-non-thread-ops.ll Tests rejected Thread scopes.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-copyconvert.ll Avoids invalid Thread-scope Fill setup.
tools/clang/test/CodeGenDXIL/hlsl/linalg/trim-target-types-metadata-lib.hlsl Updates library metadata expectations.
tools/clang/test/CodeGenDXIL/hlsl/linalg/trim-target-types-metadata-compute.hlsl Updates compute metadata expectations.
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiplyadd/nominal.hlsl Loads Thread matrices from descriptors.
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixvectormultiply/nominal.hlsl Replaces invalid Thread-scope Fill.
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/nominal.hlsl Uses a valid Wave-scoped accumulator.
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/fillmatrix/nominal.hlsl Covers valid Wave and ThreadGroup Fill operations.
Suppressed comments (4)

lib/DxilValidation/DxilValidation.cpp:1121

  • This only rejects the known Thread enumerator, so malformed target metadata with any other scope value passes even though the rule requires the scope to be either Wave or ThreadGroup. Check the two allowed values explicitly.
  if (MatLATT.Scope == DXIL::MatrixScope::Thread)

lib/DxilValidation/DxilValidation.cpp:1356

  • This only rejects the known Thread enumerator, so malformed target metadata with any other scope value passes even though the rule requires the scope to be either Wave or ThreadGroup. Check the two allowed values explicitly.
  if (RetMatLATT.Scope == DXIL::MatrixScope::Thread)

lib/DxilValidation/DxilValidation.cpp:1393

  • This only rejects the known Thread enumerator, so malformed target metadata with any other scope value passes even though the rule requires the output scope to be either Wave or ThreadGroup. Check the two allowed values explicitly.
  if (RetMatLATT.Scope == DXIL::MatrixScope::Thread)

tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/fillmatrix/nominal.hlsl:33

  • The new comment says this is a 3×4 matrix, but the attributes and checks use M=8 and N=4. Keep the explanatory type synchronized with the test input.
  // Matrix<U32, 3, 4, A, ThreadGroup>

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Comment thread lib/DxilValidation/DxilValidation.cpp Outdated
Comment on lines +1388 to +1391
if (InMatLATT.Scope == DXIL::MatrixScope::Thread)
ValCtx.EmitInstrFormatError(
CI, ValidationRule::InstrLinAlgMatrixScopeMismatch2,
{MatrixScopeToString(InMatLATT.Scope), "Wave", "ThreadGroup"});

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.

Had a quick chat with some folks and instead of showing just one error its better to still show both errors but to name the precise matrix failing the check in the error (so the two errors are not identical).

Doing this the right way (for all errors that point at a specific matrix) requires a larger change that I'm going to punt to an independent PR.

#8768

Comment thread lib/DxilValidation/DxilValidation.cpp
Comment thread tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/fillmatrix/nominal.hlsl Outdated
Comment thread tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/fillmatrix/nominal.hlsl Outdated
Copilot AI review requested due to automatic review settings August 12, 2026 17:47

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 12 out of 12 changed files in this pull request and generated no new comments.

Suppressed comments (2)

lib/DxilValidation/DxilValidation.cpp:1591

  • This source-scope failure formats the destination scope. When the destination is Wave/ThreadGroup and the source is Thread, the validator emits a self-contradictory message such as “Matrix Scope 'Wave' does not match expected scope Wave or ThreadGroup.” Report SrcLATT.Scope here instead.
    tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/fillmatrix/nominal.hlsl:33
  • The comment says this matrix has 3 rows, while both the attribute and FileCheck expectations define an 8x4 matrix.
  // Matrix<U32, 3, 4, A, ThreadGroup>

Copilot AI review requested due to automatic review settings August 12, 2026 17:50

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 12 out of 12 changed files in this pull request and generated no new comments.

Suppressed comments (2)

tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/fillmatrix/nominal.hlsl:33

  • This comment says the matrix is 3x4, but both the target-type checks and the declaration below use 8x4. Update the comment so it accurately documents the test case.
  // Matrix<U32, 3, 4, A, ThreadGroup>

lib/DxilValidation/DxilValidation.cpp:1590

  • This source-scope diagnostic formats DstLATT.Scope, so a Thread-scoped source paired with a legal Wave/ThreadGroup destination reports the destination's legal scope as the offender. Format SrcLATT.Scope here instead.
        {MatrixScopeToString(DstLATT.Scope), "Wave", "ThreadGroup"});

Copilot AI review requested due to automatic review settings August 12, 2026 17:58

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 12 out of 12 changed files in this pull request and generated no new comments.

@V-FEXrt
Ashley Coleman (V-FEXrt) merged commit 284abd2 into microsoft:main Aug 13, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Aug 13, 2026
@V-FEXrt
Ashley Coleman (V-FEXrt) deleted the linalg-vali-nothread branch August 13, 2026 00:45
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.

LinAlg Validation: MatrixSetElement LinAlg Validation: MatrixGetElement LinAlg Validation: MatrixGetCoordinate LinAlg Validation: FillMatrix

4 participants