[SM6.10] LinAlg Validation: Fill GetElem SetElem GetCoord - #8759
Conversation
There was a problem hiding this comment.
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
Threadenumerator, so malformed target metadata with any other scope value passes even though the rule requires the scope to be eitherWaveorThreadGroup. Check the two allowed values explicitly.
if (MatLATT.Scope == DXIL::MatrixScope::Thread)
lib/DxilValidation/DxilValidation.cpp:1356
- This only rejects the known
Threadenumerator, so malformed target metadata with any other scope value passes even though the rule requires the scope to be eitherWaveorThreadGroup. Check the two allowed values explicitly.
if (RetMatLATT.Scope == DXIL::MatrixScope::Thread)
lib/DxilValidation/DxilValidation.cpp:1393
- This only rejects the known
Threadenumerator, so malformed target metadata with any other scope value passes even though the rule requires the output scope to be eitherWaveorThreadGroup. 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.
| if (InMatLATT.Scope == DXIL::MatrixScope::Thread) | ||
| ValCtx.EmitInstrFormatError( | ||
| CI, ValidationRule::InstrLinAlgMatrixScopeMismatch2, | ||
| {MatrixScopeToString(InMatLATT.Scope), "Wave", "ThreadGroup"}); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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/ThreadGroupand the source isThread, the validator emits a self-contradictory message such as “Matrix Scope 'Wave' does not match expected scope Wave or ThreadGroup.” ReportSrcLATT.Scopehere 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>
There was a problem hiding this comment.
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. FormatSrcLATT.Scopehere instead.
{MatrixScopeToString(DstLATT.Scope), "Wave", "ThreadGroup"});
Fixes #8698
Fixes #8699
Fixes #8700
Fixes #8701
Implements validation rules for Fill, GetElement, SetElement, and GetCoordinate that all share the same singular rule