-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broadcast with dims matcher #2927
Conversation
…and a test case to simplify_dyn_ops_test
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## expand_dyn_op #2927 +/- ##
==============================================
Coverage 91.83% 91.84%
==============================================
Files 480 480
Lines 18357 18369 +12
==============================================
+ Hits 16859 16871 +12
Misses 1498 1498 ☔ View full report in Codecov by Sentry. |
That's not a fully correct statement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update this PR to merge some changes
src/simplify_dyn_ops.cpp
Outdated
* This conversion is required to be made since runtime target ops can only output | ||
* static shapes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
Co-authored-by: Charlie Lin <[email protected]>
@@ -966,6 +966,30 @@ TEST_CASE(broadcast_for_dot_dyn2) | |||
s0); | |||
} | |||
|
|||
TEST_CASE(broadcast_with_dims0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CharlieL7 I think these two tests were from you, but Github is showing them as new to this PR. Did you mean to keep them, or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests look the same to me, just moved around.
@@ -34,6 +34,36 @@ void run_pass(migraphx::module& m) | |||
migraphx::run_passes(m, {migraphx::simplify_dyn_ops{}, migraphx::dead_code_elimination{}}); | |||
} | |||
|
|||
TEST_CASE(broadcast_with_dims) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CharlieL7 can you think of any other tests needed for this matcher PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please add a negative test, with dimensions that cannot be multi-broadcasted.
- Approving the PR.
Thanks.
@CharlieL7 , Chris asked that we merge this PR into #2799 instead of waiting for that one to be merged into |
Yeah, that's fine |
@bpickrel please fix the merge conflict |
Add a matcher to
simplify_dyn_ops
which replacesbroadcast_with_dims
(OnnxExpand
) with the equivalentmultibroadcast
with a fixed output shape attribute.This conversion is not just a simplification but is required for this op. to run at all since a definite output shape is needed at runtime.
broadcast_with_dims
has a dynamic output shape at compile time, and this matcher replaces it with a fixed value that is available at runtime.