jikechao opened a new pull request, #14707: URL: https://github.com/apache/tvm/pull/14707
The `alpha` attribute in LeakyReLU lacks exception checking. If the `alpha=nan` , the tvm frontend can convert it to relay ir successful, but in the optimization stage, it will trigger an unexpected crash and throws `TVMError: Observed 100 rewrite passes, possible conflicting passes?` The relay IR is the following:  This patch fixes the bug! The StackTrace: ``` model = relay.build_module.create_executor("graph", mod, tvm.cpu(0), 'llvm', params).evaluate() # crash File "/workplace/software/tvm/tvm/python/tvm/relay/backend/interpreter.py", line 171, in evaluate return self._make_executor() File "/workplace/software/tvm/tvm/python/tvm/relay/build_module.py", line 519, in _make_executor mod = build(self.mod, target=self.target) File "/workplace/software/tvm/tvm/python/tvm/relay/build_module.py", line 372, in build mod_name=mod_name, File "/workplace/software/tvm/tvm/python/tvm/relay/build_module.py", line 169, in build mod_name, File "/workplace/software/tvm/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): 14: TVMFuncCall 13: tvm::relay::backend::RelayBuildModule::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*)#3}::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const 12: tvm::relay::backend::RelayBuildModule::Build(tvm::IRModule, tvm::runtime::Array<tvm::Target, void> const&, tvm::Target const&, tvm::relay::Executor const&, tvm::relay::Runtime const&, tvm::WorkspaceMemoryPools const&, tvm::ConstantMemoryPools const&, tvm::runtime::String) 11: tvm::relay::backend::RelayBuildModule::BuildRelay(tvm::IRModule, tvm::runtime::String const&) 10: tvm::relay::backend::RelayBuildModule::OptimizeImpl(tvm::IRModule) 9: tvm::transform::Pass::operator()(tvm::IRModule) const 8: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const 7: tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const 6: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const 5: tvm::relay::transform::FunctionPassNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const 4: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::runtime::TypedPackedFunc<tvm::relay::Function (tvm::relay::Function, tvm::IRModule, tvm::transform::PassContext)>::AssignTypedLambda<tvm::relay::transform::SimplifyExpr()::$_0>(tvm::relay::transform::SimplifyExpr()::$_0)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) 3: tvm::relay::SimplifyExpr(tvm::RelayExpr const&, tvm::IRModule const&) 2: tvm::relay::RewritePatterns(tvm::runtime::Array<tvm::relay::DFPatternCallback, void>, tvm::RelayExpr, tvm::IRModule) 1: tvm::relay::PatternRewriter::Rewrite(tvm::runtime::Array<tvm::relay::DFPatternCallback, void> const&, tvm::RelayExpr const&) 0: _ZN3tvm7runtime6detail File "/workplace/software/tvm/tvm/src/relay/ir/dataflow_matcher.cc", line 829 TVMError: Observed 100 rewrite passes, possible conflicting passes? ``` -- 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]
