yanggg1997 opened a new pull request #8917:
URL: https://github.com/apache/tvm/pull/8917
When I use the relay VM to compile a graph that contains a huge for loop,
the LabelOps pass encountered stack overflow. This problem is caused by the
LabelOps applies the default `ExprMutator::VisitExpr_(const LetNode* op)`
function to visit the LetNode, which is a recursive function.
Here is a small testing case:
``` python3
data = relay.var("data", tvm.ir.TensorType(shape = (relay.Any(),5,2), dtype
= "float32"))
shape = relay.op.shape_of(data)
for i in range(1000):
tmp = relay.op.ones(shape, "float32")
shape = relay.op.shape_of(tmp)
res = shape
mod = tvm.IRModule()
mod["main"] = relay.Function([data], res)
```
In this case, I set the for loop with 1000 times, note that the specific
number of times that will cause the LabelOps stack overflow may vary in
different machine environment.
To fix this bug, I added a non-recursive LetNode VisitExpr_ in the Class
LabelOpsMutator.
--
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]