Cookiee235 commented on issue #17175:
URL: https://github.com/apache/tvm/issues/17175#issuecomment-2236870217
After my investigation, I found if we use the `relax.transform.FuseTIR()`
before the `relax.build`, the compilation will run well. However, I still
haven't figured out why the compilation crash was unexpected and why the script
ran well when adding the `FuseTIR` transform.
A workaround to avoid the bug
```
import tvm
from tvm import relax
from tvm.script import ir as I
from tvm.script import relax as R
@I.ir_module
class Module:
@R.function
def main(x: R.Tensor((3,), dtype="int64")) -> R.Tensor((3,),
dtype="int64"):
lv: R.Shape([3]) = R.tensor_to_shape(x)
lv: R.Shape([3]) = R.call_pure_packed("vm.builtin.tensor_to_shape",
x, sinfo_args=(R.Shape([3]),))
return lv
mod = Module
mod = tvm.relax.transform.LegalizeOps()(mod)
mod.show()
mod = relax.transform.FuseTIR()(mod) # newly added
ex = relax.build(mod, target='llvm')
vm = relax.VirtualMachine(ex, tvm.cpu())
```
Do we need to explicitly call the ``FuseTIR` transform before compiling any
model?
@ysh329 @tqchen @Hzfengsy @junrushao
--
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]