-
Notifications
You must be signed in to change notification settings - Fork 98
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
[aievec] to-llvm/to-cpp flow for emulated fp32xfp32 mul elem #1239
Conversation
Arguments<(ins VectorOfLengthAndType<[16], [I64]>:$a, | ||
I32:$shft, | ||
I32:$sign)>; | ||
|
||
def I256V32Acc32SrsIntrOp : | ||
AIEVec2_IntrOp<"I256.v32.acc32.srs", | ||
[TypeIs<"res", VectorOfLengthAndType<[32], [I8]>>]>, | ||
Arguments<(ins VectorOfLengthAndType<[16], [I64]>:$lhs, | ||
Arguments<(ins VectorOfLengthAndType<[16], [I64]>:$a, | ||
I32:$shft, | ||
I32:$sign)>; | ||
|
||
def I512V16Acc64SrsIntrOp : | ||
AIEVec2_IntrOp<"I512.v16.acc64.srs", | ||
[TypeIs<"res", VectorOfLengthAndType<[16], [I32]>>]>, | ||
Arguments<(ins VectorOfLengthAndType<[16], [I64]>:$lhs, | ||
Arguments<(ins VectorOfLengthAndType<[16], [I64]>:$a, | ||
I32:$shft, | ||
I32:$sign)>; | ||
|
||
def Vector16AccFloatToV16BF16IntrOp : | ||
AIEVec2_IntrOp<"v16accfloat.to.v16bf16", | ||
[TypeIs<"res", VectorOfLengthAndType<[16], [BF16]>>]>, | ||
Arguments<(ins VectorOfLengthAndType<[8], [I64]>:$lhs)>; | ||
Arguments<(ins VectorOfLengthAndType<[8], [I64]>:$a)>; |
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.
Nit.: Can we find names for the arguments better than "a"? I also don't understand why the "shift" parameter can't just be named just "shift" instead of "shft".
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 tried to follow the naming convention from the the definition of CPP intrinsics. Here are some examples.
INTRINSIC(v16accfloat) msc_elem_16_2(v32bfloat16 a, v32bfloat16 b, v16accfloat acc1) {
INTRINSIC(v16accfloat) mac_elem_16_2(v32bfloat16 a, v32bfloat16 b, v16accfloat acc1) {
INTRINSIC(v32bfloat16) insert(v32bfloat16 a, int idx, v16bfloat16 b) {
INTRINSIC(v16accfloat) ups_to_v16accfloat(v16bfloat16 a) {
INTRINSIC(v32int16) lsrs(v32acc32 acc, int shft, int sign) {
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.
But these are not C++ intrinsics, these are LLVM IR intrinsics, and we should do better than "a/b/c" anyway.
class AIE2bf16MACConf : | ||
Arguments<(ins VectorOfLengthAndType<[32], [BF16]>:$lhs, | ||
VectorOfLengthAndType<[32], [BF16]>:$rhs, | ||
VectorOfLengthAndType<[8], [I64]>:$acc, | ||
I32:$conf)>; | ||
|
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.
Neat!
This PR add the support to the emulated fp32xfp32 elementwise multiplication going through the to-llvm and to-cpp flow.
Changes: