-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Clarify the meaning of Shuffle::is_broadcast() #8158
Conversation
I was poking at the Shuffle node, and checking its usage, and it seems that despite the comment, Shuffles that return true for is_broadcast are not the same as a Broadcast node. Instead of repeating the input vector some number of times, it repeats a shuffle of the input vector. This means IRPrinter was incorrect. None of the other usages were bad. This PR makes this clearer in the comment, and fixes IRPrinter.
src/IROperator.cpp
Outdated
@@ -502,7 +502,7 @@ Expr lossless_cast(Type t, Expr e) { | |||
Expr a = lossless_cast(t.narrow(), sub->a); | |||
Expr b = lossless_cast(t.narrow(), sub->b); | |||
if (a.defined() && b.defined()) { | |||
return cast(t, a) + cast(t, b); | |||
return cast(t, a) - cast(t, b); |
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.
uh, what
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.
Oops, a local change from the other PR snuck in. Will revert.
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 but IMHO we'd be better off renaming this method further; having two different things both named "broadcast" is needlessly confusing
A Broadcast node is already capable of repeating vectors, so I actually think this shuffle pattern should be a Broadcast node wrapped around a smaller shuffle, but it's used in ways I don't entirely understand in HexagonOptimize, so it's not a trivial change. I was in the middle of trying to fix the lossless_cast bug though, so I though I'd at least fix the comment rather than get side-tracked. |
Ready to land? |
I was poking at the Shuffle node, and checking its usage, and it seems that despite the comment, Shuffles that return true for is_broadcast are not the same as Broadcast nodes. Instead of repeating the input vector some number of times, it repeats a shuffle of the input vector. This means IRPrinter was incorrect. The other usages were fine.
This PR makes this clearer in the comment, and fixes IRPrinter.