llvm / llvm/llvm-project

[mlir][xegpu](xegpu-blocking) mlir-opt crashes at VectorOps.cpp:1206 with assertion `lhsDimIndex >= 0' failed.

Open
#204,582 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: 08b557bf5139394194be22359268b7b88f81faae

MLIR Program:
```mlir
#map = affine_map<(d0, d1, d2) -> (d0, d2)>
#map1 = affine_map<(d0, d1, d2) -> (d2, d1)>
#map2 = affine_map<(d0, d1, d2) -> ()>
module {
func.func @negative_accumulator_shape(%arg0: vector<8x16xf16>, %arg1: vector<16x16xf16>, %arg2: vector) -> vector {
%0 = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["reduction", "reduction", "reduction"], kind = #vector.kind} %arg0, %arg1, %arg2 : vector<8x16xf16>, vector<16x16xf16> into vector
return %0 : vector
}
}
```

Reproduce Command: `mlir-opt -xegpu-blocking a.mlir`

StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/Dialect/Vector/IR/VectorOps.cpp:1206: void mlir::vector::ContractionOp::getIterationBounds(llvm::SmallVectorImpl&): Assertion `lhsDimIndex >= 0' 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 -xegpu-blocking a.mlir
#0 0x000055668ccb5f6f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25bbf6f)
#1 0x000055668ccb273c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25b873c)
#2 0x000055668ccb28d7 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fbaa70e5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fbaa6bd000b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fbaa6baf859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007fbaa6baf729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007fbaa6bc0fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000556694391dff mlir::vector::ContractionOp::getIterationBounds(llvm::SmallVectorImpl&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x9c97dff)
#9 0x00005566943da3e4 mlir::detail::VectorUnrollOpInterfaceInterfaceTraits::Model::getShapeForUnroll(mlir::detail::VectorUnrollOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x9ce03e4)
#10 0x0000556694447fb9 mlir::VectorUnrollOpInterface::getShapeForUnroll() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x9d4dfb9)
#11 0x0000556693c6952b getTargetShape(mlir::vector::UnrollVectorOptions const&, mlir::Operation*) VectorUnroll.cpp:0:0
#12 0x0000556693c7837f (anonymous namespace)::UnrollContractionPattern::matchAndRewrite(mlir::vector::ContractionOp, mlir::PatternRewriter&) const VectorUnroll.cpp:0:0
#13 0x00005566916ea430 mlir::detail::OpOrInterfaceRewritePatternBase::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x6ff0430)
#14 0x0000556695a50aa2 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref, llvm::function_ref, llvm::function_ref)::'lambda'()::operator()() const PatternApplicator.cpp:0:0
#15 0x0000556695a51f98 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref, llvm::function_ref, llvm::function_ref) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb357f98)
#16 0x0000556695a1c167 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#17 0x0000556695a20476 mlir::applyPatternsGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb326476)
#18 0x00005566918f4aff (anonymous namespace)::XeGPUBlockingPass::runOnOperation() XeGPUBlocking.cpp:0:0
#19 0x0000556695abcbf1 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3c2bf1)
#20 0x0000556695abcf80 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+0xb3c2f80)
#21 0x0000556695abf034 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3c5034)
#22 0x0000556695ac00c1 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3c60c1)
#23 0x000055668cd7b86b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#24 0x000055668cd7c313 processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#25 0x000055668cd7c59b 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
#26 0x0000556695e97b45 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+0xb79db45)
#27 0x000055668cd726a4 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#28 0x000055668cd7cab7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2682ab7)
#29 0x000055668cd7ccf3 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2682cf3)
#30 0x000055668cbe2aec main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24e8aec)
#31 0x00007fbaa6bb1083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#32 0x000055668cc9267e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x259867e)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied MLIR program with `mlir-opt -xegpu-blocking a.mlir` to reproduce the assertion. Read `mlir/lib/Dialect/Vector/IR/VectorOps.cpp` around line 1206, then follow the `VectorUnroll.cpp` and `XeGPUBlocking.cpp` stack frames. Done means the reproducer no longer aborts and regression coverage preserves that behavior.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.