Skip to content

[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

Open
wants to merge 1 commit into
base: aie-public
Choose a base branch
from

Conversation

SagarMaheshwari99
Copy link
Collaborator

No description provided.

@@ -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}; }
Copy link
Collaborator

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?

Copy link
Collaborator

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}; }
Copy link
Collaborator

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?

Copy link
Collaborator Author

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}; }
Copy link
Collaborator

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?

Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants