[mlir](map-memref-spirv-storage-class) mlir-opt crashes at BuiltinAttributes.cpp:367 with assertion `(getType().isIndex() || getType().isSignlessInteger()) && "must be signless integer"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: 05972435037cb69e899b4e2b960f0a880d11f8a2
MLIR Program:
```mlir
module {
func.func @m10() -> () {
%alloc = memref.alloc() alignment = 64 : memref<10xf32, 1 : ui64>
return
}
}
```
Reproduce Command: `mlir-opt --map-memref-spirv-storage-class a.mlir`
StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/IR/BuiltinAttributes.cpp:367: int64_t mlir::IntegerAttr::getInt() const: Assertion `(getType().isIndex() || getType().isSignlessInteger()) && "must be signless integer"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: mlir-opt --map-memref-spirv-storage-class a.mlir
#0 0x0000563ddeb607af llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x203b7af)
#1 0x0000563ddeb5cf4c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2037f4c)
#2 0x0000563ddeb5d0f3 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fd033925420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fd03341000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fd0333ef859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007fd0333ef729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007fd033400fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000563de80a2996 mlir::IntegerAttr::getInt() const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb57d996)
#9 0x0000563de3386cbf mlir::spirv::mapMemorySpaceToVulkanStorageClass(mlir::Attribute) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x6861cbf)
#10 0x0000563de33886d1 std::_Function_handler (llvm::PointerUnion, llvm::SmallVectorImpl&), std::enable_if (mlir::Attribute)> const&)::'lambda0'(mlir::BaseMemRefType), mlir::BaseMemRefType, llvm::SmallVectorImpl&> && is_base_of_v, std::function (llvm::PointerUnion, llvm::SmallVectorImpl&)>>::type mlir::TypeConverter::wrapCallback (mlir::Attribute)> const&)::'lambda0'(mlir::BaseMemRefType), mlir::BaseMemRefType>, std::function (llvm::PointerUnion, llvm::SmallVectorImpl&)>>::type mlir::TypeConverter::wrapCallback (mlir::Attribute)> const&)::'lambda0'(mlir::BaseMemRefType)>(mlir::spirv::MemorySpaceToStorageClassConverter::MemorySpaceToStorageClassConverter(std::function (mlir::Attribute)> const&)::'lambda0'(mlir::BaseMemRefType)&&)::'lambda'(mlir::BaseMemRefType, llvm::SmallVectorImpl&)>(mlir::spirv::MemorySpaceToStorageClassConverter::MemorySpaceToStorageClassConverter(std::function (mlir::Attribute)> const&)::'lambda0'(mlir::BaseMemRefType)&&) const::'lambda'(llvm::PointerUnion, llvm::SmallVectorImpl&)>::_M_invoke(std::_Any_data const&, llvm::PointerUnion&&, llvm::SmallVectorImpl&) MapMemRefStorageClassPass.cpp:0:0
#11 0x0000563de7d24026 mlir::TypeConverter::convertTypeImpl(llvm::PointerUnion, llvm::SmallVectorImpl&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb1ff026)
#12 0x0000563de7d25511 mlir::TypeConverter::convertType(mlir::Type) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb200511)
#13 0x0000563de3386f43 std::_Function_handler> (mlir::Type), std::enable_if || !is_convertible_v, std::optional>>, void>::type mlir::detail::AttrTypeReplacerBase::addReplacement>(mlir::spirv::convertMemRefTypesAndAttrs(mlir::Operation*, mlir::spirv::MemorySpaceToStorageClassConverter&)::'lambda'(mlir::BaseMemRefType)&&)::'lambda'(mlir::Type)>::_M_invoke(std::_Any_data const&, mlir::Type&&) MapMemRefStorageClassPass.cpp:0:0
#14 0x0000563de8084d8a mlir::detail::AttrTypeReplacerBase::replaceBase(mlir::Type) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb55fd8a)
#15 0x0000563de80880b2 mlir::Type mlir::AttrTypeReplacer::cachedReplaceImpl(mlir::Type) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5630b2)
#16 0x0000563de8088b59 mlir::detail::AttrTypeReplacerBase::replaceElementsIn(mlir::Operation*, bool, bool, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb563b59)
#17 0x0000563de8084a5c void mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (.constprop.2) AttrTypeSubElements.cpp:0:0
#18 0x0000563de8088e61 mlir::detail::AttrTypeReplacerBase::recursivelyReplaceElementsIn(mlir::Operation*, bool, bool, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb563e61)
#19 0x0000563de33884a5 mlir::spirv::convertMemRefTypesAndAttrs(mlir::Operation*, mlir::spirv::MemorySpaceToStorageClassConverter&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x68634a5)
#20 0x0000563de3388df9 (anonymous namespace)::MapMemRefStorageClassPass::runOnOperation() MapMemRefStorageClassPass.cpp:0:0
#21 0x0000563de7de7411 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2c2411)
#22 0x0000563de7de77a0 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2c27a0)
#23 0x0000563de7de9854 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2c4854)
#24 0x0000563de7dea8d1 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2c58d1)
#25 0x0000563ddec26d1b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#26 0x0000563ddec2785f processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#27 0x0000563ddec27a8b llvm::LogicalResult llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#28 0x0000563de81bd745 mlir::splitAndProcessBuffer(std::unique_ptr>, llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb698745)
#29 0x0000563ddec1dad4 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#30 0x0000563ddec27fa7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2102fa7)
#31 0x0000563ddec281e3 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x21031e3)
#32 0x0000563ddeaa4d97 main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1f7fd97)
#33 0x00007fd0333f1083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#34 0x0000563ddeb3cd7e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2017d7e)
Aborted (core dumped)
```
Contributor guide
Research direction
Run the supplied mlir-opt --map-memref-spirv-storage-class reproducer first, then inspect mapMemorySpaceToVulkanStorageClass in MapMemRefStorageClassPass.cpp and the IntegerAttr assertion in BuiltinAttributes.cpp. Determine how the ui64 memory-space attribute is handled, and consider the issue complete when the reproducer no longer aborts and regression coverage protects that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100