iree-org / iree-org/iree

Assertion failed in VM flatbuffer serialization with empty NameLoc

Open
#16,005 1 comment 0 reactions 1 assignee Claimed by @benvanik View on GitHub
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
4d 16h
Merged PRs (30d)
47

Description

```
iree-compile: iree/third_party/flatcc/src/runtime/builder.c:1492: flatcc_builder_ref_t _create_offset_vector_direct(flatcc_builder_t *, flatcc_builder_ref_t *, size_t, const flatbuffers_utype_t *): Assertion `types[i] == 0' failed.
Please report issues to https://github.com/openxla/iree/issues and include the crash backtrace.
Stack dump:
0. Program arguments: ./tools/iree-compile --iree-hal-target-backends=llvm-cpu --iree-input-type=onnx /home/stella/tmp/badloc.mlir -o /dev/null
#0 0x00007f7672c52c87 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/stella/src/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13
#1 0x00007f7672c50eb0 llvm::sys::RunSignalHandlers() /home/stella/src/iree/third_party/llvm-project/llvm/lib/Support/Signals.cpp:106:18
#2 0x00007f7672c5334a SignalHandler(int) /home/stella/src/iree/third_party/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
#3 0x00007f766eb9d520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007f766ebf1a7c __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
#5 0x00007f766ebf1a7c __pthread_kill_internal ./nptl/./nptl/pthread_kill.c:78:10
#6 0x00007f766ebf1a7c pthread_kill ./nptl/./nptl/pthread_kill.c:89:10
#7 0x00007f766eb9d476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007f766eb837f3 abort ./stdlib/./stdlib/abort.c:81:7
#9 0x00007f766eb8371b _nl_load_domain ./intl/./intl/loadmsgcat.c:1177:9
#10 0x00007f766eb94e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00007f767582931e _create_offset_vector_direct /home/stella/src/iree/third_party/flatcc/src/runtime/builder.c:659:14
#12 0x00007f7675829bc0 flatcc_builder_create_union_vector_direct /home/stella/src/iree/third_party/flatcc/src/runtime/builder.c:1618:29
#13 0x00007f7675829bc0 flatcc_builder_create_union_vector /home/stella/src/iree/third_party/flatcc/src/runtime/builder.c:1606:13
#14 0x00007f7672d9cc6e iree_vm_LocationTypeDef_vec_create(flatcc_builder*, flatcc_builder_union_ref const*, unsigned long) /home/stella/src/iree-build/runtime/src/iree/../iree/schemas/bytecode_module_def_builder.h:299:1
#15 0x00007f7672d9cc6e mlir::iree_compiler::IREE::VM::LocationTable::finish() /home/stella/src/iree/compiler/src/iree/compiler/Dialect/VM/Target/Bytecode/DebugDatabaseBuilder.cpp:99:12
#16 0x00007f7672d9cc6e mlir::iree_compiler::IREE::VM::DebugDatabaseBuilder::build(mlir::iree_compiler::FlatbufferBuilder&) /home/stella/src/iree/compiler/src/iree/compiler/Dialect/VM/Target/Bytecode/DebugDatabaseBuilder.cpp:131:41
#17 0x00007f7672d8ef78 mlir::iree_compiler::IREE::VM::buildFlatBufferModule(mlir::iree_compiler::IREE::VM::TargetOptions, mlir::iree_compiler::IREE::VM::BytecodeTargetOptions, mlir::iree_compiler::IREE::VM::ModuleOp, llvm::MutableArrayRef, mlir::iree_compiler::FlatbufferBuilder&) /home/stella/src/iree/compiler/src/iree/compiler/Dialect/VM/Target/Bytecode/BytecodeModuleTarget.cpp:504:38
#18 0x00007f7672d8d1fa mlir::iree_compiler::IREE::VM::translateModuleToBytecode(mlir::iree_compiler::IREE::VM::ModuleOp, mlir::iree_compiler::IREE::VM::TargetOptions, mlir::iree_compiler::IREE::VM::BytecodeTargetOptions, llvm::raw_ostream&) /home/stella/src/iree/compiler/src/iree/compiler/Dialect/VM/Target/Bytecode/BytecodeModuleTarget.cpp:665:14
#19 0x00007f7672d8fc18 mlir::iree_compiler::IREE::VM::translateModuleToBytecode(mlir::ModuleOp, mlir::iree_compiler::IREE::VM::TargetOptions, mlir::iree_compiler::IREE::VM::BytecodeTargetOptions, llvm::raw_ostream&) /home/stella/src/iree/compiler/src/iree/compiler/Dialect/VM/Target/Bytecode/BytecodeModuleTarget.cpp:687:10
#20 0x00007f767374a7e8 mlir::iree_compiler::ConstEval::InMemoryCompiledBinary::translateFromModule(mlir::ModuleOp) /home/stella/src/iree/compiler/src/iree/compiler/ConstEval/Runtime.cpp:470:14
#21 0x00007f7672d8820b mlir::LogicalResult::failed() const /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:44:33
#22 0x00007f7672d8820b mlir::failed(mlir::LogicalResult) /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:72:58
#23 0x00007f7672d8820b mlir::iree_compiler::ConstEval::(anonymous namespace)::JitGlobalsPass::runOnOperation() /home/stella/src/iree/compiler/src/iree/compiler/ConstEval/JitGlobals.cpp:534:9
#24 0x00007f7672ddff75 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_7::operator()() const /home/stella/src/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:0:17
#25 0x00007f7672ddff75 void llvm::function_ref::callback_fn(long) /home/stella/src/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#26 0x00007f7672ddff75 llvm::function_ref::operator()() const /home/stella/src/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#27 0x00007f7672ddff75 void mlir::MLIRContext::executeAction(llvm::function_ref, llvm::ArrayRef, mlir::Pass&) /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/IR/MLIRContext.h:275:7
#28 0x00007f7672ddff75 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /home/stella/src/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:507:21
#29 0x00007f7672de06f8 mlir::LogicalResult::failed() const /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:44:33
#30 0x00007f7672de06f8 mlir::failed(mlir::LogicalResult) /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:72:58
#31 0x00007f7672de06f8 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /home/stella/src/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:579:9
#32 0x00007f7672de4f21 mlir::LogicalResult llvm::function_ref::callback_fn(long, mlir::OpPassManager&, mlir::Operation*) /home/stella/src/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#33 0x00007f767422e4bd mlir::iree_compiler::IREE::Util::(anonymous namespace)::FixedPointIteratorPass::runOnOperation() /home/stella/src/iree/compiler/src/iree/compiler/Dialect/Util/Transforms/FixedPointIterator.cpp:0:0
#34 0x00007f7672ddff75 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_7::operator()() const /home/stella/src/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:0:17
#35 0x00007f7672ddff75 void llvm::function_ref::callback_fn(long) /home/stella/src/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#36 0x00007f7672ddff75 llvm::function_ref::operator()() const /home/stella/src/iree/third_party/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#37 0x00007f7672ddff75 void mlir::MLIRContext::executeAction(llvm::function_ref, llvm::ArrayRef, mlir::Pass&) /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/IR/MLIRContext.h:275:7
#38 0x00007f7672ddff75 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /home/stella/src/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:507:21
#39 0x00007f7672de06f8 mlir::LogicalResult::failed() const /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:44:33
#40 0x00007f7672de06f8 mlir::failed(mlir::LogicalResult) /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:72:58
#41 0x00007f7672de06f8 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /home/stella/src/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:579:9
#42 0x00007f7672de2a99 mlir::PassManager::run(mlir::Operation*) /home/stella/src/iree/third_party/llvm-project/mlir/lib/Pass/Pass.cpp:0:0
#43 0x00007f7672badb27 mlir::LogicalResult::failed() const /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:44:33
#44 0x00007f7672badb27 mlir::failed(mlir::LogicalResult) /home/stella/src/iree/third_party/llvm-project/mlir/include/mlir/Support/LogicalResult.h:72:58
#45 0x00007f7672badb27 mlir::iree_compiler::embed::(anonymous namespace)::Invocation::runPipeline(iree_compiler_pipeline_t) /home/stella/src/iree/compiler/src/iree/compiler/API/Internal/CompilerDriver.cpp:958:7
#46 0x00007f7672badb27 ireeCompilerInvocationPipeline /home/stella/src/iree/compiler/src/iree/compiler/API/Internal/CompilerDriver.cpp:1388:23
#47 0x00007f7672daa665 mlir::iree_compiler::runIreecMain(int, char**)::$_2::operator()(iree_compiler_source_t*) const /home/stella/src/iree/compiler/src/iree/compiler/Tools/iree_compile_lib.cc:247:11
#48 0x00007f7672da9f10 mlir::iree_compiler::runIreecMain(int, char**) /home/stella/src/iree/compiler/src/iree/compiler/Tools/iree_compile_lib.cc:0:10
#49 0x00007f766eb84d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#50 0x00007f766eb84e40 call_init ./csu/../csu/libc-start.c:128:20
#51 0x00007f766eb84e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#52 0x000055759370e6b5 _start (./tools/iree-compile+0x16b5)
```

Repro:

```
./tools/iree-compile --iree-hal-target-backends=llvm-cpu --iree-input-type=onnx ~/tmp/badloc.mlir -o /dev/null
```

badloc.mlir:

```
#loc1 = loc("graph:gemm_activation_fusion")
module {
func.func @IreeExecutionProvider_IREE_0(%arg0: !torch.vtensor<[3,5],f32> loc("graph:gemm_activation_fusion"), %arg1: !torch.vtensor<[5,4],f32> loc("graph:gemm_activation_fusion"), %arg2: !torch.vtensor<[1,4],f32> loc("graph:gemm_activation_fusion")) -> !torch.vtensor<[3,4],f32> attributes {torch.onnx_meta.ir_version = 0 : si64, torch.onnx_meta.opset_version = 9 : si64, torch.onnx_meta.opset_versions = {ai.onnx.ml = 4 : si64, ai.onnx.preview.training = 1 : si64, ai.onnx.training = 1 : si64, com.microsoft = 1 : si64, com.microsoft.experimental = 1 : si64, com.microsoft.nchwc = 1 : si64, com.ms.internal.nhwc = 9 : si64, org.pytorch.aten = 1 : si64}, torch.onnx_meta.producer_name = "", torch.onnx_meta.producer_version = ""} {
%0 = torch.operator "onnx.Gemm"(%arg0, %arg1, %arg2) {torch.onnx.alpha = 1.000000e+00 : f32, torch.onnx.beta = 1.000000e+00 : f32, torch.onnx.transA = 0 : si64, torch.onnx.transB = 0 : si64} : (!torch.vtensor<[3,5],f32>, !torch.vtensor<[5,4],f32>, !torch.vtensor<[1,4],f32>) -> !torch.vtensor<[3,4],f32> loc(#loc2)
%1 = torch.operator "onnx.LeakyRelu"(%0) {torch.onnx.alpha = 0.00999999977 : f32} : (!torch.vtensor<[3,4],f32>) -> !torch.vtensor<[3,4],f32> loc(#loc2)
return %1 : !torch.vtensor<[3,4],f32> loc(#loc1)
} loc(#loc1)
} loc(#loc)
#loc = loc(unknown)
#loc2 = loc("")
```

I've patched the caller to not create such locs and verified that it works.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.