llvm / llvm/llvm-project

[mlir][transform](transform-interpreter) mlir-opt crashes at TestTilingInterfaceTransformOps.cpp:415.

Open
#206,619 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: e192ec42b426f6ffbc25419238a90f3c59088587

MLIR Program:
```mlir
#map2 = affine_map<(d0) -> (d0)>
#map3 = affine_map<()[s0, s1] -> (s0 ceildiv s1)>
#map4 = affine_map<(d0)[s0] -> (d0 * s0)>
#map5 = affine_map<(d0)[s0, s1] -> (-(d0 * s1) + s0, s1)>
module {
module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) {
%0 = transform.structured.match ops{["linalg.generic"]} in %arg0 : (!transform.any_op) -> !transform.any_op
%tiled_ops, %loops = transform.test.fuse_using_forall %0 [10, 20] : (!transform.any_op) -> (!transform.any_op, !transform.any_op)
transform.yield
}
}
func.func @m0(%arg0: index, %arg1: tensor, %arg2: tensor, %arg3: tensor) -> (tensor, tensor) {
%c0 = arith.constant 0 : index
%0 = linalg.generic {indexing_maps = [#map2, #map2], iterator_types = ["parallel"]} ins(%arg1 : tensor) outs(%arg2 : tensor) {
^bb0(%in: f32, %out: f32):
%3 = arith.addf %in, %out : f32
linalg.yield %3 : f32
} -> tensor
%dim = tensor.dim %0, %c0 : tensor
%1 = affine.apply #map3()[%dim, %arg0]
%2 = scf.forall (%arg5) in (%1) shared_outs(%arg6 = %arg3) -> (tensor) {
%3 = affine.apply #map4(%arg5)[%arg0]
%4 = affine.min #map5(%arg5)[%dim, %arg0]
%extracted_slice = tensor.extract_slice %arg6[%3] [%4] [1] : tensor to tensor
%extracted_slice_0 = tensor.extract_slice %0[%3] [%4] [1] : tensor to tensor
%5 = linalg.exp ins(%extracted_slice_0 : tensor) outs(%extracted_slice : tensor) -> tensor
scf.forall.in_parallel {
tensor.parallel_insert_slice %5 into %arg6[%3] [%4] [1] : tensor into tensor
}
}
return %2, %0 : tensor, tensor
}
}
```

Reproduce Command: `mlir-opt -transform-interpreter a.mlir`

StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp:415: llvm::LogicalResult applyTilingToAll(mlir::RewriterBase&, mlir::Operation*, Range&&, unsigned int, mlir::transform::TransformResults&, mlir::function_ref(mlir::TilingInterface)>) [with Range = llvm::iterator_range, std::bidirectional_iterator_tag> >; mlir::function_ref(mlir::TilingInterface)> = llvm::function_ref(mlir::TilingInterface)>]: Assertion `tiledResults->loops.size() == 1 && cast(tiledResults->loops[0]).getRank() == numLoops && "Mismatched number of loops, tile and fuse transform should have " "failed"' 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 -transform-interpreter a.mlir
#0 0x000055a93cfbbdaf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x259adaf)
#1 0x000055a93cfb855c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x259755c)
#2 0x000055a93cfb86f7 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f9c5dba3420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f9c5d68e00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f9c5d66d859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f9c5d66d729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f9c5d67efd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x000055a93d8f31b2 mlir::transform::TestFuseUsingForallOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2ed21b2)
#9 0x000055a93d8f324a mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2ed224a)
#10 0x000055a94373a69d mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8d1969d)
#11 0x000055a9436b5da9 applySequenceBlock(mlir::Block&, mlir::transform::FailurePropagationMode, mlir::transform::TransformState&, mlir::transform::TransformResults&) TransformOps.cpp:0:0
#12 0x000055a9436eac24 mlir::transform::NamedSequenceOp::apply(mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8cc9c24)
#13 0x000055a9436418f3 mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Model::apply(mlir::transform::detail::TransformOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::transform::TransformRewriter&, mlir::transform::TransformResults&, mlir::transform::TransformState&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8c208f3)
#14 0x000055a94373a69d mlir::transform::TransformState::applyTransform(mlir::transform::TransformOpInterface) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8d1969d)
#15 0x000055a94373bfe1 mlir::transform::applyTransforms(mlir::Operation*, mlir::transform::TransformOpInterface, mlir::RaggedArray> const&, mlir::transform::TransformOptions const&, bool, llvm::function_ref, llvm::function_ref) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8d1afe1)
#16 0x000055a943629e30 mlir::transform::applyTransformNamedSequence(mlir::RaggedArray>, mlir::transform::TransformOpInterface, mlir::ModuleOp, mlir::transform::TransformOptions const&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x8c08e30)
#17 0x000055a94362597f (anonymous namespace)::InterpreterPass::runOnOperation() InterpreterPass.cpp:0:0
#18 0x000055a945e41041 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb420041)
#19 0x000055a945e413d0 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+0xb4203d0)
#20 0x000055a945e43484 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb422484)
#21 0x000055a945e44501 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb423501)
#22 0x000055a93d081dab performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x000055a93d082833 processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#24 0x000055a93d082abb 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
#25 0x000055a946214e25 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+0xb7f3e25)
#26 0x000055a93d078b04 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#27 0x000055a93d082fd7 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2661fd7)
#28 0x000055a93d083213 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2662213)
#29 0x000055a93cefea9c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24dda9c)
#30 0x00007f9c5d66f083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#31 0x000055a93cf9835e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x257735e)
Aborted (core dumped)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the supplied MLIR program using `mlir-opt -transform-interpreter a.mlir`. Start at `mlir/test/lib/Interfaces/TilingInterface/TestTilingInterfaceTransformOps.cpp:415` and inspect the `TestFuseUsingForallOp` assertion and its tiling results. Done means the reproducer no longer aborts and has regression coverage for the mismatched-loop case.

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
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.