<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/128326>128326</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[MLIR]`-test-bytecode-roundtrip` triggers Assertion Failure `succeeded(versionOr) && "expected reader to be able to access " "the version for test dialect"'
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xisang0
</td>
</tr>
</table>
<pre>
Test on commit: https://github.com/llvm/llvm-project/commit/dca2ed31278c444f839e3e04fde0c21b62451d4a
steps to reproduce:
```
mlir-opt test.mlir --test-bytecode-roundtrip
```
test case:
```
module {
func.func @conv2d_strided(%arg0: tensor<1x13x14x1xf32>, %arg1: tensor<1x1x1x1xf32>, %arg2: tensor<1xf32>) -> () {
%0 = tosa.conv2d %arg0, %arg1, %arg2 {dilation = array<i64: 1, 1>, pad = array<i64: 0, 0, 0, 0>, stride = array<i64: 3, 2>} : (tensor<1x13x14x1xf32>, tensor<1x1x1x1xf32>, tensor<1xf32>) -> tensor<?x?x?x?xf32>
return
}
}
```
crash trace:
```
mlir-opt: /home/workdir/llvm-project-19/mlir/test/lib/IR/TestBytecodeRoundtrip.cpp:170: auto (anonymous namespace)::TestBytecodeRoundtripPass::runTest0(Operation *)::(anonymous class)::operator()(DialectBytecodeReader &, StringRef, Type &) const: Assertion `succeeded(versionOr) && "expected reader to be able to access " "the version for test dialect"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./mlir-opt /home/workdir/test.mlir --test-bytecode-roundtrip
#0 0x0000622ceecc1258 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10b5258)
#1 0x0000622ceecbed7e llvm::sys::RunSignalHandlers() (./mlir-opt+0x10b2d7e)
#2 0x0000622ceecc1c68 SignalHandler(int) Signals.cpp:0:0
#3 0x0000779acd5e1520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000779acd6359fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x0000779acd5e1476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x0000779acd5c77f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x0000779acd5c771b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x0000779acd5d8e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000622cf1f84c24 (./mlir-opt+0x4378c24)
#10 0x0000622cf418d471 (anonymous namespace)::AttrTypeReader::resolveType(unsigned long) BytecodeReader.cpp:0:0
#11 0x0000622cf418c147 (anonymous namespace)::DialectReader::readType(mlir::Type&) BytecodeReader.cpp:0:0
#12 0x0000622cf21da2f1 (anonymous namespace)::BuiltinDialectBytecodeInterface::readAttribute(mlir::DialectBytecodeReader&) const BuiltinDialectBytecode.cpp:0:0
#13 0x0000622cf418cd14 (anonymous namespace)::AttrTypeReader::resolveAttribute(unsigned long) BytecodeReader.cpp:0:0
#14 0x0000622cf418c0a7 (anonymous namespace)::DialectReader::readAttribute(mlir::Attribute&) BytecodeReader.cpp:0:0
#15 0x0000622cef168961 llvm::LogicalResult mlir::DialectBytecodeReader::readAttribute<mlir::TypeAttr>(mlir::TypeAttr&) (./mlir-opt+0x155c961)
#16 0x0000622cef3678f7 mlir::func::FuncOp::readProperties(mlir::DialectBytecodeReader&, mlir::OperationState&) (./mlir-opt+0x175b8f7)
#17 0x0000622cf41899f8 mlir::BytecodeReader::Impl::parseRegions(std::vector<mlir::BytecodeReader::Impl::RegionReadState, std::allocator<mlir::BytecodeReader::Impl::RegionReadState>>&, mlir::BytecodeReader::Impl::RegionReadState&) (./mlir-opt+0x657d9f8)
#18 0x0000622cf418540b mlir::BytecodeReader::Impl::parseIRSection(llvm::ArrayRef<unsigned char>, mlir::Block*) (./mlir-opt+0x657940b)
#19 0x0000622cf418286d mlir::BytecodeReader::Impl::read(mlir::Block*, llvm::function_ref<bool (mlir::Operation*)>) (./mlir-opt+0x657686d)
#20 0x0000622cf418b1ee readBytecodeFileImpl(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&, std::shared_ptr<llvm::SourceMgr> const&) BytecodeReader.cpp:0:0
#21 0x0000622cf418b07e mlir::readBytecodeFile(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&) (./mlir-opt+0x657f07e)
#22 0x0000622cf20b3aff mlir::parseSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./mlir-opt+0x44a7aff)
#23 0x0000622cf20b4198 mlir::parseSourceString(llvm::StringRef, mlir::Block*, mlir::ParserConfig const&, llvm::StringRef, mlir::LocationAttr*) (./mlir-opt+0x44a8198)
#24 0x0000622cf1f84684 (anonymous namespace)::TestBytecodeRoundtripPass::doRoundtripWithConfigs(mlir::Operation*, mlir::BytecodeWriterConfig const&, mlir::ParserConfig const&) TestBytecodeRoundtrip.cpp:0:0
#25 0x0000622cf1f82240 (anonymous namespace)::TestBytecodeRoundtripPass::runOnOperation() TestBytecodeRoundtrip.cpp:0:0
#26 0x0000622cf20b6bcf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x44aabcf)
#27 0x0000622cf20b7352 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x44ab352)
#28 0x0000622cf20b9ade mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x44adade)
#29 0x0000622cf20b262b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#30 0x0000622cf20b2283 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#31 0x0000622cf215b9e5 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x454f9e5)
#32 0x0000622cf20abee2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x449fee2)
#33 0x0000622cf20ac193 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a0193)
#34 0x0000622cf20ac3a2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a03a2)
#35 0x0000622ceeca0477 main (./mlir-opt+0x1094477)
#36 0x0000779acd5c8d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#37 0x0000779acd5c8e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#38 0x0000622ceec9ffe5 _start (./mlir-opt+0x1093fe5)
Aborted (core dumped)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcWltP6zr2_zThxaJK7FwfeCiX6o-0EQi2dB4rx14p_pPGG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