Skip to content

[SM6.10] LinAlg Validation: MatrixAccumulateToDescriptor - #8743

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

[SM6.10] LinAlg Validation: MatrixAccumulateToDescriptor#8743
Ashley Coleman (V-FEXrt) wants to merge 1 commit into
microsoft:mainfrom
V-FEXrt:linalg-vali-matrixaccumtodescriptor

Conversation

@V-FEXrt

Copy link
Copy Markdown
Collaborator

Fixes #8505

Implement validator rules for MatrixAccumulateToDescriptor

Copilot AI balanced review requested due to automatic review settings August 7, 2026 20:38
}

template <MatrixUseEnum UseLocal = Use>
template <uint Align = 128, MatrixUseEnum UseLocal = Use>

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.

Chris B (@llvm-beanz) This is not in the spec atm but it seems necessary. Does that sound right to you?

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.

Yep. Looks right to me!

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 SM 6.10 validation for MatrixAccumulateToDescriptor.

Changes:

  • Validates matrix layout, stride, use, resource type, and alignment.
  • Defaults thread-scope accumulation alignment to 128.
  • Adds validation coverage and updates existing shader-stage fixtures.

Reviewed changes

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

Show a summary per file
File Description
utils/hct/hctdb.py Adds the RWByteAddressBuffer validation rule.
lib/DxilValidation/DxilValidation.cpp Implements descriptor accumulation validation.
tools/clang/lib/Headers/hlsl/dx/linalg.h Adds configurable 128-byte alignment.
docs/DXIL.rst Documents the new validation diagnostic.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixaccumulatetodescriptor.ll Adds negative validation tests.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-vs.ll Updates vertex-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-raytracing.ll Updates ray-tracing-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ps.ll Updates pixel-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-node.ll Updates node-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ms.ll Updates mesh-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-hs.ll Updates hull-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-gs.ll Updates geometry-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-ds.ll Updates domain-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-cs.ll Updates compute-stage valid IR.
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-as.ll Updates amplification-stage valid IR.
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixaccumulatetodescriptor/nominal.hlsl Updates nominal builtin code generation.
tools/clang/test/CodeGenDXIL/hlsl/linalg/api/matrix-class.hlsl Updates matrix API alignment expectations.

Comment thread lib/DxilValidation/DxilValidation.cpp
Comment thread utils/hct/hctdb.py
"Loading matrix with Thread scope requires ByteAddressBuffer.",
)
self.add_valrule(
"Instr.LinAlgMatrixLoadThreadRequiresRWBAB",
%struct.ByteAddressBuffer = type { i32 }
%struct.RWByteAddressBuffer = type { i32 }

define void @main() {
Comment thread tools/clang/lib/Headers/hlsl/dx/linalg.h
Comment thread lib/DxilValidation/DxilValidation.cpp
DXIL::ResourceClass ResClass;
DXIL::ResourceKind ResKind =
GetResourceKindAndCompTy(Op.get_handle(), ResCompTy, ResClass, ValCtx);
if (ResClass != DXIL::ResourceClass::UAV ||

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.

Like in a previous PR, is an RWByteAddressBuffer the only resource type that would avoid this error emission? I would've hoped to somehow do a direct comparison and see if the resource is an RWBAB, but this might be the only way. Just hoping it isn't too lenient of a check.

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.

looks like https://github.com/microsoft/DirectXShaderCompiler/blob/main/tools/clang/lib/Sema/SemaHLSL.cpp#L5283 also matches but I haven't seen/heard of ROVByteAddressBuffer before so maybe its not spellable?

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: MatrixAccumulateToDescriptor

4 participants