While switching to TVMC, I noticed a "virtual_device" property on the top-level
relay module function. It was not properly propagated through my relay passes
and caused an assertion in lowering to TE, with:
Check failed: (!virtual_device->IsFullyUnconstrained()) is false
at:
```
File "/home/user1/mlenv/deps/src/tvm/python/tvm/driver/tvmc/__main__.py",
line 24, in
tvmc.main.main()
File "/home/user1/mlenv/deps/src/tvm/python/tvm/driver/tvmc/main.py", line
115, in main
sys.exit(_main(sys.argv[1:]))
File "/home/user1/mlenv/deps/src/tvm/python/tvm/driver/tvmc/main.py", line
103, in _main
return args.func(args)
File "/home/user1/mlenv/deps/src/tvm/python/tvm/driver/tvmc/compiler.py",
line 173, in drive_compile
compile_model(
File "/home/user1/mlenv/deps/src/tvm/python/tvm/driver/tvmc/compiler.py",
line 337, in compile_model
graph_module = build(
File "/home/user1/mlenv/deps/src/tvm/python/tvm/driver/tvmc/compiler.py",
line 410, in build
return relay.build(
File "/home/user1/mlenv/deps/src/tvm/python/tvm/relay/build_module.py", line
431, in build
graph_json, runtime_mod, params = bld_mod.build(
File "/home/user1/mlenv/deps/src/tvm/python/tvm/relay/build_module.py", line
154, in build
self._build(mod, raw_targets, executor, runtime, workspace_memory_pools,
mod_name)
File "/home/user1/mlenv/deps/src/tvm/python/tvm/_ffi/_ctypes/packed_func.py",
line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
29: TVMFuncCall
28:
tvm::runtime::PackedFuncObj::Extractor, std::allocator > const&,
tvm::runtime::ObjectPtr
const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#3}>
>::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs,
tvm::runtime::TVMRetValue*)
27: tvm::relay::backend::RelayBuildModule::BuildRelay(tvm::IRModule,
tvm::runtime::String const&)
26:
tvm::runtime::PackedFuncObj::Extractor, std::allocator > const&,
tvm::runtime::ObjectPtr
const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}>
>::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs,
tvm::runtime::TVMRetValue*)
25: tvm::relay::backend::AOTExecutorCodegen::Codegen(tvm::IRModule,
tvm::relay::Function, tvm::runtime::String)
24: tvm::transform::Pass::operator()(tvm::IRModule) const
23: tvm::transform::Pass::operator()(tvm::IRModule,
tvm::transform::PassContext const&) const
22: tvm::transform::SequentialNode::operator()(tvm::IRModule,
tvm::transform::PassContext const&) const
21: tvm::transform::Pass::operator()(tvm::IRModule,
tvm::transform::PassContext const&) const
20: tvm::transform::ModulePassNode::operator()(tvm::IRModule,
tvm::transform::PassContext const&) const
19:
_ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS_8IRModuleES5_NS_9transform11PassContextEEE17AssignTypedLambdaIZNS_5relay3tec7LowerTEENS0_6StringENS_17CompilationConfigESt8functionIFvNS_8BaseFuncUlS5_S7_E_EEvT_EUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SL_SP_
18: tvm::relay::tec::LowerTE(tvm::IRModule const&, tvm::runtime::String
const&, std::function, tvm::CompilationConfig)
17: tvm::transform::Pass::operator()(tvm::IRModule) const
16: tvm::transform::Pass::operator()(tvm::IRModule,
tvm::transform::PassContext const&) const
15: tvm::relay::transform::FunctionPassNode::operator()(tvm::IRModule,
tvm::transform::PassContext const&) const
14:
_ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS_5relay8FunctionES6_NS_8IRModuleENS_9transform11PassContextEEE17AssignTypedLambdaIZNS5_3tec15LowerTensorExprERKNS0_6StringENSD_10TECompilerESt8functionIFvNS_8BaseFuncEEENS_17CompilationConfigEEUlS6_S7_S9_E_EEvT_EUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SP_ST_
13: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
12: _ZZN3tvm5relay11ExprFuncto
11:
tvm::relay::transform::DeviceAwareExprMutator::VisitExpr_(tvm::relay::FunctionNode
const*)
10:
tvm::relay::tec::LowerTensorExprMutator::DeviceAwareVisitExpr_(tvm::relay::FunctionNode
const*)
9: _ZN3tvm5relay9tr
8: tvm::relay::ExprMutator::VisitExpr_(tvm::relay::FunctionNode const*)
7: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
6: _ZZN3tvm5relay11ExprFuncto
5:
tvm::relay::transform::DeviceAwareExprMutator::VisitExpr_(tvm::relay::LetNode
const*)
4:
tvm::relay::tec::LowerTensorExprMutator::PreVisitLetBinding_(tvm::relay::Var
const&, tvm::RelayExpr const&)
3: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
2: _ZZN3tvm5relay11ExprFuncto
1:
tvm::relay::transform::DeviceAwareExprMutator::VisitExpr_(tvm::relay::CallNode
const*)
0:
tvm::relay::tec::LowerTensorExprMutator::DeviceAwareVisitExpr_(tvm::relay::CallNode
const*)
File "/home/user1/mlenv/deps/src/tvm/src/relay/backend/te_compiler.cc", line
885
```
I noticed that this property is sometimes updated manually a