-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[SVE] Change the dtype of Ramp and Broadcast lanes to PrimExpr #16523
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
Conversation
|
@tvm-bot rerun |
lhutton1
left a comment
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.
Thanks for the great work @ekalda! I had a look over and noticed a few nitpicks :)
|
if it is not high effort, consider add https://github.com/apache/tvm/blob/main/python/tvm/ir/json_compact.py so previously serialized node can be loaded |
include/tvm/runtime/data_type.h
Outdated
| */ | ||
| inline int GetVectorBytes(DataType dtype) { | ||
| if (dtype.is_scalable()) { | ||
| LOG(FATAL) << "Cannot get vector bytes of scalable vector"; |
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.
runtime Data type cannot be scalable vector
cea202e to
888ad3b
Compare
|
Thanks @tqchen, @Lunderberg and @lhutton1 for your feedback, I uploaded a reworked version of the patch. Here's what's changed:
|
…imExpr This change will allow us to express scalable vectors through Ramp and Broadcast nodes, e.g. ``` vec = tvm.tir.expr.Ramp(0, 1, 4 * tvm.tir.vscale()) ``` We will use negative values for `runtime::DataType` the encode the scalable lane values, e.g. the above example would result in `lanes` = -4. That's because the lanes in `runtime::DataType` are tied to DLPack standard which uses `uint16_t` for the lanes. The conversion happens in the node definitions and `runtime::DataType`, so the `int` and `uint16_t` values should never be exposed to the API user, especially after the string support has been added. Also include the TVMScript support for scalable Ramp and Broadcasts. Note that this patch doesn't include lowering to the appropriate LLVM vectors, support for data type string representation or `LoopVectorizer` support. All of these will be part of future patches. Co-authored-by: Luke Hutton <luke.hutton@arm.com> Co-authored-by: Neil Hickey <neil.hickey@arm.com>
Change-Id: I8eb77ce5632359b6e4a2e63c4da490e3abab3ee9
* Separate APIs for fixed length and scalable vectors * Improve the function that extracts the multiplier from scalable lanes expression * Update json_compact.py
Fix failures in test_arith_intset.py and test_tvmscript_printer_tir.py
888ad3b to
60e7d83
Compare
|
Thanks @ekalda @tqchen @Lunderberg |
This change will allow us to express scalable vectors through Ramp and Broadcast nodes, e.g.
We will use negative values for
runtime::DataTypethe encode the scalable lane values, e.g. the above example would result inlanes= -4. That's because the lanes inruntime::DataTypeare tied to DLPack standard which usesuint16_tfor the lanes. The conversion happens in the node definitions andruntime::DataType, so theintanduint16_tvalues should never be exposed to the API user, especially after the string support has been added.Also include the TVMScript support for scalable Ramp and Broadcasts.
Note that this patch doesn't include lowering to the appropriate LLVM vectors, support for data type string representation or
LoopVectorizersupport. All of these will be part of future patches.