Issue 128312
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/a9882bda96228ca23e166a817f93a7dbc99763cb
steps to reproduce:
```
mlir-opt test.mlir -test-bytecode-roundtrip=test-kind=2
```
test case:
```
module {
 func.func @combined_operations() -> () {
    %cst = arith.constant dense<[[true, true, true], [true, false, true]]> : tensor<2x3xi1>
 %reduction_output = tosa.reduce_all %cst {axis = 1 : i32} : (tensor<2x3xi1>) -> tensor<2x1xi1>
    return
  }
}
```
crash trace:
```
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 0x00005ed14c5be998 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x108a998)
 #1 0x00005ed14c5bc4be llvm::sys::RunSignalHandlers() (./mlir-opt+0x10884be)
 #2 0x00005ed14c5bf3a8 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000754d8cf4e520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000754d8cfa29fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000754d8cf4e476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000754d8cf347f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000754d8cf3471b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000754d8cf45e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00005ed151965baa (anonymous namespace)::DialectReader::readAPIntWithKnownWidth(unsigned int) BytecodeReader.cpp:0:0
#10 0x00005ed14f9b300f (anonymous namespace)::BuiltinDialectBytecodeInterface::readAttribute(mlir::DialectBytecodeReader&) const BuiltinDialectBytecode.cpp:0:0
#11 0x00005ed1519663e4 (anonymous namespace)::AttrTypeReader::resolveAttribute(unsigned long) BytecodeReader.cpp:0:0
#12 0x00005ed151965777 (anonymous namespace)::DialectReader::readAttribute(mlir::Attribute&) BytecodeReader.cpp:0:0
#13 0x00005ed14c6784f1 llvm::LogicalResult mlir::DialectBytecodeReader::readAttribute<mlir::IntegerAttr>(mlir::IntegerAttr&) (./mlir-opt+0x11444f1)
#14 0x00005ed14eb65529 mlir::detail::BytecodeOpInterfaceInterfaceTraits::Model<mlir::tosa::ReduceAllOp>::readProperties(mlir::DialectBytecodeReader&, mlir::OperationState&) (./mlir-opt+0x3631529)
#15 0x00005ed1519630c8 mlir::BytecodeReader::Impl::parseRegions(std::vector<mlir::BytecodeReader::Impl::RegionReadState, std::allocator<mlir::BytecodeReader::Impl::RegionReadState>>&, mlir::BytecodeReader::Impl::RegionReadState&) (./mlir-opt+0x642f0c8)
#16 0x00005ed15195eadb mlir::BytecodeReader::Impl::parseIRSection(llvm::ArrayRef<unsigned char>, mlir::Block*) (./mlir-opt+0x642aadb)
#17 0x00005ed15195bf3d mlir::BytecodeReader::Impl::read(mlir::Block*, llvm::function_ref<bool (mlir::Operation*)>) (./mlir-opt+0x6427f3d)
#18 0x00005ed1519648be readBytecodeFileImpl(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&, std::shared_ptr<llvm::SourceMgr> const&) BytecodeReader.cpp:0:0
#19 0x00005ed15196474e mlir::readBytecodeFile(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&) (./mlir-opt+0x643074e)
#20 0x00005ed14f88c2ef mlir::parseSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./mlir-opt+0x43582ef)
#21 0x00005ed14f88c988 mlir::parseSourceString(llvm::StringRef, mlir::Block*, mlir::ParserConfig const&, llvm::StringRef, mlir::LocationAttr*) (./mlir-opt+0x4358988)
#22 0x00005ed14f75de74 (anonymous namespace)::TestBytecodeRoundtripPass::doRoundtripWithConfigs(mlir::Operation*, mlir::BytecodeWriterConfig const&, mlir::ParserConfig const&) TestBytecodeRoundtrip.cpp:0:0
#23 0x00005ed14f75bcb0 (anonymous namespace)::TestBytecodeRoundtripPass::runOnOperation() TestBytecodeRoundtrip.cpp:0:0
#24 0x00005ed14f88f3bf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x435b3bf)
#25 0x00005ed14f88fba2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x435bba2)
#26 0x00005ed14f89234e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x435e34e)
#27 0x00005ed14f88ae6b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#28 0x00005ed14f88aacb 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 0x00005ed14f933df5 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+0x43ffdf5)
#30 0x00005ed14f8859b2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x43519b2)
#31 0x00005ed14f885c63 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351c63)
#32 0x00005ed14f885e72 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351e72)
#33 0x00005ed14c59dc27 main (./mlir-opt+0x1069c27)
#34 0x0000754d8cf35d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#35 0x0000754d8cf35e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#36 0x00005ed14c59d795 _start (./mlir-opt+0x1069795)
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