ekalda commented on PR #16523:
URL: https://github.com/apache/tvm/pull/16523#issuecomment-1941936705
Thanks @tqchen, @Lunderberg and @lhutton1 for your feedback, I uploaded a
reworked version of the patch. Here's what's changed:
* Separation of `vscale` multiplier and fixed length vector lanes APIs in
`runtime::DataType` - now we access these constants via `vscale_factor()` and
`lanes()` methods
* `is_vector()` is retierd now and replaced with `is_scalable_vector()`,
`is_fixed_length_vector()` and `is_scalable_or_fixed_length_vector()`
* Refactor of the function that extracts the integer multiplier from a lanes
expression as per @Lunderberg's suggestions
* Removed the `ScalableLanes` function. Actually, the new form of
`ExtractVscaleFactor` does the job there, so I used that. I reckon that
```
if (!arith::ExtractVscaleFactor(lanes.Eval())):
...
```
reads somewhat weird, so LMK if you think it would be better to wrap it
into something more self-documenting.
* Now that an attempt to fetch `lanes()` on a scalable vector results in an
error, I decided to change the pattern in codegens
```
ICHECK(!op->dtype.is_scalable()) << "Scalable vectors are not supported
in codegen_c_host";
int lanes = static_cast<int>(Downcast<IntImm>(op->lanes)->value);
```
into
```
int lanes = op->dtype.lanes();
```
Which essentially pushes the error into `runtime::Datatype`. This has
the advantage of reducing the logic in codegens that is not really related to
these codegens.
* Implemented JSON serialisation support such that graphs serialised with
older versions of TVM can be correctly loaded in versions that include the
changes is this patch. Unfortunately, in case of a strategic choice of lanes
value, a graph serialised with an older version of TVM can be loaded as an
incorrect graph without triggrering an error that would then trigger the
`upgrade_json` function, so now we have to force the json upgrade every time we
try to load a serialised graph.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]