Skip to content

[mlir][affine] --affine-data-copy-generate crashed with assertion failure "Using getMemorySpaceInteger with non-Integer attribute" #71147

@ghost

Description

git version: a135822

system: Ubuntu 20.04.6 LTS (Focal Fossa)

reproduced with: mlir-opt --affine-data-copy-generate a.mlir

a.mlir:

func.func @func1() {
  %c1647415306_i32 = arith.constant 1647415306 : i32
  %alloc_16 = memref.alloc() : memref<2x9xi32, #spirv.storage_class<StorageBuffer>>
  affine.store %c1647415306_i32, %alloc_16[16, 20] : memref<2x9xi32, #spirv.storage_class<StorageBuffer>>
  return
}

trace:

mlir-opt: /data/bin/llvm-project/mlir/lib/IR/BuiltinTypes.cpp:514: unsigned int mlir::detail::getMemorySpaceAsInt(mlir::Attribute): Assertion `llvm::isa<IntegerAttr>(memorySpace) && "Using `getMemorySpaceInteger` with non-Integer attribute"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --affine-data-copy-generate a.mlir
 #0 0x0000562d5db598bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x15db8bf)
 #1 0x0000562d5db56954 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fe63721d420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fe636d0800b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fe636ce7859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007fe636ce7729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007fe636cf8fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x0000562d60869688 mlir::MemRefType::getMemorySpaceAsInt() const (/data/bin/llvm-project/build/bin/mlir-opt+0x42eb688)
 #8 0x0000562d5dce3bc9 mlir::affine::affineDataCopyGenerate(llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false>, false, false>, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false>, false, false>, mlir::affine::AffineCopyOptions const&, std::optional<mlir::Value>, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>&)::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const LoopUtils.cpp:0:0
 #9 0x0000562d5dce6cc9 mlir::affine::affineDataCopyGenerate(llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false>, false, false>, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false>, false, false>, mlir::affine::AffineCopyOptions const&, std::optional<mlir::Value>, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x1768cc9)
#10 0x0000562d5dc6fcad (anonymous namespace)::AffineDataCopyGeneration::runOnBlock(mlir::Block*, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>&) AffineDataCopyGeneration.cpp:0:0
#11 0x0000562d5dc706b3 (anonymous namespace)::AffineDataCopyGeneration::runOnOperation() AffineDataCopyGeneration.cpp:0:0
#12 0x0000562d606d50ce mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x41570ce)
#13 0x0000562d606d55aa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41575aa)
#14 0x0000562d606d5fac mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::'lambda'(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&)::operator()(mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&) const Pass.cpp:0:0
#15 0x0000562d606d4705 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x4156705)
#16 0x0000562d606d4e6a mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x4156e6a)
#17 0x0000562d606d55aa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x41575aa)
#18 0x0000562d606d5dd4 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x4157dd4)
#19 0x0000562d606c6b5b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x0000562d606c8014 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#21 0x0000562d606c81c4 mlir::LogicalResult llvm::function_ref<mlir::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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#22 0x0000562d607c7124 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x4249124)
#23 0x0000562d606c0c77 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4142c77)
#24 0x0000562d606c8311 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x414a311)
#25 0x0000562d606c8776 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x414a776)
#26 0x0000562d5da90e3b main (/data/bin/llvm-project/build/bin/mlir-opt+0x1512e3b)
#27 0x00007fe636ce9083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#28 0x0000562d5db29f8e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x15abf8e)
Aborted (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashPrefer [crash-on-valid] or [crash-on-invalid]mlir:affine

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions