[SM6.10] LinAlg Validation: MatrixAccumulateToDescriptor - #8743
[SM6.10] LinAlg Validation: MatrixAccumulateToDescriptor#8743Ashley Coleman (V-FEXrt) wants to merge 1 commit into
Conversation
| } | ||
|
|
||
| template <MatrixUseEnum UseLocal = Use> | ||
| template <uint Align = 128, MatrixUseEnum UseLocal = Use> |
There was a problem hiding this comment.
Chris B (@llvm-beanz) This is not in the spec atm but it seems necessary. Does that sound right to you?
There was a problem hiding this comment.
Yep. Looks right to me!
There was a problem hiding this comment.
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. |
| "Loading matrix with Thread scope requires ByteAddressBuffer.", | ||
| ) | ||
| self.add_valrule( | ||
| "Instr.LinAlgMatrixLoadThreadRequiresRWBAB", |
| %struct.ByteAddressBuffer = type { i32 } | ||
| %struct.RWByteAddressBuffer = type { i32 } | ||
|
|
||
| define void @main() { |
| DXIL::ResourceClass ResClass; | ||
| DXIL::ResourceKind ResKind = | ||
| GetResourceKindAndCompTy(Op.get_handle(), ResCompTy, ResClass, ValCtx); | ||
| if (ResClass != DXIL::ResourceClass::UAV || |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
okay its certainly spellable! Looking at the Validator, it doesn't seem like we have a good way ATM to determine if its ROV or RWByteAddressBuffer. But since we don't have an ROV overload defined in gen_intrin_main (only RWBAB is defined) the only way to hit the ROV case is to hand construct the DXIL manually to use an ROV.
I think anyone hand constructing DXIL would know well enough that using an ROV is holding it wrong, so my temptation is to say that we just don't fix this for now but I'm open to hear your thoughts
Fixes #8505
Implement validator rules for MatrixAccumulateToDescriptor