feat(onnx-to-hip): fold attention score prep Mul and broadcast Add - #658
Draft
amd-mounikk wants to merge 6 commits into
Draft
feat(onnx-to-hip): fold attention score prep Mul and broadcast Add#658amd-mounikk wants to merge 6 commits into
amd-mounikk wants to merge 6 commits into
Conversation
Add pre-lowering patterns that run before lowerOnnxConstants: - FoldMatMulScaleMul: MatMul(A,B)->Mul(scores,scale) becomes Mul(A,scale)->MatMul - ExpandConstantBroadcastAdd: compile-time expand broadcast constant biases to same-shape Add Includes LIT coverage for both optimizations. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks for opening a PR! This project follows LLVM's incremental-development and AI-tool-use Before requesting review, please check that:
Reviewers are assigned through |
The full convert-onnx-to-hip pipeline lowers expanded onnx.Constant to arith.constant before hip.add. Update FileCheck to match actual output. Co-authored-by: Cursor <cursoragent@cursor.com>
L2 Accuracy Results (EP vs CPU)
Threshold: 0.01 | Run: 3998 - Commit: |
MorphiZen EP Performance Results
EPContext Export Performance
EPContext Import Performance
OGA Benchmark Results
OGA Wheel Smoke (Python benchmark_e2e.py)
Run: 3998 - Commit: |
amd-mounikk
marked this pull request as ready for review
August 4, 2026 15:30
amd-mounikk
requested review from
amd-bqiao,
amd-mingw,
edelaye,
fhanuman,
qianglin-amd and
wcy123
as code owners
August 4, 2026 15:30
…tion-score-prep-opt
fhanuman
reviewed
Aug 11, 2026
…tion-score-prep-opt
Tighten FoldMatMulScaleMul so scale must be constant along MatMul K and N, rejecting column-scale patterns that would change numerics if folded onto A. Cap ExpandConstantBroadcastAdd at 1 Mi output elements to avoid materializing multi-GB broadcast constants at compile time. Add lit tests for both cases. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
amd-mounikk
marked this pull request as draft
August 12, 2026 21:26
fhanuman
approved these changes
Aug 12, 2026
fhanuman
left a comment
Collaborator
There was a problem hiding this comment.
I will approve the PR to unblock the merge. However, I am still not clear on how much this change improves performance, so in future PRs like this, it would be helpful to include an example showing where it helps and some before-and-after performance numbers.
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.
Summary
Test plan