[AIROCMLIR-494] Added verifier for migraphx.dot#2238
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a verifier for migraphx.dot (and reuses it for migraphx.quant_dot) to prevent invalid dot shapes—especially invalid batch broadcasting—from being accepted during lowering.
Changes:
- Introduce shared
isValidDotOpverifier logic and wire it intodot/quant_dot. - Add positive MLIR tests for allowed broadcast patterns.
- Add negative MLIR tests for rank/inner-dim/batch-dim mismatches.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| mlir/lib/Dialect/MIGraphX/IR/MIGraphX.cpp | Adds shared dot verification logic and hooks it into DotOp and QuantDotOp. |
| mlir/include/mlir/Dialect/MIGraphX/IR/MIGraphX.td | Enables verifier generation for migraphx.dot via hasVerifier. |
| mlir/test/Dialect/MIGraphX/ops.mlir | Adds positive tests for valid dot broadcasting cases. |
| mlir/test/Dialect/MIGraphX/invalid.mlir | Adds negative tests expecting verifier failures for invalid dot shapes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
umangyadav
approved these changes
Feb 12, 2026
justinrosner
approved these changes
Feb 12, 2026
059bded to
38d85b4
Compare
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.
Motivation
Add invariant for
migraphx.dotoperations. Previously, it was possible to lower A {3, 2, 2, 2} dot B {2, 3, 2, 2} invalid operation under the migraphx->tosa lowering path. Adding this verifier prevents that.Technical Details
This implementation allows for A {3, 2, 2, 2} dot B {1, 2, 2}. Notice that the rank of A and B does not match, but B only has leading ones except the last two dimensions.
Test Plan
Added a lit test
Test Result
Passed lit test.
Submission Checklist