[SM6.10] LinAlg Validation: Validate Params and K Dim#8588
Open
V-FEXrt wants to merge 6 commits into
Open
Conversation
bob80905
reviewed
Jun 29, 2026
bob80905
left a comment
Collaborator
There was a problem hiding this comment.
I think we should add a test that checks for the new diagnostic.
Contributor
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
bob80905
reviewed
Jun 30, 2026
bob80905
approved these changes
Jun 30, 2026
bob80905
left a comment
Collaborator
There was a problem hiding this comment.
My other comment is a nit, it can be taken or left. Otherwise, LGTM
bob80905
approved these changes
Jun 30, 2026
hekota
reviewed
Jul 1, 2026
Comment on lines
+55
to
+75
| ConstantInt *Ints[5]; | ||
|
|
||
| for (size_t I = 0; I < 5; ++I) { | ||
| ConstantAsMetadata *ConstMDI = | ||
| dyn_cast<ConstantAsMetadata>(MDT->getOperand(I + 1).get()); | ||
| if (!ConstMDI) | ||
| return std::nullopt; | ||
| ConstantInt *CI = dyn_cast<ConstantInt>(ConstMDI->getValue()); | ||
| if (!CI) | ||
| return std::nullopt; | ||
| Ints[I] = CI; | ||
| } | ||
|
|
||
| LinAlgTargetType LATT; | ||
| LATT.Type = static_cast<DXIL::ComponentType>(Ints[0]->getLimitedValue()); | ||
| LATT.M = Ints[1]->getLimitedValue(); | ||
| LATT.N = Ints[2]->getLimitedValue(); | ||
| LATT.Use = static_cast<DXIL::MatrixUse>(Ints[3]->getLimitedValue()); | ||
| LATT.Scope = static_cast<DXIL::MatrixScope>(Ints[4]->getLimitedValue()); | ||
|
|
||
| return {{Ty, LATT}}; |
Member
There was a problem hiding this comment.
(read the next comment first please ;))
This is want I have in mind:
Suggested change
| ConstantInt *Ints[5]; | |
| for (size_t I = 0; I < 5; ++I) { | |
| ConstantAsMetadata *ConstMDI = | |
| dyn_cast<ConstantAsMetadata>(MDT->getOperand(I + 1).get()); | |
| if (!ConstMDI) | |
| return std::nullopt; | |
| ConstantInt *CI = dyn_cast<ConstantInt>(ConstMDI->getValue()); | |
| if (!CI) | |
| return std::nullopt; | |
| Ints[I] = CI; | |
| } | |
| LinAlgTargetType LATT; | |
| LATT.Type = static_cast<DXIL::ComponentType>(Ints[0]->getLimitedValue()); | |
| LATT.M = Ints[1]->getLimitedValue(); | |
| LATT.N = Ints[2]->getLimitedValue(); | |
| LATT.Use = static_cast<DXIL::MatrixUse>(Ints[3]->getLimitedValue()); | |
| LATT.Scope = static_cast<DXIL::MatrixScope>(Ints[4]->getLimitedValue()); | |
| return {{Ty, LATT}}; | |
| uint64_t Ints[5]; | |
| for (size_t I = 0; I < 5; ++I) { | |
| ConstantAsMetadata *ConstMDI = | |
| dyn_cast<ConstantAsMetadata>(MDT->getOperand(I + 1).get()); | |
| if (!ConstMDI) | |
| return; | |
| ConstantInt *CI = dyn_cast<ConstantInt>(ConstMDI->getValue()); | |
| if (!CI) | |
| return; | |
| Ints[I] = CI->getLimitedValue(); | |
| } | |
| auto Result = Map.try_emplace(Ty, static_cast<DXIL::ComponentType>(Ints[0]), | |
| Ints[1], Ints[2], static_cast<DXIL::MatrixUse>(Ints[3]), | |
| static_cast<DXIL::MatrixScope>(Ints[4])); | |
| if (!Result.second) | |
| ;// TODO: validation error - metadata for this type already exists | |
Collaborator
Author
There was a problem hiding this comment.
how strongly do you want the validation error for type already exists?
The map is built up during initialization/before we have access to a ValidationContext (in fact this function call is in the ValContext ctor). If we want to raise an error there, we'll need to do some rearchitecting somewhere.
damyanp
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the following validation rules:
undefis disallowed as a LinAlg builtin parameterThe vast majority of the change is updating tests that were previously out of spec as well as adding new tests that intentionally raise the new validation failures.
Some of the tests are fixed by using the fillmatrix builtin to have an actual matrix SSA value. This will be invalid in some cases but those invalid uses will be much easier to fix as they are found/disallowed by future validation PRs