-
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
Optimize broadcast + transpose for nonscalars #2271
Changes from all commits
00dae07
0dc81c3
c90f3b7
fc38213
3bc7708
8d7948a
b4a9a9c
f385f43
827d22e
337787d
ea62d7a
870cff3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. | ||
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -669,6 +669,23 @@ TEST_CASE(simplify_inner_broadcast_different_broadcasts) | |
EXPECT(m1 == m2); | ||
} | ||
|
||
TEST_CASE(simplify_inner_broadcast_no_common_axis) | ||
{ | ||
auto b = migraphx::make_op("multibroadcast", {{"out_lens", {1, 5, 10}}}); | ||
migraphx::module m1; | ||
{ | ||
auto x = m1.add_parameter("x", {migraphx::shape::int32_type, {5, 10}}); | ||
auto y = m1.add_parameter("y", {migraphx::shape::int32_type, {1, 5, 1}}); | ||
auto xb = m1.add_instruction(b, x); | ||
auto yb = m1.add_instruction(b, y); | ||
auto sum = m1.add_instruction(migraphx::make_op("add"), xb, yb); | ||
m1.add_instruction(pass_op{}, sum); | ||
Comment on lines
+681
to
+682
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do you have a test for this specific case where multibroadcasts are appearing after find_inner_broadcast that are not being cleaned up by simplify_reshapes ? because for this test it will add multibroadcast but later i think it will get cleaned up by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this exact test will fail currently on develop and insert a bunch of multibroadcasts:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those multi broadcasts should get cleaned up by find_nop_reshaper later There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also where all those broadcasts are being added. Looks to me that find_inner_broadcast would only add one multibroadcast after add |
||
} | ||
migraphx::module m2 = m1; | ||
run_pass(m1); | ||
EXPECT(m1 == m2); | ||
} | ||
|
||
TEST_CASE(simplify_add_conv1) | ||
{ | ||
migraphx::module m; | ||
|
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.
You could use
std::none_of
instead.