llvm / llvm/llvm-project

[mlir][xegpu](xegpu-propagate-layout) mlir-opt crashes at OperationSupport.h:83 with assertion `(typeID == TypeID::get<std::remove_cv_t<std::remove_pointer_t<Dest>>>()) && "Property type mismatch: TypeID does not match requested type"' failed.

Open
#221,142 3 comments 0 reactions 0 assignees View on GitHub
crash mlir:xegpu
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

git version: 7ece48b9e5bb7aafdcc53aa2445328a67b501d24

MLIR Program:
```mlir
module {
func.func @m0(%arg0: f32) -> () {
%cst_1 = arith.constant dense<1.000000e+00> : vector<16xf32>
%0 = vector.reduction , %cst_1 : vector<16xf32> into f32
return
}
}
```

Reproduce Command: `mlir-opt -xegpu-propagate-layout -allow-unregistered-dialect a.mlir`

StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/mlir/include/mlir/IR/OperationSupport.h:83: Dest mlir::PropertyRef::as() const [with Dest = mlir::Attribute*]: Assertion `(typeID == TypeID::get>>()) && "Property type mismatch: TypeID does not match requested type"' 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 -xegpu-propagate-layout -allow-unregistered-dialect a.mlir
#0 0x0000556f5235eddf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20bfddf)
#1 0x0000556f5235b94c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20bc94c)
#2 0x0000556f5235baf3 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f190667b420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f190616600b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f1906145859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f1906145729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f1906156fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000556f5bc3a941 (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb99b941)
#9 0x0000556f5bc4c4e9 mlir::Operation::Operation(mlir::Location, mlir::OperationName, unsigned int, unsigned int, unsigned int, int, mlir::DictionaryAttr, mlir::PropertyRef, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb9ad4e9)
#10 0x0000556f5bc4ea76 mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::DictionaryAttr, mlir::PropertyRef, mlir::BlockRange, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb9afa76)
#11 0x0000556f5bc4f1ea mlir::Operation::create(mlir::Location, mlir::OperationName, mlir::TypeRange, mlir::ValueRange, mlir::NamedAttrList&&, mlir::PropertyRef, mlir::BlockRange, mlir::RegionRange) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb9b01ea)
#12 0x0000556f5bc4f5a8 mlir::Operation::create(mlir::OperationState const&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb9b05a8)
#13 0x0000556f5bb89683 mlir::OpBuilder::create(mlir::OperationState const&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb8ea683)
#14 0x0000556f57458f3a mlir::xegpu::ConvertLayoutOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::Value, mlir::xegpu::DistributeLayoutAttr, mlir::xegpu::DistributeLayoutAttr) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x71b9f3a)
#15 0x0000556f573d06a1 (anonymous namespace)::ResolveLayoutConflicts::assignResultLayout(mlir::OpResult&) XeGPUPropagateLayout.cpp:0:0
#16 0x0000556f573d40cd mlir::WalkResult llvm::function_ref::callback_fn<(anonymous namespace)::ResolveLayoutConflicts::run()::'lambda'(mlir::Operation*)>(long, mlir::Operation*) XeGPUPropagateLayout.cpp:0:0
#17 0x0000556f524449e2 mlir::WalkResult mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x21a59e2)
#18 0x0000556f573d48b5 mlir::xegpu::resolveLayoutConflicts(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x71358b5)
#19 0x0000556f573dd6d1 (anonymous namespace)::XeGPUPropagateLayoutPass::runOnOperation() XeGPUPropagateLayout.cpp:0:0
#20 0x0000556f5b8ca581 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb62b581)
#21 0x0000556f5b8ca910 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+0xb62b910)
#22 0x0000556f5b8cc9c4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb62d9c4)
#23 0x0000556f5b8cda41 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb62ea41)
#24 0x0000556f5242517b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#25 0x0000556f52425cbf processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#26 0x0000556f52425eeb 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
#27 0x0000556f5bcaf2b5 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+0xba102b5)
#28 0x0000556f5241bf34 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#29 0x0000556f52426407 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2187407)
#30 0x0000556f52426643 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2187643)
#31 0x0000556f522c5a97 main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2026a97)
#32 0x00007f1906147083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#33 0x0000556f5233b77e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x209c77e)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the assertion with the supplied MLIR program and `mlir-opt -xegpu-propagate-layout -allow-unregistered-dialect a.mlir`. Start in `XeGPUPropagateLayout.cpp`, especially `ResolveLayoutConflicts::assignResultLayout`, and follow the `xegpu::ConvertLayoutOp::create` call into `OperationSupport.h`. Done means the reproducer no longer aborts and the regression remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.