-
Notifications
You must be signed in to change notification settings - Fork 160
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
Support mhlo.custom_call op processing #1283
Conversation
c874bd7
to
c49104e
Compare
} | ||
} | ||
|
||
if (!input_placements.empty()) { |
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.
why erase the back char?
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.
why erase the back char?
d,d,d,
---> d,d,d
, remove the last ','
hloOp->setAttr("device", rewriter.getStringAttr("x")); | ||
hloOp->setAttr("input_layouts", rewriter.getStringAttr("*")); | ||
hloOp->setAttr("output_layouts", rewriter.getStringAttr("*")); | ||
hloOp->setAttr("expected_input_layouts", rewriter.getStringAttr("*")); |
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.
input/output layouts should have the same operand number as input/output.
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.
Fixed
auto newCustomAttrs = DictionaryAttr::get(hloOp->getContext(), newAttrs); | ||
hloOp->setAttr("custom_attrs", newCustomAttrs); | ||
|
||
if (hloOp->getNumResults() == 1 && |
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.
how do we deal with two results operand of tuple<>, Value
? Maybe we can return a failure message If we don't want to deal with this situation.
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.
Fixed
9fe8d0d
to
a68bb67
Compare
a68bb67
to
2d5c87d
Compare
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.
LGTM
std::string input_placements, output_placements; | ||
std::string input_layouts, output_layouts; | ||
for (int i = 0; i < operands.size(); i++) { | ||
input_placements += "d,"; |
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.
maybe absl::StrAppend
can achieve better performance.
We convert
mhlo.custom_call
tomhlo_disc.custom_call_v2
and do tuple expansion during this conversion.