llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

mlir-opt crash: Assertion failure in LinalgInterface when linalg.generic uses !amx.tile operand

Open xvv4402 opened this issue 10 months ago • 1 comments

mlir-opt version: 22.1.0 A crash occurs in mlir-opt when processing a linalg.generic operation that takes an !amx.tile type as an input. The internal LinalgInterface fails an assertion because it expects operands to be ranked tensors or memrefs to calculate shapes, but it receives a dialect-specific tile type instead.

module {
  func.func @main() {
    %0 = amx.tile_zero : !amx.tile<16x16xf32>
    %1 = shape.const_size 16
    %2 = mpi.comm_world : !mpi.comm
    %3 = tensor.empty() : tensor<16x16xf32>
    %4 = linalg.generic {indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = ["parallel", "parallel"]} ins(%0 : !amx.tile<16x16xf32>) outs(%3 : tensor<16x16xf32>) {
    ^bb0(%arg0: f32, %arg1: f32):
      linalg.yield %arg0 : f32
    } -> tensor<16x16xf32>
    return
  }
}
mlir-opt test.mlir
mlir-opt: llvm-project-llvmorg-22.1.0-rc1/build/tools/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc:1212: llvm::ArrayRef<long int> mlir::linalg::detail::LinalgOpTrait<ConcreteOp>::getShape(mlir::OpOperand*) [with ConcreteOp = mlir::linalg::GenericOp]: Assertion `(isa<MemRefType>(t) || isa<RankedTensorType>(t)) && "expected a ranked tensor or memref in LinalgInterface::getRank"' 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: llvmorg-22.1.0-install/bin/mlir-opt test.mlir
 #0 0x00005b16a2657e32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32)
 #1 0x00005b16a26545af llvm::sys::RunSignalHandlers() (llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af)
 #2 0x00005b16a26546fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000706e14445330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x0000706e1449eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x0000706e1449eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x0000706e1449eb2c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x0000706e1444527e raise ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x0000706e144288ff abort ./stdlib/abort.c:81:7
 #9 0x0000706e1442881b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x0000706e1443b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)

xvv4402 avatar Jan 31 '26 14:01 xvv4402

@llvm/issue-subscribers-mlir

Author: None (xvv4402)

mlir-opt version: 22.1.0 A crash occurs in **mlir-opt** when processing a **linalg.generic** operation that takes an !amx.tile type as an input. The internal LinalgInterface fails an assertion because it expects operands to be ranked tensors or memrefs to calculate shapes, but it receives a dialect-specific tile type instead. ``` module { func.func @main() { %0 = amx.tile_zero : !amx.tile<16x16xf32> %1 = shape.const_size 16 %2 = mpi.comm_world : !mpi.comm %3 = tensor.empty() : tensor<16x16xf32> %4 = linalg.generic {indexing_maps = [affine_map<(i, j) -> (i, j)>, affine_map<(i, j) -> (i, j)>], iterator_types = ["parallel", "parallel"]} ins(%0 : !amx.tile<16x16xf32>) outs(%3 : tensor<16x16xf32>) { ^bb0(%arg0: f32, %arg1: f32): linalg.yield %arg0 : f32 } -> tensor<16x16xf32> return } } ``` ``` mlir-opt test.mlir ``` ``` mlir-opt: llvm-project-llvmorg-22.1.0-rc1/build/tools/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h.inc:1212: llvm::ArrayRef<long int> mlir::linalg::detail::LinalgOpTrait<ConcreteOp>::getShape(mlir::OpOperand*) [with ConcreteOp = mlir::linalg::GenericOp]: Assertion `(isa<MemRefType>(t) || isa<RankedTensorType>(t)) && "expected a ranked tensor or memref in LinalgInterface::getRank"' 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: llvmorg-22.1.0-install/bin/mlir-opt test.mlir #0 0x00005b16a2657e32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (llvmorg-22.1.0-install/bin/mlir-opt+0x252fe32) #1 0x00005b16a26545af llvm::sys::RunSignalHandlers() (llvmorg-22.1.0-install/bin/mlir-opt+0x252c5af) #2 0x00005b16a26546fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0 #3 0x0000706e14445330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330) #4 0x0000706e1449eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76 #5 0x0000706e1449eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10 #6 0x0000706e1449eb2c pthread_kill ./nptl/pthread_kill.c:89:10 #7 0x0000706e1444527e raise ./signal/../sysdeps/posix/raise.c:27:6 #8 0x0000706e144288ff abort ./stdlib/abort.c:81:7 #9 0x0000706e1442881b _nl_load_domain ./intl/loadmsgcat.c:1177:9 #10 0x0000706e1443b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517) ```

llvmbot avatar Jan 31 '26 14:01 llvmbot