-
Notifications
You must be signed in to change notification settings - Fork 25
[AIE2P] Fix broadcast intrinsics. #503
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
base: aie-public
Are you sure you want to change the base?
Conversation
824913c
to
526ab7c
Compare
@@ -1354,10 +1354,10 @@ INTRINSIC(void *) extract_address(v16int32 v, int idx) { | |||
} | |||
// broadcast from scalar (alternative syntax to broadcast to vector) | |||
INTRINSIC(v64int8) | |||
broadcast_s8(char b) { return b - v64int8{0}; } | |||
broadcast_s8(int b) { return (char)b - v64int8{0}; } |
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.
Can we update the tests as well?
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.
As I remember, we reused aie2 tests for aie2p as well. Since at it, can you please fix it for aie2 as well.
@@ -1354,10 +1354,10 @@ INTRINSIC(void *) extract_address(v16int32 v, int idx) { | |||
} | |||
// broadcast from scalar (alternative syntax to broadcast to vector) | |||
INTRINSIC(v64int8) | |||
broadcast_s8(char b) { return b - v64int8{0}; } | |||
broadcast_s8(int b) { return (char)b - v64int8{0}; } |
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.
v64int8{b} doesn't work?
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.
No, that will only initialize the first element of the vector with b
.
But the subtraction (char)b - v64int8{0}
is performed element-wise due to how vector types work, effectively resulting in a vector where each element is b
.
We don't even need to specify 0
when initializing a v64int8
vector, since all elements of a vector are initialized to 0
by default.
So (char)b - v64int8{}
will also work.
|
||
INTRINSIC(v32int16) | ||
broadcast_s16(short b) { return b - v32int16{0}; } | ||
broadcast_s16(int b) { return (short)b - v32int16{0}; } |
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 weren't we happy with implicit casting?
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.
short b is promoted to int
No description provided.