llvm / llvm/llvm-project

[mlir](convert-vector-to-xegpu) mlir-opt crashes at Operation.cpp:617 with assertion `false && "incorrect fold result type"' failed.

Open
#205,977 1 comment 0 reactions 0 assignees View on GitHub
crash mlir
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

git version: b7c56b5b0a54a6c966a74dfe311fcddcffade521

MLIR Program:
```mlir
module {
func.func @m(%arg0: memref<4x2xf32>, %arg1: vector<4xi32>, %arg2: vector<4xi1>, %arg3: vector<4xf32>) -> vector<4xf32> {
%c0 = arith.constant 0 : index
%0 = vector.gather %arg0[%c0, %c0] [%arg1], %arg2, %arg3 : memref<4x2xf32>, vector<4xi32>, vector<4xi1>, vector<4xf32> into vector<4xf32>
return %0 : vector<4xf32>
}
}
```

Reproduce Command: `mlir-opt -convert-vector-to-xegpu a.mlir`

StackTrace:
```
a.mlir:4:10: error: 'arith.addi' op folder produced a value of incorrect type: 'vector<4xi32>', expected: 'vector<4xindex>'
%0 = vector.gather %arg0[%c0, %c0] [%arg1], %arg2, %arg3 : memref<4x2xf32>, vector<4xi32>, vector<4xi1>, vector<4xf32> into vector<4xf32>
^
a.mlir:4:10: note: see current operation: %8 = "arith.addi"(%6, %7) <{overflowFlags = #arith.overflow}> : (vector<4xi32>, vector<4xindex>) -> vector<4xindex>
mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/IR/Operation.cpp:617: void checkFoldResultTypes(mlir::Operation*, llvm::SmallVectorImpl&): Assertion `false && "incorrect fold result 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-vector-to-xegpu a.mlir
#0 0x000055dda730c1df llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25e71df)
#1 0x000055dda730899c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25e399c)
#2 0x000055dda7308b37 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fc2eda43420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fc2ed52e00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fc2ed50d859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007fc2ed50d729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007fc2ed51efd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x000055ddb0514d92 checkFoldResultTypes(mlir::Operation*, llvm::SmallVectorImpl&) (.part.0) Operation.cpp:0:0
#9 0x000055ddb051653c mlir::Operation::fold(llvm::ArrayRef, llvm::SmallVectorImpl&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7f153c)
#10 0x000055ddb0516850 mlir::Operation::fold(llvm::SmallVectorImpl&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7f1850)
#11 0x000055ddb00f41f6 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#12 0x000055ddb00f82d6 mlir::applyPatternsGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3d32d6)
#13 0x000055ddabe375f7 (anonymous namespace)::ConvertVectorToXeGPUPass::runOnOperation() VectorToXeGPU.cpp:0:0
#14 0x000055ddb01945b1 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb46f5b1)
#15 0x000055ddb0194940 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+0xb46f940)
#16 0x000055ddb01969f4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb4719f4)
#17 0x000055ddb0197a81 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb472a81)
#18 0x000055dda73d227b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x000055dda73d2d23 processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#20 0x000055dda73d2fab 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
#21 0x000055ddb056da75 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+0xb848a75)
#22 0x000055dda73c90b4 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#23 0x000055dda73d34c7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26ae4c7)
#24 0x000055dda73d3703 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26ae703)
#25 0x000055dda7238b2c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2513b2c)
#26 0x00007fc2ed50f083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#27 0x000055dda72e88ce _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c38ce)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the supplied MLIR input and `mlir-opt -convert-vector-to-xegpu a.mlir`. Read the folding assertion at `Operation.cpp:617` and the conversion pass entry in `VectorToXeGPU.cpp` to trace the incorrect result type. Done means the reproducer no longer aborts and coverage preserves the reported case.

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
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.