Skip to content

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

Open
Ashley Coleman (V-FEXrt) wants to merge 1 commit into
microsoft:mainfrom
V-FEXrt:linalg-vali-nothread
Open

[SM6.10] LinAlg Validation: Fill GetElem SetElem GetCoord#8759
Ashley Coleman (V-FEXrt) wants to merge 1 commit 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.

return;
LinAlgTargetType MatLATT = MatIt->second;

if (MatLATT.Scope == DXIL::MatrixScope::Thread)
Comment on lines +1347 to +1348
DxilInst_LinAlgMatrixSetElement Op(CI);
Type *RetMatTy = CI->getType();
Comment on lines +1388 to +1391
if (InMatLATT.Scope == DXIL::MatrixScope::Thread)
ValCtx.EmitInstrFormatError(
CI, ValidationRule::InstrLinAlgMatrixScopeMismatch2,
{MatrixScopeToString(InMatLATT.Scope), "Wave", "ThreadGroup"});
ValidationContext &ValCtx) {
ValidateLinAlgOpParameters(CI, ValCtx);

DxilInst_LinAlgMatrixGetCoordinate Op(CI);
__builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(5, 3, 4, 0, 0)]] mat2;
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC5M8N4U0S1*, float)"
// CHECK2-SAME: (i32 402, %dx.types.LinAlgMatrixC5M8N4U0S1* {{.*}}, float 0x40091EB860000000)
// Matrix<U32, 3, 4, A, Wave>
// CHECK2-SAME: (i32 402, %dx.types.LinAlgMatrixC5M3N4U0S0* {{.*}}, i64 %{{.+}})
// CHECK2: call void @"dx.hl.op..void (i32, %dx.types.LinAlgMatrixC5M4N4U1S1*, i64)"
// CHECK2-SAME: (i32 402, %dx.types.LinAlgMatrixC5M4N4U1S1* {{.*}}, i64 %{{.+}})
// Matrix<U32, 3, 4, B, Wave>
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: MatrixSetElement LinAlg Validation: MatrixGetElement LinAlg Validation: MatrixGetCoordinate LinAlg Validation: FillMatrix

3 participants