Issue 128328
Summary [MLIR]`-test-bytecode-roundtrip=test-kind=2` triggers Assertion Failure `val == 0 && "Value must be zero for unsigned 0-bit APInt"'
Labels mlir
Assignees
Reporter xisang0
    Test on commit: https://github.com/llvm/llvm-project/commit/dca2ed31278c444f839e3e04fde0c21b62451d4a
steps to reproduce:
```
mlir-opt test.mlir --test-bytecode-roundtrip=test-kind=2
```
test case:
```
module {
 func.func @main(%arg0: tensor<1x2xf32>, %arg1: tensor<2x?xf32>) -> () {
 // Call test_concat_dynamic
    %concat_result = tosa.concat %arg0, %arg1 {axis = 0 : i32} : (tensor<1x2xf32>, tensor<2x?xf32>) -> tensor<?x?xf32>
 return
  }
}
```
crash trace:
```
Overriding parsing of TestI32Type encoding...
-:0:0: error: expected integer or index type for IntegerAttr, but got: '!test.i32'
-:0:0: note: in bytecode version 6 produced by: MLIR20.0.0git
mlir-opt: /home/workdir/llvm-project-19/llvm/include/llvm/ADT/APInt.h:125: llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `val == 0 && "Value must be zero for unsigned 0-bit APInt"' 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=test-kind=2
 #0 0x00005857c3089258 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10b5258)
 #1 0x00005857c3086d7e llvm::sys::RunSignalHandlers() (./mlir-opt+0x10b2d7e)
 #2 0x00005857c3089c68 SignalHandler(int) Signals.cpp:0:0
 #3 0x000072a9cc5e1520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000072a9cc6359fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000072a9cc5e1476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000072a9cc5c77f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000072a9cc5c771b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000072a9cc5d8e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00005857c85544da (anonymous namespace)::DialectReader::readAPIntWithKnownWidth(unsigned int) BytecodeReader.cpp:0:0
#10 0x00005857c65a2e5a (anonymous namespace)::BuiltinDialectBytecodeInterface::readAttribute(mlir::DialectBytecodeReader&) const BuiltinDialectBytecode.cpp:0:0
#11 0x00005857c8554d14 (anonymous namespace)::AttrTypeReader::resolveAttribute(unsigned long) BytecodeReader.cpp:0:0
#12 0x00005857c85540a7 (anonymous namespace)::DialectReader::readAttribute(mlir::Attribute&) BytecodeReader.cpp:0:0
#13 0x00005857c3143951 llvm::LogicalResult mlir::DialectBytecodeReader::readAttribute<mlir::IntegerAttr>(mlir::IntegerAttr&) (./mlir-opt+0x116f951)
#14 0x00005857c56380f9 mlir::detail::BytecodeOpInterfaceInterfaceTraits::Model<mlir::tosa::ConcatOp>::readProperties(mlir::DialectBytecodeReader&, mlir::OperationState&) (./mlir-opt+0x36640f9)
#15 0x00005857c85519f8 mlir::BytecodeReader::Impl::parseRegions(std::vector<mlir::BytecodeReader::Impl::RegionReadState, std::allocator<mlir::BytecodeReader::Impl::RegionReadState>>&, mlir::BytecodeReader::Impl::RegionReadState&) (./mlir-opt+0x657d9f8)
#16 0x00005857c854d40b mlir::BytecodeReader::Impl::parseIRSection(llvm::ArrayRef<unsigned char>, mlir::Block*) (./mlir-opt+0x657940b)
#17 0x00005857c854a86d mlir::BytecodeReader::Impl::read(mlir::Block*, llvm::function_ref<bool (mlir::Operation*)>) (./mlir-opt+0x657686d)
#18 0x00005857c85531ee readBytecodeFileImpl(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&, std::shared_ptr<llvm::SourceMgr> const&) BytecodeReader.cpp:0:0
#19 0x00005857c855307e mlir::readBytecodeFile(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&) (./mlir-opt+0x657f07e)
#20 0x00005857c647baff mlir::parseSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./mlir-opt+0x44a7aff)
#21 0x00005857c647c198 mlir::parseSourceString(llvm::StringRef, mlir::Block*, mlir::ParserConfig const&, llvm::StringRef, mlir::LocationAttr*) (./mlir-opt+0x44a8198)
#22 0x00005857c634c684 (anonymous namespace)::TestBytecodeRoundtripPass::doRoundtripWithConfigs(mlir::Operation*, mlir::BytecodeWriterConfig const&, mlir::ParserConfig const&) TestBytecodeRoundtrip.cpp:0:0
#23 0x00005857c634a4f0 (anonymous namespace)::TestBytecodeRoundtripPass::runOnOperation() TestBytecodeRoundtrip.cpp:0:0
#24 0x00005857c647ebcf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x44aabcf)
#25 0x00005857c647f352 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x44ab352)
#26 0x00005857c6481ade mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x44adade)
#27 0x00005857c647a62b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#28 0x00005857c647a283 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
#29 0x00005857c65239e5 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)
#30 0x00005857c6473ee2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x449fee2)
#31 0x00005857c6474193 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a0193)
#32 0x00005857c64743a2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a03a2)
#33 0x00005857c3068477 main (./mlir-opt+0x1094477)
#34 0x000072a9cc5c8d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#35 0x000072a9cc5c8e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#36 0x00005857c3067fe5 _start (./mlir-opt+0x1093fe5)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to