vicalloy opened a new issue #7896:
URL: https://github.com/apache/tvm/issues/7896


   1. I get the follow error when run `relay.vm.compile`.
   ```
   Check failed: (dtype.element_of() == n->dtype.element_of() && dtype.lanes() 
% n->dtype.lanes() == 0) is false: Cannot store int32 to buffer of int64
   ```
   
   2. The follow code is used to build the model.
   ```python
   # model from openvino. 
https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/intel/face-detection-0200/description/face-detection-0200.md
   onnx_model = onnx.load('face-detection-0200.onnx')
   
   shape_dict = {
           "image": [1,3,256,256],
           }
   
   mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
   with tvm.transform.PassContext(opt_level=3):
       vm = relay.vm.compile(mod, target="llvm", target_host=None, 
params=params)
   
   ```
   3. error
   ```log
   Traceback (most recent call last):
     File "run-tvm.py", line 34, in <module>
       vm = relay.vm.compile(mod, target="llvm", target_host=None, 
params=params)
     File "/home/hu/tvm/python/tvm/relay/backend/vm.py", line 72, in compile
       compiler.lower(mod, target)
     File "/home/hu/tvm/python/tvm/relay/backend/vm.py", line 143, in lower
       self._lower(mod, target, target_host)
     File "/home/hu/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):
     54: TVMFuncCall
     53: std::_Function_handler<void (tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*), 
tvm::relay::vm::VMCompiler::GetFunction(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, 
tvm::runtime::ObjectPtr<tvm::runtime::Object> 
const&)::{lambda(tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*)#1}>::_M_invoke(std::_Any_data const&, 
tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)
     52: tvm::relay::vm::VMCompiler::Lower(tvm::IRModule, 
tvm::runtime::Map<tvm::Integer, tvm::Target, void, void> const&, tvm::Target 
const&)
     51: tvm::relay::vm::VMCompiler::OptimizeModule(tvm::IRModule, 
tvm::runtime::Map<tvm::Integer, tvm::Target, void, void> const&, tvm::Target 
const&)
     50: tvm::transform::Pass::operator()(tvm::IRModule) const
     49: tvm::transform::SequentialNode::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     48: tvm::transform::Pass::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     47: tvm::transform::SequentialNode::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     46: tvm::transform::Pass::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     45: tvm::transform::ModulePassNode::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     44: std::_Function_handler<void (tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*), tvm::runtime::TypedPackedFunc<tvm::IRModule 
(tvm::IRModule, 
tvm::transform::PassContext)>::AssignTypedLambda<tvm::relay::transform::ManifestAlloc(tvm::Target,
 tvm::runtime::Map<tvm::Integer, tvm::Target, void, 
void>)::{lambda(tvm::IRModule, tvm::transform::PassContext 
const&)#1}>(tvm::relay::transform::ManifestAlloc(tvm::Target, 
tvm::runtime::Map<tvm::Integer, tvm::Target, void, 
void>)::{lambda(tvm::IRModule, tvm::transform::PassContext 
const&)#1})::{lambda(tvm::runtime::TVMArgs const&, 
tvm::runtime::TVMRetValue*)#1}>::_M_invoke(std::_Any_data const&, 
tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)
     43: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
     42: 
_ZZN3tvm5relay11ExprFunctorIFNS_9RelayExprERKS2_EE10InitVTableEvENUlRKNS_7r
     41: tvm::relay::ExprMutator::VisitExpr_(tvm::relay::FunctionNode const*)
     40: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
     39: 
_ZZN3tvm5relay11ExprFunctorIFNS_9RelayExprERKS2_EE10InitVTableEvENUlRKNS_7r
     38: tvm::relay::DialectRewriter::VisitExpr_(tvm::relay::LetNode const*)
     37: tvm::relay::ExprMutator::VisitExpr(tvm::RelayExpr const&)
     36: 
_ZZN3tvm5relay11ExprFunctorIFNS_9RelayExprERKS2_EE10InitVTableEvENUlRKNS_7r
     35: tvm::relay::DialectRewriter::VisitExpr_(tvm::relay::CallNode const*)
     34: tvm::relay::DialectRewriter::DynamicInvoke(tvm::relay::LetList*, 
tvm::relay::Function const&, tvm::relay::Tuple const&, 
std::vector<tvm::RelayExpr, std::allocator<tvm::RelayExpr> > const&, 
std::vector<tvm::TensorType, std::allocator<tvm::TensorType> > const&, 
tvm::Type const&)
     33: tvm::relay::DialectRewriter::EmitShapeFunc(tvm::relay::LetList*, 
tvm::relay::Function const&, std::vector<tvm::RelayExpr, 
std::allocator<tvm::RelayExpr> > const&)
     32: tvm::relay::CompileEngineImpl::LowerShapeFunc(tvm::relay::CCacheKey 
const&)
     31: 
tvm::relay::CompileEngineImpl::LowerShapeFuncInternal(tvm::relay::CCacheKey 
const&)
     30: tvm::lower(tvm::te::Schedule, tvm::runtime::Array<tvm::te::Tensor, 
void> const&, std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, std::unordered_map<tvm::te::Tensor, 
tvm::tir::Buffer, std::hash<tvm::te::Tensor>, std::equal_to<tvm::te::Tensor>, 
std::allocator<std::pair<tvm::te::Tensor const, tvm::tir::Buffer> > > const&)
     29: tvm::transform::Pass::operator()(tvm::IRModule) const
     28: tvm::transform::SequentialNode::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     27: tvm::transform::Pass::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     26: tvm::tir::transform::PrimFuncPassNode::operator()(tvm::IRModule, 
tvm::transform::PassContext const&) const
     25: std::_Function_handler<void (tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*), tvm::runtime::TypedPackedFunc<tvm::tir::PrimFunc 
(tvm::tir::PrimFunc, tvm::IRModule, 
tvm::transform::PassContext)>::AssignTypedLambda<tvm::tir::transform::StorageFlatten(int,
 bool)::{lambda(tvm::tir::PrimFunc, tvm::IRModule, 
tvm::transform::PassContext)#1}>(tvm::tir::transform::StorageFlatten(int, 
bool)::{lambda(tvm::tir::PrimFunc, tvm::IRModule, 
tvm::transform::PassContext)#1})::{lambda(tvm::runtime::TVMArgs const&, 
tvm::runtime::TVMRetValue*)#1}>::_M_invoke(std::_Any_data const&, 
tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)
     24: tvm::tir::StorageFlatten(tvm::tir::PrimFunc, int, bool)
     23: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
     22: 
_ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7runtime
     21: tvm::tir::StorageFlattener::VisitStmt_(tvm::tir::AttrStmtNode const*)
     20: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
     19: 
_ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7runtime
     18: tvm::tir::StorageFlattener::VisitStmt_(tvm::tir::AttrStmtNode const*)
     17: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
     16: 
_ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7runtime
     15: tvm::tir::StorageFlattener::VisitStmt_(tvm::tir::BufferRealizeNode 
const*)
     14: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
     13: 
_ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7runtime
     12: tvm::tir::StorageFlattener::VisitStmt_(tvm::tir::BufferRealizeNode 
const*)
     11: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
     10: 
_ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7runtime
     9: tvm::tir::StorageFlattener::VisitStmt_(tvm::tir::AttrStmtNode const*)
     8: tvm::tir::StmtMutator::VisitStmt_(tvm::tir::AttrStmtNode const*)
     7: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
     6: 
_ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7runtime9Ob
     5: tvm::tir::StmtMutator::VisitStmt_(tvm::tir::SeqStmtNode const*)
     4: void tvm::runtime::Array<tvm::tir::Stmt, 
void>::MutateByApply<tvm::tir::StmtMutator::Internal::Mutate(tvm::tir::StmtMutator*,
 tvm::runtime::Array<tvm::tir::Stmt, void> const&)::{lambda(tvm::tir::Stmt 
const&)#1}>(tvm::tir::StmtMutator::Internal::Mutate(tvm::tir::StmtMutator*, 
tvm::runtime::Array<tvm::tir::Stmt, void> const&)::{lambda(tvm::tir::Stmt 
const&)#1})
     3: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
     2: 
_ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7runtime
     1: tvm::tir::StorageFlattener::VisitStmt_(tvm::tir::BufferStoreNode const*)
     0: tvm::tir::Buffer::vstore(tvm::runtime::Array<tvm::PrimExpr, void>, 
tvm::PrimExpr) const
     File "/home/hu/tvm/src/tir/ir/buffer.cc", line 304
   TVMError: 
   ---------------------------------------------------------------
   An internal invariant was violated during the execution of TVM.
   Please read TVM's error reporting guidelines.
   More details can be found here: 
https://discuss.tvm.ai/t/error-reporting/7793.
   ---------------------------------------------------------------
     Check failed: (dtype.element_of() == n->dtype.element_of() && 
dtype.lanes() % n->dtype.lanes() == 0) is false: Cannot store int32 to buffer 
of int64
   ```


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to