SiriusNEO opened a new pull request, #14606:
URL: https://github.com/apache/tvm/pull/14606

   Prior to this PR, there is no constraint to prevent user defining multiple 
functions which may use the same symbolic TIR var. For example, use may write 
the following script:
   ```
   batch_size = tir.Var("batch_size", "int64")
   
   @I.ir_module
   class Test:
       @R.function
       def main(
           x: R.Tensor((batch_size, 10), "float32"),
       ):
           with R.dataflow():
               lv = R.sum(x, axis=1)
               lv1 = R.mean(x, axis=1)
               out = R.add(lv, lv1)
               R.output(out)
           return out
   
       @R.function
       def main1(
           x: R.Tensor((batch_size, 10), "float32"),
           y: R.Tensor((batch_size, 10), "float32"),
       ):
           with R.dataflow():
               out = R.subtract(x, y)
               R.output(out)
           return out
   
   lowered_mod = LegalizeOps()(Test)
   
   ex = relax.build(lowered_mod, "llvm")
   vm = relax.VirtualMachine(ex, tvm.cpu(0))
   ```
   But this script can not be built because `VMShapeLower` can not handle this 
case well.
   Since it is a illegal behaviour, we need to prevent user from doing this. 
Specifically, this PR contains two parts of work:
   - Let well form checker to check this case.
   - Let `CopyWithNewVars` utils copies the symbolic vars in the struct info 
inside the function.


-- 
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]

Reply via email to