-
Notifications
You must be signed in to change notification settings - Fork 87
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
Change auto contiguous to always insert contiguous #2038
Conversation
This build is not recommended to merge 🔴 |
🔴distilgpt2_fp16: FAILED: MIGraphX is not within tolerance - check verbose output |
src/auto_contiguous.cpp
Outdated
if(not ins->module_inputs().empty()) | ||
m.replace_instruction(ins, ins->get_operator(), new_args, ins->module_inputs()); | ||
else | ||
m.replace_instruction(ins, ins->get_operator(), new_args); |
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 shouldn't replace the input arguments as that can cause multiple contiguous operators to be inserted when its used in multiple places. This should just do:
if(contains({"layout", "contigous"}, ins->name()))
continue;
// for last instruction that is NOT a return
if(ins->outputs().empty() and ins != last)
continue;
shape s = ins->get_shape();
if(s.dynamic())
continue;
if(s.type() == shape::tuple_type)
continue;
if(s.standard() and ins->name() == "@literal")
continue;
auto c = m.insert_instruction(std::next(ins), make_op("contiguous"), ins);
m.replace_instruction(ins, c);
src/auto_contiguous.cpp
Outdated
return in; | ||
} | ||
return m.insert_instruction(ins, make_op("contiguous"), in); | ||
}); |
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.
We should still have this until reshape copy is implemented.
src/auto_contiguous.cpp
Outdated
@@ -59,17 +60,24 @@ void auto_contiguous::apply(module& m) const | |||
auto last = std::prev(m.end()); | |||
for(auto ins : iterator_for(m)) | |||
{ | |||
if(ins->name() == "layout") | |||
if(contains({"layout", "contiguous", "@return", "@param", "@outline"}, ins->name())) |
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.
We shouldn't be skipping @param
, is there a test that fails for that?
I dont think @outline
is used anywhere.
src/eliminate_contiguous.cpp
Outdated
@@ -161,6 +162,18 @@ static void remove_contiguous(const std::string& op_name, module& m, F f) | |||
} | |||
} | |||
|
|||
static void remove_contiguous_noops(const std::string& op_name, 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.
I would spell it nop
with one o
.
test/auto_contiguous_test.cpp
Outdated
auto r = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {2, 1, 12, 5}}}), ca); | ||
m2.add_return({r}); | ||
// extra contiguous coming from reshape logic which has "requires_std_shape" attribute | ||
auto cb = m2.add_instruction(migraphx::make_op("contiguous"), ca); |
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.
We shouldnt have two contiguous. Maybe we should check that the outputs are all contiguous
operators before inserting it in.
continue; | ||
if(s.standard() and ins->name() == "@literal") | ||
continue; | ||
if(s.scalar() and not contains(ins->name(), "broadcast")) |
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.
I would think this would be if(s.scalar() and s.standard())
.
… perform jit compilation
… modes into a separate header
…' into scatter_elements_reduction_modes
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #2038 +/- ##
===========================================
- Coverage 91.43% 91.30% -0.14%
===========================================
Files 461 461
Lines 17419 17451 +32
===========================================
+ Hits 15927 15933 +6
- Misses 1492 1518 +26 ☔ View full report in Codecov by Sentry. |
Why close this out? Guessing rebase and push forward or not needed anymore? |
No description provided.