Skip to content

mlir-opt crashes with UNREACHABLE in linalg.elementwise when operands have vector types #178363

@compilerStudyer

Description

@compilerStudyer

mlir-opt crashes with an UNREACHABLE when parsing a linalg.elementwise operation whose operands are vector types instead of tensors or memrefs.

The crash happens during parsing / region construction, before any pass pipeline is executed.

module {
  func.func @main() {
    %0 = spirv.Constant dense<0> : vector<4xi32>
    %1 = gpu.grid_dim  x
    %2:4 = vector.to_elements %0 : vector<4xi32>
    %3 = vector.multi_reduction <add>, %0, %2#0 [0] : vector<4xi32> to i32
    %4 = vector.reduction <add>, %0, %3 : vector<4xi32> into i32
    %5 = linalg.elementwise kind=#linalg.elementwise_kind<add> ins(%0, %0 : vector<4xi32>, vector<4xi32>) outs(%0 : vector<4xi32>) -> tensor<4xi32>
    return
  }
}
mlir-opt test.mlir
unsupported non numeric type
UNREACHABLE executed at mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:514!
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: mlir-opt test.mlir
1.      MLIR Parser: custom op parser 'builtin.module'
2.      MLIR Parser: custom op parser 'func.func'
3.      MLIR Parser: custom op parser 'linalg.elementwise'
 #0 0x0000565bb1f40e32 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (mlir-opt+0x252fe32)
 #1 0x0000565bb1f3d5af llvm::sys::RunSignalHandlers() (mlir-opt+0x252c5af)
 #2 0x0000565bb1f3d6fc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000796393245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x000079639329eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x000079639329eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x000079639329eb2c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x000079639324527e raise ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007963932288ff abort ./stdlib/abort.c:81:7
 #9 0x0000565bb1f2012e (mlir-opt+0x250f12e)
#10 0x0000565bb7ee3e74 (anonymous namespace)::RegionBuilderHelper::buildBinaryFn(mlir::linalg::BinaryFn, mlir::Value, mlir::Value, llvm::function_ref<mlir::InFlightDiagnostic ()>) LinalgOps.cpp:0:0
#11 0x0000565bb7ef6280 mlir::linalg::ElementwiseOp::regionBuilder(mlir::ImplicitLocOpBuilder&, mlir::Block&, llvm::ArrayRef<mlir::NamedAttribute>, llvm::function_ref<mlir::InFlightDiagnostic ()>) (mlir-opt+0x84e5280)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions