giuseros commented on pull request #8096:
URL: https://github.com/apache/tvm/pull/8096#issuecomment-848653432
Hi @areusch , @manupa-arm , @mehrdadh ,
Quick update on this. We found an issue in the storage rewrite pass. The
problem is due to the fact that the packed functions accept TVMValues and not
bare pointers. This means that in this TIR:
```
let sid_5_value_1: handle = @tir.tvm_stack_alloca("array", 1,
dtype=handle)
@tir.tvm_struct_set(sid_5_value_1, 0, 1, sid_5, dtype=handle)
let sid_4_value: handle = @tir.tvm_stack_alloca("array", 1, dtype=handle)
@tir.tvm_struct_set(sid_4_value, 0, 1, sid_4, dtype=handle)
{
@tir.tvm_call_cpacked("fused_transpose", sid_5_value_1, sid_4_value,
dtype=int32)
}
```
The rewriter is able to identify `sid_5_value_1` and `sid_4_value` as both
live variables, and they are not overridden. But it fails to see that those
variable relate to `sid_5` and `sid_4` (respectively).
Early on, in the calls:
```
@tir.tvm_struct_set(sid_5_value_1, 0, 1, sid_5, dtype=handle)
@tir.tvm_struct_set(sid_4_value, 0, 1, sid_4, dtype=handle)
```
The variables `sid_5` and `sid_4` are treated as separate variables (that
are NOT live at the same time) and hence get overridden. In the last commit I
explicitly create a translation table between the TVMValues and the
allocations. This seems to fix the issue. I have added also a further test
case `test_transpose` (disabling the op-fusion in Relay) to test this scenario.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]