Is `T.axis.remap` mandatory?

Say we have

for y, x in T.grid(10, 10):
    with T.block("block"):
        B[y, x] = A[y, x] + 1

Is there any advantage to adding axis remap if we have 1-1 correspondence with existing variables?

for y, x in T.grid(10, 10):
    with T.block("block"):
        v_y, v_x = T.axis.remap("SS", y, x)
        B[v_y, v_x] = A[v_y, v_x] + 1
1 Like

We deliberated related case before, and the rationale is that we would like to have block being explicit, since they are basic concept for us to manipulate and also like users to think about kinds("SS"). For trivial cases where we can detect, one alternative is to let us auto detect in parsing phase

2 Likes

Thanks. Do you have link to that discussion? Was it in an RFC?

Let us continue discussion on this topic, as i was mentioning the rationale when implementing the parser not a discussion, sorry for the confusion

Great question @kparzysz !

The key is the iteration kind, which can be “S” (for spatial), “R” (for reduction), and opaque. We are not able to auto-detect it through the block body, especially for the reduction and opaque kinds.

BTW, I has some private discussions with @wrongtest, @multiverstack and @lightzhan. Feel free to comment here if you are interested.

@lightzhan is working on automatically build block iteration categories with integer analyzing tools from ISL. Thus users could transform non-stir form TVMScript to schedulable form, which could get further optimized with meta-schedule (or something similiar).

From my understanding of the concern of @kparzysz. People seems always prefer simpler things, especially when we treat TVMScript as a python-hosted programming language. But for stir, block iter mappings now lay in somewhat key position of program transformation strategy and correctness.

My question was really whether T.axis.remap does something that is not self evident, but that is essential for proper functioning. I know that if I skip it in some cases then the code still works, but I was wondering if it worked “by accident”, or if it can be legitimately skipped in simple cases.

So far it seems like the parser will try to fill it in when it’s absent, so that addresses my main concern. Thanks everyone for your replies, they are very helpful.