Skip to content

[MLIR]-test-bytecode-roundtrip=test-kind=2 triggers Assertion Failure `isIntOrFloat() && "only integers and floats have a bitwidth"' #128327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xisang0 opened this issue Feb 22, 2025 · 1 comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir

Comments

@xisang0
Copy link

xisang0 commented Feb 22, 2025

Test on commit: dca2ed3
steps to reproduce:

mlir-opt test.mlir --test-bytecode-roundtrip=test-kind=2

test case:

module {
  func.func @reshape_canonicalize_const() -> () {
    %0 = "tosa.const"() {value = dense<[0, 1, 2, 3, 4]> : tensor<5xi32>} : () -> tensor<5xi32>
    %1 = tosa.reshape %0 {new_shape = array<i64: 1, 5>} : (tensor<5xi32>) -> tensor<1x5xi32>
    return
  }
}

crash trace:
mlir-opt: /home/workdir/llvm-project-19/mlir/lib/IR/Types.cpp:134: unsigned int mlir::Type::getIntOrFloatBitWidth() const: Assertion `isIntOrFloat() && "only integers and floats have a bitwidth"' 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 0x00005926f2237258 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10b5258)
#1 0x00005926f2234d7e llvm::sys::RunSignalHandlers() (./mlir-opt+0x10b2d7e)
#2 0x00005926f2237c68 SignalHandler(int) Signals.cpp:0:0
#3 0x000071d900b1a520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000071d900b6e9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000071d900b1a476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000071d900b007f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000071d900b0071b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000071d900b11e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x00005926f57ec105 mlir::Type::getIntOrFloatBitWidth() const (./mlir-opt+0x466a105)
#10 0x00005926f5719174 mlir::detail::getDenseElementBitWidth(mlir::Type) (./mlir-opt+0x4597174)
#11 0x00005926f571d457 mlir::DenseIntOrFPElementsAttr::getRaw(mlir::ShapedType, llvm::ArrayRef) (./mlir-opt+0x459b457)
#12 0x00005926f57509f4 (anonymous namespace)::BuiltinDialectBytecodeInterface::readAttribute(mlir::DialectBytecodeReader&) const BuiltinDialectBytecode.cpp:0:0
#13 0x00005926f7702d14 (anonymous namespace)::AttrTypeReader::resolveAttribute(unsigned long) BytecodeReader.cpp:0:0
#14 0x00005926f77020a7 (anonymous namespace)::DialectReader::readAttribute(mlir::Attribute&) BytecodeReader.cpp:0:0
#15 0x00005926f477f2c4 llvm::LogicalResult mlir::DialectBytecodeReader::readAttributemlir::ElementsAttr(mlir::ElementsAttr&) (./mlir-opt+0x35fd2c4)
#16 0x00005926f47e7c28 mlir::detail::BytecodeOpInterfaceInterfaceTraits::Modelmlir::tosa::ConstOp::readProperties(mlir::DialectBytecodeReader&, mlir::OperationState&) (./mlir-opt+0x3665c28)
#17 0x00005926f76ff9f8 mlir::BytecodeReader::Impl::parseRegions(std::vector<mlir::BytecodeReader::Impl::RegionReadState, std::allocatormlir::BytecodeReader::Impl::RegionReadState>&, mlir::BytecodeReader::Impl::RegionReadState&) (./mlir-opt+0x657d9f8)
#18 0x00005926f76fb40b mlir::BytecodeReader::Impl::parseIRSection(llvm::ArrayRef, mlir::Block*) (./mlir-opt+0x657940b)
#19 0x00005926f76f886d mlir::BytecodeReader::Impl::read(mlir::Block*, llvm::function_ref<bool (mlir::Operation*)>) (./mlir-opt+0x657686d)
#20 0x00005926f77011ee readBytecodeFileImpl(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&, std::shared_ptrllvm::SourceMgr const&) BytecodeReader.cpp:0:0
#21 0x00005926f770107e mlir::readBytecodeFile(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&) (./mlir-opt+0x657f07e)
#22 0x00005926f5629aff mlir::parseSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./mlir-opt+0x44a7aff)
#23 0x00005926f562a198 mlir::parseSourceString(llvm::StringRef, mlir::Block*, mlir::ParserConfig const&, llvm::StringRef, mlir::LocationAttr*) (./mlir-opt+0x44a8198)
#24 0x00005926f54fa684 (anonymous namespace)::TestBytecodeRoundtripPass::doRoundtripWithConfigs(mlir::Operation*, mlir::BytecodeWriterConfig const&, mlir::ParserConfig const&) TestBytecodeRoundtrip.cpp:0:0
#25 0x00005926f54f84f0 (anonymous namespace)::TestBytecodeRoundtripPass::runOnOperation() TestBytecodeRoundtrip.cpp:0:0
#26 0x00005926f562cbcf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x44aabcf)
#27 0x00005926f562d352 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x44ab352)
#28 0x00005926f562fade mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x44adade)
#29 0x00005926f562862b performActions(llvm::raw_ostream&, std::shared_ptrllvm::SourceMgr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#30 0x00005926f5628283 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#31 0x00005926f56d19e5 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x454f9e5)
#32 0x00005926f5621ee2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_deletellvm::MemoryBuffer>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x449fee2)
#33 0x00005926f5622193 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a0193)
#34 0x00005926f56223a2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a03a2)
#35 0x00005926f2216477 main (./mlir-opt+0x1094477)
#36 0x000071d900b01d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#37 0x000071d900b01e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#38 0x00005926f2215fe5 _start (./mlir-opt+0x1093fe5)
Aborted (core dumped)

@llvmbot llvmbot added the mlir label Feb 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 22, 2025

@llvm/issue-subscribers-mlir

Author: None (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 @reshape_canonicalize_const() -> () { %0 = "tosa.const"() {value = dense<[0, 1, 2, 3, 4]> : tensor<5xi32>} : () -> tensor<5xi32> %1 = tosa.reshape %0 {new_shape = array<i64: 1, 5>} : (tensor<5xi32>) -> tensor<1x5xi32> return } } ``` crash trace: mlir-opt: /home/workdir/llvm-project-19/mlir/lib/IR/Types.cpp:134: unsigned int mlir::Type::getIntOrFloatBitWidth() const: Assertion `isIntOrFloat() && "only integers and floats have a bitwidth"' 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 0x00005926f2237258 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10b5258) #1 0x00005926f2234d7e llvm::sys::RunSignalHandlers() (./mlir-opt+0x10b2d7e) #2 0x00005926f2237c68 SignalHandler(int) Signals.cpp:0:0 #3 0x000071d900b1a520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #4 0x000071d900b6e9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #5 0x000071d900b1a476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #6 0x000071d900b007f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #7 0x000071d900b0071b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b) #8 0x000071d900b11e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #9 0x00005926f57ec105 mlir::Type::getIntOrFloatBitWidth() const (./mlir-opt+0x466a105) #10 0x00005926f5719174 mlir::detail::getDenseElementBitWidth(mlir::Type) (./mlir-opt+0x4597174) #11 0x00005926f571d457 mlir::DenseIntOrFPElementsAttr::getRaw(mlir::ShapedType, llvm::ArrayRef<char>) (./mlir-opt+0x459b457) #12 0x00005926f57509f4 (anonymous namespace)::BuiltinDialectBytecodeInterface::readAttribute(mlir::DialectBytecodeReader&) const BuiltinDialectBytecode.cpp:0:0 #13 0x00005926f7702d14 (anonymous namespace)::AttrTypeReader::resolveAttribute(unsigned long) BytecodeReader.cpp:0:0 #14 0x00005926f77020a7 (anonymous namespace)::DialectReader::readAttribute(mlir::Attribute&) BytecodeReader.cpp:0:0 #15 0x00005926f477f2c4 llvm::LogicalResult mlir::DialectBytecodeReader::readAttribute<mlir::ElementsAttr>(mlir::ElementsAttr&) (./mlir-opt+0x35fd2c4) #16 0x00005926f47e7c28 mlir::detail::BytecodeOpInterfaceInterfaceTraits::Model<mlir::tosa::ConstOp>::readProperties(mlir::DialectBytecodeReader&, mlir::OperationState&) (./mlir-opt+0x3665c28) #17 0x00005926f76ff9f8 mlir::BytecodeReader::Impl::parseRegions(std::vector<mlir::BytecodeReader::Impl::RegionReadState, std::allocator<mlir::BytecodeReader::Impl::RegionReadState>>&, mlir::BytecodeReader::Impl::RegionReadState&) (./mlir-opt+0x657d9f8) #18 0x00005926f76fb40b mlir::BytecodeReader::Impl::parseIRSection(llvm::ArrayRef<unsigned char>, mlir::Block*) (./mlir-opt+0x657940b) #19 0x00005926f76f886d mlir::BytecodeReader::Impl::read(mlir::Block*, llvm::function_ref<bool (mlir::Operation*)>) (./mlir-opt+0x657686d) #20 0x00005926f77011ee readBytecodeFileImpl(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&, std::shared_ptr<llvm::SourceMgr> const&) BytecodeReader.cpp:0:0 #21 0x00005926f770107e mlir::readBytecodeFile(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&) (./mlir-opt+0x657f07e) #22 0x00005926f5629aff mlir::parseSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./mlir-opt+0x44a7aff) #23 0x00005926f562a198 mlir::parseSourceString(llvm::StringRef, mlir::Block*, mlir::ParserConfig const&, llvm::StringRef, mlir::LocationAttr*) (./mlir-opt+0x44a8198) #24 0x00005926f54fa684 (anonymous namespace)::TestBytecodeRoundtripPass::doRoundtripWithConfigs(mlir::Operation*, mlir::BytecodeWriterConfig const&, mlir::ParserConfig const&) TestBytecodeRoundtrip.cpp:0:0 #25 0x00005926f54f84f0 (anonymous namespace)::TestBytecodeRoundtripPass::runOnOperation() TestBytecodeRoundtrip.cpp:0:0 #26 0x00005926f562cbcf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x44aabcf) #27 0x00005926f562d352 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x44ab352) #28 0x00005926f562fade mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x44adade) #29 0x00005926f562862b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0 #30 0x00005926f5628283 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 0x00005926f56d19e5 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 0x00005926f5621ee2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x449fee2) #33 0x00005926f5622193 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a0193) #34 0x00005926f56223a2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a03a2) #35 0x00005926f2216477 main (./mlir-opt+0x1094477) #36 0x000071d900b01d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #37 0x000071d900b01e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #38 0x00005926f2215fe5 _start (./mlir-opt+0x1093fe5) Aborted (core dumped) ```

@EugeneZelenko EugeneZelenko added the crash Prefer [crash-on-valid] or [crash-on-invalid] label Feb 22, 2025
@xisang0 xisang0 closed this as completed Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] mlir
Projects
None yet
Development

No branches or pull requests

3 participants