-
Notifications
You must be signed in to change notification settings - Fork 76
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
Adding type constraints for aievec::mul_elem operation #1514
base: main
Are you sure you want to change the base?
Adding type constraints for aievec::mul_elem operation #1514
Conversation
`vector<32xi8>` | `vector<32xi8>` | `vector<32xi8>` | ||
`vector<32xi8>` | `vector<32xi8>` | `vector<32xi32>` | ||
`vector<64xi8>` | `vector<64xi8>` | `vector<32xi32>` | ||
`vector<32xi16>` | `vector<32xi16>` | `vector<32xi16>` | ||
`vector<32xi16>` | `vector<32xi16>` | `vector<32xi32>` | ||
`vector<32xi16>` | `vector<32xi16>` | `vector<16xi64>` | ||
`vector<16xi32>` | `vector<16xi32>` | `vector<16xi32>` | ||
`vector<16xi32>` | `vector<16xi32>` | `vector<16xi64>` | ||
`vector<16xbf16>` | `vector<16xbf16>` | `vector<16xbf16>` | ||
`vector<16xbf16>` | `vector<16xbf16>` | `vector<16xf32>` | ||
`vector<16xf32>` | `vector<16xf32>` | `vector<16xf32>`' |
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.
We should just have:
`vector<32xi8>` | `vector<32xi8>` | `vector<32xi32>`
`vector<32xi16>` | `vector<32xi16>` | `vector<32xi32>`
`vector<16xi32>` | `vector<16xi32>` | `vector<16xi64>`
`vector<16xbf16>` | `vector<16xbf16>` | `vector<16xf32>`
`vector<16xf32>` | `vector<16xf32>` | `vector<16xf32>`
These operations refer to the following intrinsics in the table at https://www.xilinx.com/htmldocs/xilinx2023_2/aiengine_ml_intrinsics/intrinsics/group__intr__gpvectorop__mul.html.
8-bit x 8-bit = 32-bit, 32, 1x2, 2x1, 1x1
16-bit x 16-bit = 32-bit, 32, 1x1, 1x1, 1x1
bfloat16 x bfloat16 = fp32, 16, 1x2, 2x1, 1x1
The two more are at https://www.xilinx.com/htmldocs/xilinx2023_2/aiengine_ml_intrinsics/intrinsics/group__intr__gpvectorop__emul__32bx32b.html#gae6f04990833f0cf4b62bf1433ac11e6a and
https://www.xilinx.com/htmldocs/xilinx2023_2/aiengine_ml_intrinsics/intrinsics/group__intr__gpvectorop__mul__fp32xfp32.html#gac1e9a132ee05edf8b6afe9c985598768
We can support arith.muli/arith.mulf
in different result types (as you listed above), because we add aievec.cast/aievec.srs
to cast the acc types back to normal integer/floating types. However, that shouldn't be part of the semantic of aievec.mul_elem
.
…vecmul_elem-and-co
class hasAnyTypeOf<string name, list<Type> vaildTypes> : | ||
SubstLeaves<"$_self", ElementType<name>.result, AnyTypeOf<vaildTypes>.predicate>; |
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.
An equivalent predicate exists upstream already.
And <[hasAnyTypeOf<lhs, [I8 ]>, hasAnyTypeOf<acc, [I8, I32]>]>, | ||
And <[hasAnyTypeOf<lhs, [I16]>, hasAnyTypeOf<acc, [I16, I32, I64]>]>, | ||
And <[hasAnyTypeOf<lhs, [I32]>, hasAnyTypeOf<acc, [I32, I64]>]>, | ||
And <[hasAnyTypeOf<lhs, [BF16]>, hasAnyTypeOf<acc, [BF16, F32]>]>, | ||
And <[hasAnyTypeOf<lhs, [F32]>, hasAnyTypeOf<acc, [F32]>]> |
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.
Notice James' commit above.
SubstLeaves<"$_self", ElementType<name>.result, AnyTypeOf<vaildTypes>.predicate>; | ||
|
||
class IsValidAccTypeForAIE2MulElem<string lhs, string rhs, string acc> : | ||
PredOpTrait<lhs # " x " # rhs # " = " # acc # " is a valid AIE2 " # |
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.
Not very descriptive of what's being checked.
Please let me know if there is a better way to revise these changes.