Add support for migraphx.max#2429
Conversation
There was a problem hiding this comment.
Verdict: APPROVE -- submitted as COMMENT (automated reviews are advisory) · Findings: 0 (0 Critical, 0 Major, 0 Minor)
Scope
Adds a new migraphx.max elementwise binary op to support efficient leaky relu. The change registers the op in MIGraphX.td (with Commutative), wires up lowerings to linalg.max and tosa.maximum, and adds Lit conversion tests.
Findings
No blocking issues found.
Notes
- The op definition, both conversion registrations, and the tests all follow the established elementwise-binary-op patterns in each file exactly.
Commutativeis appropriate formax. - Dtype coverage on the TOSA path is good (f32/f16/i32 tests). The Linalg test covers only f32, but that is consistent with the convention used by the other elementwise ops in
mixr-to-linalg-ops.mlir, so no gap is introduced. - Consider (optional, out of scope) adding a negative/verifier Lit test in a follow-up if
migraphx.maxshould reject mismatched element types, thoughAllElementTypesMatchon the base class already provides this and mirrors sibling ops that also lack such a test.
CI status
No non-self CI checks are in the fail/cancel buckets. The passing premerge checks (C/C++, Python format/lint) are green; the remaining Jenkins/Build/MIGraphX checks are still pending. The auto-review pipeline's own review check being in-progress is expected and not a CI failure.
There was a problem hiding this comment.
Pull request overview
This PR adds a new MIGraphX dialect elementwise binary op (migraphx.max) and wires it into existing MIGraphX lowering pipelines so it can be converted to both TOSA and Linalg IR.
Changes:
- Introduces
MIGraphX_MaxOp(migraphx.max) in the MIGraphX dialect TableGen. - Adds MIGraphX→TOSA lowering via
tosa.maximum. - Adds MIGraphX→Linalg lowering via
linalg.maxand extends conversion tests accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mlir/include/mlir/Dialect/MIGraphX/IR/MIGraphX.td | Adds MIGraphX_MaxOp as an elementwise binary op (commutative). |
| mlir/lib/Conversion/MIGraphXToTosa/MIGraphXToTosa.cpp | Registers migraphx.max lowering to tosa.maximum. |
| mlir/lib/Conversion/MIGraphXToLinalg/MIGraphXToLinalg.cpp | Registers migraphx.max lowering to linalg.max. |
| mlir/test/Conversion/MIGraphXToTosa/mixr-to-tosa-ops.mlir | Adds FileCheck coverage for max lowering (f32/f16/i32). |
| mlir/test/Conversion/MIGraphXToLinalg/mixr-to-linalg-ops.mlir | Adds FileCheck coverage for max lowering to linalg.max. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2429 +/- ##
===========================================
+ Coverage 82.57% 82.92% +0.35%
===========================================
Files 120 120
Lines 42852 42830 -22
Branches 7110 7106 -4
===========================================
+ Hits 35381 35514 +133
+ Misses 4815 4693 -122
+ Partials 2656 2623 -33
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
pabloantoniom
left a comment
There was a problem hiding this comment.
What's the plan for backporting to rocmlirTriton?
Motivation
The
migraphx.maxis needed to support leaky relu efficiently.Technical Details
Test Plan
Test Result
Submission Checklist