cyx-6 opened a new issue, #15488:
URL: https://github.com/apache/tvm/issues/15488

   The reproduce code is
   ```python
   import tvm
   from tvm import relax
   from tvm.relax.frontend.nn import spec, modules, Module, Tensor, op
   
   
   class Model(Module):
       def test(self, x: Tensor, y: Tensor):
           z = op.add(x, y)
           return z
   
   
   tvm_mod, _ = Model().export_tvm(
       spec={
           "test": {
               "x": spec.Tensor((1, 4), "float32"),
               "y": spec.Tensor((1, 4), "float32"),
           }
       }
   )
   tvm_mod.show()
   tvm_mod = relax.transform.LegalizeOps()(tvm_mod)
   tvm_mod.show()
   with tvm.transform.PassContext(config={"relax.backend.use_cuda_graph": 
True}):
       ex = relax.build(tvm_mod, "llvm")
   ```
   The build stage failed as 
   
   > tvm.error.InternalError: Traceback (most recent call last):
     5: 0xffffffffffffffff
     4: 0x000000000058b8dd
     3: tvm::relax::relax_vm::VMCodeGen(tvm::relax::ExecBuilder, tvm::IRModule)
           at /home/ubuntu/tvm/src/relax/backend/vm/codegen_vm.cc:428
     2: tvm::relax::relax_vm::CodeGenVM::Run(tvm::relax::ExecBuilder, 
tvm::IRModule)
           at /home/ubuntu/tvm/src/relax/backend/vm/codegen_vm.cc:76
     1: tvm::relax::relax_vm::CodeGenVM::Codegen(tvm::relax::Function const&)
           at /home/ubuntu/tvm/src/relax/backend/vm/codegen_vm.cc:114
     0: tvm::relax::relax_vm::CodeGenVM::VisitExpr_(tvm::relax::VarNode const*)
           at /home/ubuntu/tvm/src/relax/backend/vm/codegen_vm.cc:226
     File "/home/ubuntu/tvm/src/relax/backend/vm/codegen_vm.cc", line 226
   InternalError: Check failed: (it != this->var_arg_map_.end()) is false: Var 
gv is not defined
   
   The failed function is
   ```python
   @R.function
   def _initialize_effect() -> R.Tuple(R.Object):
       R.func_attr({"relax.force_pure": 1})
       shape_heap: R.Object = R.null_value()
       gv: R.Tuple = 
R.call_builtin_with_ctx("vm.builtin.cuda_graph.run_or_capture", 
(cuda_graph_capture, R.tuple(), R.prim_value(0)), sinfo_args=(R.Tuple,))
       gv_1: R.Tuple(R.Object)
       return gv_1
   ```
   where the `gv_1` is not defined as errer message, while the original 
function is
   ```python
   @R.function
   def _initialize_effect() -> R.Tuple(R.Object):
       with R.dataflow():
           _io: R.Object = R.null_value()
           lv: R.Tuple(R.Object) = (_io,)
           gv: R.Tuple(R.Object) = lv
           R.output(gv)
       return gv
   ```


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