masahi opened a new issue #9476:
URL: https://github.com/apache/tvm/issues/9476


   An interesting bug found by @shtinsa
   
   Apparently, something bad happens when the autoscheduler try to tune the 
workload `batch_matmul(x, x)`. It emits an error like this (A repro script 
https://gist.github.com/masahi/59248ec6faafae65154973c84dd6f48e):
   ```
     Check failed: (code_to_name_.find(type_code) != code_to_name_.end()) is 
false: Type code 192 not registered
   Stack trace:
     0: tvm::tir::Mul::Mul(tvm::PrimExpr, tvm::PrimExpr, tvm::Span)
     1: tvm::tir::ExprMutator::VisitExpr_(tvm::tir::MulNode const*)
     2: _ZZN3tvm3tir11ExprFuncto
     3: tvm::NodeFunctor<tvm::PrimExpr (tvm::runtime::ObjectRef const&, 
tvm::tir::ExprFunctor<tvm::PrimExpr (tvm::PrimExpr 
const&)>*)>::operator()(tvm::runtime::ObjectRef const&, 
tvm::tir::ExprFunctor<tvm::PrimExpr (tvm::PrimExpr const&)>*) const
     4: tvm::tir::ExprFunctor<tvm::PrimExpr (tvm::PrimExpr 
const&)>::VisitExpr(tvm::PrimExpr const&)
     5: _ZThn16_N3tvm3
     6: 
_ZN3tvm3tir11MutateArrayINS_8PrimExprEZNS0_11ExprMutator10VisitExpr_EPKNS0_10ReduceNodeEE4$_12EENS_7runtime5ArrayIT_NSt9enable_ifIXsr3std10is_base_ofINS8_9ObjectRefESA_EE5valueEvE4typeEEESF_T0_
     7: tvm::tir::ExprMutator::VisitExpr_(tvm::tir::ReduceNode const*)
     8: _ZZN3tvm3tir11ExprFunctorIF
     9: tvm::NodeFunctor<tvm::PrimExpr (tvm::runtime::ObjectRef const&, 
tvm::tir::ExprFunctor<tvm::PrimExpr (tvm::PrimExpr 
const&)>*)>::operator()(tvm::runtime::ObjectRef const&, 
tvm::tir::ExprFunctor<tvm::PrimExpr (tvm::PrimExpr const&)>*) const
     10: tvm::tir::ExprFunctor<tvm::PrimExpr (tvm::PrimExpr 
const&)>::VisitExpr(tvm::PrimExpr const&)
     11: tvm::te::ReplaceTensor(tvm::PrimExpr, 
std::unordered_map<tvm::te::Tensor, tvm::te::Tensor, 
std::hash<tvm::te::Tensor>, std::equal_to<tvm::te::Tensor>, 
std::allocator<std::pair<tvm::te::Tensor const, tvm::te::Tensor> > > const&)
     12: tvm::te::ComputeOpNode::ReplaceInputs(tvm::te::Operation const&, 
std::unordered_map<tvm::te::Tensor, tvm::te::Tensor, 
std::hash<tvm::te::Tensor>, std::equal_to<tvm::te::Tensor>, 
std::allocator<std::pair<tvm::te::Tensor const, tvm::te::Tensor> > > const&) 
const
     13: 
tvm::auto_scheduler::ComputeDAG::RewriteLayout(tvm::runtime::Array<tvm::auto_scheduler::Step,
 void>*, tvm::auto_scheduler::LayoutRewriteOption) const
     14: 
tvm::auto_scheduler::ComputeDAG::ApplySteps(tvm::runtime::Array<tvm::auto_scheduler::Step,
 void> const&, tvm::runtime::Array<tvm::te::Stage, void>*, 
tvm::runtime::Map<tvm::te::Stage, tvm::runtime::Array<tvm::tir::IterVar, void>, 
tvm::runtime::ObjectHash, tvm::runtime::ObjectEqual>*, 
tvm::auto_scheduler::LayoutRewriteOption) const
     15: std::_Function_handler<void (tvm::runtime::TVMArgs, 
tvm::runtime::TVMRetValue*), 
tvm::runtime::TypedPackedFunc<tvm::runtime::Array<tvm::runtime::ObjectRef, 
void> (tvm::auto_scheduler::ComputeDAG const&, tvm::auto_scheduler::State 
const&, 
int)>::AssignTypedLambda<tvm::auto_scheduler::$_12>(tvm::auto_scheduler::$_12, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> 
>)::{lambda(tvm::runtime::TVMArgs const&, 
tvm::runtime::TVMRetValue*)#1}>::_M_invoke(std::_Any_data const&, 
tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&)
     16: TVMFuncCall
   ``` 
   
   Interestingly, the error happens only on a CPU target. Moreover, reverting 
https://github.com/apache/tvm/pull/9207 also workaround this problem, but we 
cannot revert this PR. 


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