llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[mlir](convert-xegpu-to-xevm) mlir-opt crashes at BuiltinTypes.cpp:646 with assertion `llvm::isa<IntegerAttr>(memorySpace) && "Using `getMemorySpaceInteger` with non-Integer attribute"' failed.

Open Aran-414 opened this issue 4 months ago • 3 comments

git version: b74f72c22f9024914b9743c9aa22b2fbc2095f4c

MLIR Program:

module {
  func.func @m() -> () {
    %true = arith.constant true
    %c0 = arith.constant 0 : index
    %cst = arith.constant dense<0.000000e+00> : vector<1xf32>
    %alloc = memref.alloc() : memref<1024xf32, #spirv.storage_class<StorageBuffer>>
    xegpu.store %cst, %alloc[%c0], %true  : vector<1xf32>, memref<1024xf32, #spirv.storage_class<StorageBuffer>>, index, i1
    return
  }
}

Reproduce Command: mlir-opt -convert-xegpu-to-xevm a.mlir

StackTrace:

mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/IR/BuiltinTypes.cpp:646: 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 and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: mlir-opt -convert-xegpu-to-xevm a.mlir
 #0 0x000055ec92f3db8f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1fa8b8f)
 #1 0x000055ec92f3a32c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1fa532c)
 #2 0x000055ec92f3a4d3 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007f2524724420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f252420f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f25241ee859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f25241ee729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f25241fffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055ec9c25cb08 mlir::detail::getMemorySpaceAsInt(mlir::Attribute) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2c7b08)
 #9 0x000055ec97bbc672 (anonymous namespace)::LoadStoreToXeVMPattern<mlir::xegpu::StoreScatterOp, void>::matchAndRewrite(mlir::xegpu::StoreScatterOp, mlir::xegpu::StoreScatterOpAdaptor, mlir::ConversionPatternRewriter&) const XeGPUToXeVM.cpp:0:0
#10 0x000055ec97bb2602 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1<mlir::OpConversionPattern<mlir::xegpu::StoreScatterOp>, mlir::xegpu::StoreScatterOp>(mlir::OpConversionPattern<mlir::xegpu::StoreScatterOp> const&, mlir::xegpu::StoreScatterOp, mlir::xegpu::StoreScatterOp::GenericAdaptor<llvm::ArrayRef<mlir::ValueRange>>, mlir::ConversionPatternRewriter&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x6c1d602)
#11 0x000055ec97bb2701 mlir::OpConversionPattern<mlir::xegpu::StoreScatterOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::ValueRange>, mlir::ConversionPatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x6c1d701)
#12 0x000055ec9bea4db8 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf0fdb8)
#13 0x000055ec9beebdf2 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#14 0x000055ec9beed358 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<llvm::LogicalResult (mlir::Pattern const&)>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf58358)
#15 0x000055ec9be9f8fb (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#16 0x000055ec9be9fde6 mlir::OperationConverter::convert(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf0ade6)
#17 0x000055ec9beaadba mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf15dba)
#18 0x000055ec9beac678 applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#19 0x000055ec9beac856 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf17856)
#20 0x000055ec97baf6c9 (anonymous namespace)::ConvertXeGPUToXeVMPass::runOnOperation() XeGPUToXeVM.cpp:0:0
#21 0x000055ec9bf57971 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafc2971)
#22 0x000055ec9bf57d00 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+0xafc2d00)
#23 0x000055ec9bf59db4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafc4db4)
#24 0x000055ec9bf5ae31 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafc5e31)
#25 0x000055ec930039ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#26 0x000055ec930044ef processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#27 0x000055ec9300471b llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, 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::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#28 0x000055ec9c327aa5 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::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb392aa5)
#29 0x000055ec92ffa764 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#30 0x000055ec93004c37 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x206fc37)
#31 0x000055ec93004e73 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x206fe73)
#32 0x000055ec92e8295c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1eed95c)
#33 0x00007f25241f0083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#34 0x000055ec92f1a15e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1f8515e)
Aborted (core dumped)

Aran-414 avatar Jul 21 '26 13:07 Aran-414

@llvm/issue-subscribers-mlir

Author: Aran-414

git version: b74f72c22f9024914b9743c9aa22b2fbc2095f4c

MLIR Program:

module {
  func.func @<!-- -->m() -&gt; () {
    %true = arith.constant true
    %c0 = arith.constant 0 : index
    %cst = arith.constant dense&lt;0.000000e+00&gt; : vector&lt;1xf32&gt;
    %alloc = memref.alloc() : memref&lt;1024xf32, #spirv.storage_class&lt;StorageBuffer&gt;&gt;
    xegpu.store %cst, %alloc[%c0], %true  : vector&lt;1xf32&gt;, memref&lt;1024xf32, #spirv.storage_class&lt;StorageBuffer&gt;&gt;, index, i1
    return
  }
}

Reproduce Command: mlir-opt -convert-xegpu-to-xevm a.mlir

StackTrace:

mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/IR/BuiltinTypes.cpp:646: unsigned int mlir::detail::getMemorySpaceAsInt(mlir::Attribute): Assertion `llvm::isa&lt;IntegerAttr&gt;(memorySpace) &amp;&amp; "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 and instructions to reproduce the bug.
Stack dump:
0.      Program arguments: mlir-opt -convert-xegpu-to-xevm a.mlir
 #<!-- -->0 0x000055ec92f3db8f llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1fa8b8f)
 #<!-- -->1 0x000055ec92f3a32c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1fa532c)
 #<!-- -->2 0x000055ec92f3a4d3 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #<!-- -->3 0x00007f2524724420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #<!-- -->4 0x00007f252420f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #<!-- -->5 0x00007f25241ee859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #<!-- -->6 0x00007f25241ee729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #<!-- -->7 0x00007f25241fffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #<!-- -->8 0x000055ec9c25cb08 mlir::detail::getMemorySpaceAsInt(mlir::Attribute) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb2c7b08)
 #<!-- -->9 0x000055ec97bbc672 (anonymous namespace)::LoadStoreToXeVMPattern&lt;mlir::xegpu::StoreScatterOp, void&gt;::matchAndRewrite(mlir::xegpu::StoreScatterOp, mlir::xegpu::StoreScatterOpAdaptor, mlir::ConversionPatternRewriter&amp;) const XeGPUToXeVM.cpp:0:0
#<!-- -->10 0x000055ec97bb2602 llvm::LogicalResult mlir::ConversionPattern::dispatchTo1To1&lt;mlir::OpConversionPattern&lt;mlir::xegpu::StoreScatterOp&gt;, mlir::xegpu::StoreScatterOp&gt;(mlir::OpConversionPattern&lt;mlir::xegpu::StoreScatterOp&gt; const&amp;, mlir::xegpu::StoreScatterOp, mlir::xegpu::StoreScatterOp::GenericAdaptor&lt;llvm::ArrayRef&lt;mlir::ValueRange&gt;&gt;, mlir::ConversionPatternRewriter&amp;) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x6c1d602)
#<!-- -->11 0x000055ec97bb2701 mlir::OpConversionPattern&lt;mlir::xegpu::StoreScatterOp&gt;::matchAndRewrite(mlir::Operation*, llvm::ArrayRef&lt;mlir::ValueRange&gt;, mlir::ConversionPatternRewriter&amp;) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x6c1d701)
#<!-- -->12 0x000055ec9bea4db8 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf0fdb8)
#<!-- -->13 0x000055ec9beebdf2 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;, llvm::function_ref&lt;bool (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;void (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;llvm::LogicalResult (mlir::Pattern const&amp;)&gt;)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#<!-- -->14 0x000055ec9beed358 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&amp;, llvm::function_ref&lt;bool (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;void (mlir::Pattern const&amp;)&gt;, llvm::function_ref&lt;llvm::LogicalResult (mlir::Pattern const&amp;)&gt;) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf58358)
#<!-- -->15 0x000055ec9be9f8fb (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*) DialectConversion.cpp:0:0
#<!-- -->16 0x000055ec9be9fde6 mlir::OperationConverter::convert(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf0ade6)
#<!-- -->17 0x000055ec9beaadba mlir::OperationConverter::applyConversion(llvm::ArrayRef&lt;mlir::Operation*&gt;) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf15dba)
#<!-- -->18 0x000055ec9beac678 applyConversion(llvm::ArrayRef&lt;mlir::Operation*&gt;, mlir::ConversionTarget const&amp;, mlir::FrozenRewritePatternSet const&amp;, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#<!-- -->19 0x000055ec9beac856 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&amp;, mlir::FrozenRewritePatternSet const&amp;, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xaf17856)
#<!-- -->20 0x000055ec97baf6c9 (anonymous namespace)::ConvertXeGPUToXeVMPass::runOnOperation() XeGPUToXeVM.cpp:0:0
#<!-- -->21 0x000055ec9bf57971 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafc2971)
#<!-- -->22 0x000055ec9bf57d00 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&amp;, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafc2d00)
#<!-- -->23 0x000055ec9bf59db4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafc4db4)
#<!-- -->24 0x000055ec9bf5ae31 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xafc5e31)
#<!-- -->25 0x000055ec930039ab performActions(llvm::raw_ostream&amp;, std::shared_ptr&lt;llvm::SourceMgr&gt; const&amp;, mlir::MLIRContext*, mlir::MlirOptMainConfig const&amp;) MlirOptMain.cpp:0:0
#<!-- -->26 0x000055ec930044ef processBuffer(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&amp;, mlir::DialectRegistry&amp;, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#<!-- -->27 0x000055ec9300471b llvm::LogicalResult llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;)&gt;::callback_fn&lt;mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;)::'lambda'(std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef, llvm::raw_ostream&amp;)&gt;(long, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;) MlirOptMain.cpp:0:0
#<!-- -->28 0x000055ec9c327aa5 mlir::splitAndProcessBuffer(std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::function_ref&lt;llvm::LogicalResult (std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, llvm::MemoryBufferRef const&amp;, llvm::raw_ostream&amp;)&gt;, llvm::raw_ostream&amp;, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb392aa5)
#<!-- -->29 0x000055ec92ffa764 mlir::MlirOptMain(llvm::raw_ostream&amp;, std::unique_ptr&lt;llvm::MemoryBuffer, std::default_delete&lt;llvm::MemoryBuffer&gt;&gt;, mlir::DialectRegistry&amp;, mlir::MlirOptMainConfig const&amp;) (.part.0) MlirOptMain.cpp:0:0
#<!-- -->30 0x000055ec93004c37 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&amp;) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x206fc37)
#<!-- -->31 0x000055ec93004e73 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&amp;) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x206fe73)
#<!-- -->32 0x000055ec92e8295c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1eed95c)
#<!-- -->33 0x00007f25241f0083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#<!-- -->34 0x000055ec92f1a15e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x1f8515e)
Aborted (core dumped)

Hey, I wish to work on this may you please assign it to me

purnima-nlp avatar Jul 21 '26 14:07 purnima-nlp

xegpu dialect is not designed to work along with SPIR-V dialect. The test case crashing is an issue though. Correct behavior for convert-xegpu-to-xevm pass would be to fail to lower xegpu.store op.

silee2 avatar Jul 28 '26 17:07 silee2