@Lunderberg  Hi, I am much interested in `transform_layout`  but my team 
depends totally on TensorIR schedule instead of TE.  Could you kindly provide 
more design points on TensorIR side? It would be great if we can enjoy this 
preview feature in TensorIR. It is really useful for us.

We have implemented some TensorIR primitives to serve similar purposes in form 
below to mutate the `Buffer` object's layout, strides and dtypes. 
```python
s.replace_buffer_obj(block, write_buffer_idx, *a set of rewrite callbacks)
```
Since generally all buffer accesses are multi-dimensional in TensorIR schedule 
phase, the implementation is a bit easier (just something like a pass to 
substitute the buffer object) than in TE, if no extra representative variables 
are introduced. Is the `transform_layout` would also be like above?
```python
s.transform_layout(block, buffer_idx, remap_func)
```

Another form we use is just a duality of loop transformation primitives, where 
representative variables for buffer or axis of buffer are tracked into TensorIR 
schedule states.
```python
n, c, h, w = s.get_buffer_axes(block, buffer_idx)
c_outer, c_inner = s.split_for_buffer(c)
s.reorder_for_buffer(n, c_outer, h, w, c_inner)

# for `transform_layout` look like this?
buffer_rv = s.get_buffer(some identifier)
new_buffer_rv = s.transform_layout(buffer_rv, remap_func)
```
Is it possible to provide both integrated `transform_layout` primitive and step 
by step primitives for user's convenience?

Very glad to know your opinions!  :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/tvm-rfcs/pull/39#issuecomment-993336900

Reply via email to