[mlir](convert-xegpu-to-xevm) mlir-opt crashes at DialectConversion.cpp:3380 with assertion `TypeRange(newMaterializationRange) == op.getResultTypes() && "materialization callback produced value of incorrect type"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: 2e87cf8c2b8ec6453ccfa7e448d5b33f1d71a2ca
MLIR Program:
```mlir
module {
func.func @non_overlapping_branches(%arg0: i1) {
%0 = scf.if %arg0 -> (vector<[4]x[4]xf32>) {
%1 = arm_sme.zero : vector<[4]x[4]xf32>
scf.yield %1 : vector<[4]x[4]xf32>
} else {
%1 = arm_sme.get_tile : vector<[4]x[4]xf32>
scf.yield %1 : vector<[4]x[4]xf32>
}
"test.some_use"(%0) : (vector<[4]x[4]xf32>) -> ()
return
}
}
```
Reproduce Command: `mlir-opt -convert-xegpu-to-xevm a.mlir`
StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/Transforms/Utils/DialectConversion.cpp:3380: llvm::LogicalResult legalizeUnresolvedMaterialization(mlir::RewriterBase&, mlir::UnrealizedConversionCastOp, const {anonymous}::UnresolvedMaterializationInfo&): Assertion `TypeRange(newMaterializationRange) == op.getResultTypes() && "materialization callback produced value of incorrect 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: /data2/dependency/dev/llvm-project/build/bin/mlir-opt -convert-xegpu-to-xevm a.mlir
#0 0x000055e2ecc341cf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c71cf)
#1 0x000055e2ecc3099c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c399c)
#2 0x000055e2ecc30b37 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fcdf5374420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fcdf4e5f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fcdf4e3e859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007fcdf4e3e729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007fcdf4e4ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x000055e2f598a19c legalizeUnresolvedMaterialization(mlir::RewriterBase&, mlir::UnrealizedConversionCastOp, (anonymous namespace)::UnresolvedMaterializationInfo const&) (.constprop.0) DialectConversion.cpp:0:0
#9 0x000055e2f59a5d26 mlir::OperationConverter::applyConversion(llvm::ArrayRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb338d26)
#10 0x000055e2f59a61e8 applyConversion(llvm::ArrayRef, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#11 0x000055e2f59a63c6 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3393c6)
#12 0x000055e2f174a389 (anonymous namespace)::ConvertXeGPUToXeVMPass::runOnOperation() XeGPUToXeVM.cpp:0:0
#13 0x000055e2f5a515e1 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e45e1)
#14 0x000055e2f5a51970 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+0xb3e4970)
#15 0x000055e2f5a53a24 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e6a24)
#16 0x000055e2f5a54ab1 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e7ab1)
#17 0x000055e2eccfa22b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x000055e2eccfacd3 processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#19 0x000055e2eccfaf5b 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
#20 0x000055e2f5e2c535 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+0xb7bf535)
#21 0x000055e2eccf1064 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#22 0x000055e2eccfb477 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x268e477)
#23 0x000055e2eccfb6b3 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x268e6b3)
#24 0x000055e2ecb60b8c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24f3b8c)
#25 0x00007fcdf4e40083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#26 0x000055e2ecc108de _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25a38de)
Aborted (core dumped)
```
Contributor guide
Research direction
Run the supplied mlir-opt -convert-xegpu-to-xevm command with the MLIR reproducer, then inspect XeGPUToXeVM.cpp and the materialization path in mlir/lib/Transforms/Utils/DialectConversion.cpp. Trace why the conversion callback produces a type different from the scf.if result and add regression coverage showing that the reproducer no longer triggers the assertion.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100