cbalint13 commented on PR #15918:
URL: https://github.com/apache/tvm/pull/15918#issuecomment-1765261587
> > ```
> > idx_vec = T.allocate_const([0, 1, 4, 5, 2, 3, 6, 7], "int32")
> > tir.vectorpermute("int32x8", whatever_vector, idx_vec)
> > ```
> >
> >
> > is not more complex in my opinion :) I appreciate the convenience of
printing the index array inplace in TIR though.
>
> Hmm ... that's really short ! I don't know why I found `AllocateConst`
(and stayed convinced) that is something complicated for "immediate" use.
I add these few lines here showing more contrasted aspects against/pro
```ArrayIntImm``` vs. ```AlocateConst```.
* Tried to stick with ```AlocateConst```, by default it does not come at a
cheap:
```
idx_vec = tvm.tir.allocate_const([0, 1, 4, 5, 2, 3, 6, 7], "int32")
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'tvm.tir' has no attribute 'allocate_const'. Did
you mean: 'AllocateConst'?
```
https://tvm.apache.org/docs/reference/api/python/tir.html#tvm.tir.AllocateConst
```
idx_vec = tvm.tir.AllocateConst([0, 1, 4, 5, 2, 3, 6, 7], "int32")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: AllocateConst.__init__() missing 3 required
positional arguments: 'extents', 'data_or_idx', and 'body'
```
* Can be "aliased" or something to get the simple form:
```tir.allocate_const([0, 1, 4, 5, 2, 3, 6, 7], "int32")```
* Also remembered a remark regarding "the not exposed yet status" of
*tir.allocate_const* [at this
point](https://github.com/apache/tvm/blob/0276c5a0d81021489663d08b3afbab6f0ed6ab8e/python/tvm/relay/backend/contrib/ethosu/tir/passes.py#L913-L915)
in the codebase.
I remain with the idea to use ```AllocateConst``` if there will be no
consensus on ```ArrayIntImm```.
--
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]