llvm / llvm/llvm-project

[mlir][xegpu](xegpu-propagate-layout) mlir-opt crashes at FunctionInterfaces.h.inc:1251 with `index < (*static_cast<ConcreteOp *>(this)).getNumArguments() && "invalid argument number"' failed.

Open
#204,906 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: 092858485f00e6786da8a88c0c4d462247e64571

MLIR Program:
```mlir
module {
module attributes {transform.with_named_sequence} {
transform.named_sequence @_match_matmul_like(!transform.any_op {transform.readonly}, !transform.param {transform.readonly}) -> (!transform.any_op, !transform.any_op, !transform.param, !transform.type, !transform.type, !transform.type, !transform.param, !transform.param, !transform.param, !transform.param)
transform.named_sequence @match_matmul(%arg0: !transform.any_op {transform.readonly}) -> (!transform.any_op, !transform.any_op, !transform.param, !transform.type, !transform.type, !transform.type) {
transform.match.operation_name %arg0 ["linalg.matmul", "linalg.generic"] : !transform.any_op
%0 = transform.param.constant 3 : i64 -> !transform.param
%1:10 = transform.include @_match_matmul_like failures(propagate) (%arg0, %0) : (!transform.any_op, !transform.param) -> (!transform.any_op, !transform.any_op, !transform.param, !transform.type, !transform.type, !transform.type, !transform.param, !transform.param, !transform.param, !transform.param)
transform.yield %1#0, %1#1, %1#2, %1#3, %1#4, %1#5 : !transform.any_op, !transform.any_op, !transform.param, !transform.type, !transform.type, !transform.type
}
}
}
```

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

StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/build/tools/mlir/include/mlir/Interfaces/FunctionInterfaces.h.inc:1251: mlir::DictionaryAttr mlir::detail::FunctionOpInterfaceTrait::getArgAttrDict(unsigned int) [with ConcreteOp = mlir::transform::NamedSequenceOp]: Assertion `index < (*static_cast(this)).getNumArguments() && "invalid argument number"' 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-propagate-layout a.mlir
#0 0x00005641ba4b415f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c715f)
#1 0x00005641ba4b092c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c392c)
#2 0x00005641ba4b0ac7 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f88a79c2420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f88a74ad00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f88a748c859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f88a748c729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f88a749dfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x00005641c0b65fe8 mlir::transform::IncludeOp::getEffects(llvm::SmallVectorImpl>&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8c78fe8)
#9 0x00005641c0acf4f3 mlir::detail::MemoryEffectOpInterfaceInterfaceTraits::Model::getEffects(mlir::detail::MemoryEffectOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, llvm::SmallVectorImpl>&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8be24f3)
#10 0x00005641c0bbe468 mlir::transform::detail::verifyTransformOpInterface(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8cd1468)
#11 0x00005641c0acf72c mlir::Op::verifyInvariants(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8be272c)
#12 0x00005641c0aec088 mlir::RegisteredOperationName::Model::verifyInvariants(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8bff088)
#13 0x00005641c368c394 (anonymous namespace)::OperationVerifier::verifyOnEntrance(mlir::Operation&) Verifier.cpp:0:0
#14 0x00005641c368e690 (anonymous namespace)::OperationVerifier::verifyOperation(mlir::Operation&) Verifier.cpp:0:0
#15 0x00005641c368ffef mlir::verify(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7a2fef)
#16 0x00005641c0acc3fe mlir::WalkResult llvm::function_ref::callback_fn(long, mlir::Operation*) TransformDialect.cpp:0:0
#17 0x00005641ba599292 mlir::WalkResult mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26ac292)
#18 0x00005641ba599292 mlir::WalkResult mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x26ac292)
#19 0x00005641c0acaa0a mlir::transform::TransformDialect::verifyOperationAttribute(mlir::Operation*, mlir::NamedAttribute) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8bdda0a)
#20 0x00005641c368bff2 (anonymous namespace)::OperationVerifier::verifyOnEntrance(mlir::Operation&) Verifier.cpp:0:0
#21 0x00005641c368e690 (anonymous namespace)::OperationVerifier::verifyOperation(mlir::Operation&) Verifier.cpp:0:0
#22 0x00005641c368f02f (anonymous namespace)::OperationVerifier::verifyOperation(mlir::Operation&) Verifier.cpp:0:0
#23 0x00005641c368ffef mlir::verify(mlir::Operation*, bool) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7a2fef)
#24 0x00005641c32cbe38 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3dee38)
#25 0x00005641c32cc1a0 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+0xb3df1a0)
#26 0x00005641c32ce254 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e1254)
#27 0x00005641c32cf2e1 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e22e1)
#28 0x00005641ba57a1bb performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#29 0x00005641ba57ac63 processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#30 0x00005641ba57aeeb 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
#31 0x00005641c36a6d65 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+0xb7b9d65)
#32 0x00005641ba570ff4 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#33 0x00005641ba57b407 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x268e407)
#34 0x00005641ba57b643 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x268e643)
#35 0x00005641ba3e0b1c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24f3b1c)
#36 0x00007f88a748e083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#37 0x00005641ba49086e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25a386e)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with mlir-opt -xegpu-propagate-layout a.mlir using the supplied MLIR program. Start at transform::IncludeOp::getEffects and verifyTransformOpInterface, then inspect FunctionInterfaces.h.inc at getArgAttrDict; done means the reproducer no longer aborts at the invalid argument 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
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.