[SM6.10] LinAlg Validation: MatrixStoreToMemory - #8824
[SM6.10] LinAlg Validation: MatrixStoreToMemory#8824Ashley Coleman (V-FEXrt) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Implements SM 6.10 validation for MatrixStoreToMemory, addressing #8498.
Changes:
- Validates matrix scope, memory type/capacity, offset, and stride.
- Adds DXIL validation and code-generation coverage.
- Documents new validation diagnostics.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
utils/hct/hctdb.py |
Defines new validation rules. |
tools/clang/test/LitDXILValidation/LinAlgMatrix/linalgmatrix-matrixstoretomemory.ll |
Tests validation behavior. |
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixstoretomemory/vector-array.hlsl |
Updates vector-array codegen expectations. |
tools/clang/test/CodeGenDXIL/hlsl/linalg/builtins/matrixstoretomemory/nominal.hlsl |
Updates scalar-array codegen expectations. |
lib/DxilValidation/DxilValidationUtils.h |
Declares component/native-type matching helper. |
lib/DxilValidation/DxilValidationUtils.cpp |
Implements type matching. |
lib/DxilValidation/DxilValidation.cpp |
Implements operation validation. |
docs/DXIL.rst |
Documents diagnostics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| GEPOperator *GSGEP = cast<GEPOperator>(Op.get_memory()); | ||
| GlobalVariable *GSMem = cast<GlobalVariable>(GSGEP->getPointerOperand()); |
| unsigned ElementsPerScalar = ComponentTypeElementsPerScalar(Mat->Type); | ||
| unsigned ExpectedScalarCount = | ||
| (Mat->N + ElementsPerScalar - 1) / ElementsPerScalar * Mat->M; | ||
| if (ExpectedScalarCount > GSScalarCount) |
| @@ -1225,6 +1226,66 @@ static void ValidateLinAlgMatrixStoreToDescriptor(CallInst *CI, | |||
| static void ValidateLinAlgMatrixStoreToMemory(CallInst *CI, | |||
| ValidationContext &ValCtx) { | |||
| ValidateLinAlgOpParameters(CI, ValCtx); | |||
| CI, ValidationRule::InstrLinAlgMatrixScopeMismatch2, | ||
| {"Input", MatrixScopeToString(Mat->Scope), "Wave", "ThreadGroup"}); | ||
|
|
||
| GEPOperator *GSGEP = cast<GEPOperator>(Op.get_memory()); |
There was a problem hiding this comment.
Chris B (@llvm-beanz) I'm pretty sure there is a better way to pull the inner most type out from the memory operator here but I just wanted to get something written down to unblock progress.
Does this seem right or should I do something else here. also can we even assume its always a GEP? Copilot seems to say no but I'm not sure what else it would be
| return OS.str(); | ||
| } | ||
|
|
||
| bool IsComponentTypeSameNativeType(DXIL::ComponentType CT, llvm::Type *Ty) { |
There was a problem hiding this comment.
Chris B (@llvm-beanz) I think this is necessary since we don't really have a mapping for ComponentType to llvm::Type but figured I'd specifically highlight it since imo it's not trivially correct
Fixes #8498
Implements validation rules for MatrixStoreToMemory