Skip to content

Instantly share code, notes, and snippets.

@cathyzhyi
Created April 23, 2022 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cathyzhyi/949dafb96801866cf067b5baba4ac614 to your computer and use it in GitHub Desktop.
Save cathyzhyi/949dafb96801866cf067b5baba4ac614 to your computer and use it in GitHub Desktop.
// -----// IR Dump After ConvertLinalgToLLVM //----- //
module {
func @collapse_dynamic_shape(%arg0: memref<2x?x?x?xf32>) -> memref<2x?x?xf32> {
%0 = memref.collapse_shape %arg0 [[0], [1, 2], [3]] : memref<2x?x?x?xf32> into memref<2x?x?xf32>
return %0 : memref<2x?x?xf32>
}
}
ImplicitTypeIDRegistry::lookupOrInsert(mlir::DataLayoutAnalysis)
ImplicitTypeIDRegistry::lookupOrInsert(mlir::DataLayoutOpInterface)
//===-------------------------------------------===//
Legalizing operation : 'builtin.module'(0x5eb49d0) {
* Fold {
} -> FAILURE : unable to fold
} -> FAILURE : no matched legalization pattern
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'func.func'(0x5ee63f0) {
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'memref.collapse_shape'(0x5f60dd0) {
%0 = "memref.collapse_shape"(%arg0) {reassociation = [[0], [1, 2], [3]]} : (memref<2x?x?x?xf32>) -> memref<2x?x?xf32>
* Fold {
} -> FAILURE : unable to fold
* Pattern : 'memref.collapse_shape -> ()' {
Trying to match "(anonymous namespace)::ReassociatingReshapeOpConversion<mlir::memref::CollapseShapeOp>"
** Insert : 'llvm.mlir.undef'(0x5f2d2d0)
** Insert : 'llvm.extractvalue'(0x5f9b980)
** Insert : 'llvm.insertvalue'(0x5f9a280)
** Insert : 'llvm.extractvalue'(0x5f9bb70)
** Insert : 'llvm.insertvalue'(0x5f9a330)
** Insert : 'llvm.extractvalue'(0x5f9bc60)
** Insert : 'llvm.insertvalue'(0x5f9a3e0)
** Insert : 'llvm.mlir.constant'(0x5f00680)
** Insert : 'llvm.extractvalue'(0x5eeabd0)
** Insert : 'llvm.mul'(0x5f9ba10)
** Insert : 'llvm.extractvalue'(0x5eeb300)
** Insert : 'llvm.mul'(0x5f9bac0)
** Insert : 'llvm.mlir.constant'(0x5f8c4a0)
** Insert : 'llvm.extractvalue'(0x5f4cea0)
** Insert : 'llvm.mul'(0x5f9bcf0)
** Insert : 'llvm.mlir.constant'(0x5f89b60)
** Insert : 'llvm.insertvalue'(0x5eeb390)
** Insert : 'llvm.insertvalue'(0x5f8bb80)
** Insert : 'llvm.insertvalue'(0x5fa2060)
** Insert : 'llvm.extractvalue'(0x5fa2110)
** Insert : 'llvm.insertvalue'(0x5fa21a0)
** Insert : 'llvm.insertvalue'(0x5fa2250)
** Insert : 'llvm.extractvalue'(0x5fa2300)
** Insert : 'llvm.mlir.constant'(0x5f9bc00)
** Insert : 'llvm.extractvalue'(0x5fa2390)
** Insert : 'llvm.icmp'(0x5fa2420)
** Insert : 'llvm.cond_br'(0x5f97700)
** Insert : 'llvm.extractvalue'(0x5fa24d0)
** Insert : 'llvm.br'(0x5f70740)
** Insert : 'llvm.extractvalue'(0x5fa2720)
** Insert : 'llvm.insertvalue'(0x5fa27b0)
** Replace : 'memref.collapse_shape'(0x5f60dd0)
"(anonymous namespace)::ReassociatingReshapeOpConversion<mlir::memref::CollapseShapeOp>" result 1
//===-------------------------------------------===//
Legalizing operation : 'func.func'(0x5ee63f0) {
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mlir.undef'(0x5f2d2d0) {
%1 = "llvm.mlir.undef"() : () -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5f9b980) {
%2 = "llvm.extractvalue"(%0) {position = [0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> !llvm.ptr<f32>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5f9a280) {
%3 = "llvm.insertvalue"(%1, %2) {position = [0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr<f32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5f9bb70) {
%4 = "llvm.extractvalue"(%0) {position = [1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> !llvm.ptr<f32>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5f9a330) {
%5 = "llvm.insertvalue"(%3, %4) {position = [1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr<f32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5f9bc60) {
%6 = "llvm.extractvalue"(%0) {position = [2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5f9a3e0) {
%7 = "llvm.insertvalue"(%5, %6) {position = [2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mlir.constant'(0x5f00680) {
%8 = "llvm.mlir.constant"() {value = 1 : index} : () -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5eeabd0) {
%9 = "llvm.extractvalue"(%0) {position = [3, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mul'(0x5f9ba10) {
%10 = "llvm.mul"(%8, %9) : (i64, i64) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5eeb300) {
%11 = "llvm.extractvalue"(%0) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mul'(0x5f9bac0) {
%12 = "llvm.mul"(%10, %11) : (i64, i64) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mlir.constant'(0x5f8c4a0) {
%13 = "llvm.mlir.constant"() {value = 1 : index} : () -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5f4cea0) {
%14 = "llvm.extractvalue"(%0) {position = [3, 3]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mul'(0x5f9bcf0) {
%15 = "llvm.mul"(%13, %14) : (i64, i64) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mlir.constant'(0x5f89b60) {
%16 = "llvm.mlir.constant"() {value = 2 : index} : () -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5eeb390) {
%17 = "llvm.insertvalue"(%7, %16) {position = [3, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5f8bb80) {
%18 = "llvm.insertvalue"(%17, %12) {position = [3, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5fa2060) {
%19 = "llvm.insertvalue"(%18, %15) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5fa2110) {
%20 = "llvm.extractvalue"(%0) {position = [4, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5fa21a0) {
%21 = "llvm.insertvalue"(%19, %20) {position = [4, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5fa2250) {
%28 = "llvm.insertvalue"(%21, %27) {position = [4, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5fa2300) {
%22 = "llvm.extractvalue"(%0) {position = [4, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.mlir.constant'(0x5f9bc00) {
%23 = "llvm.mlir.constant"() {value = 1 : i32} : () -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5fa2390) {
%24 = "llvm.extractvalue"(%0) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.icmp'(0x5fa2420) {
%25 = "llvm.icmp"(%24, %23) {predicate = 1 : i64} : (i64, i64) -> i1
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.cond_br'(0x5f97700) {
"llvm.cond_br"(%25, %22)[^bb2, ^bb1] {operand_segment_sizes = dense<[1, 1, 0]> : vector<3xi32>} : (i1, i64) -> ()
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5fa24d0) {
%26 = "llvm.extractvalue"(%0) {position = [4, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.br'(0x5f70740) {
"llvm.br"(%26)[^bb2] : (i64) -> ()
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.extractvalue'(0x5fa2720) {
%29 = "llvm.extractvalue"(%0) {position = [4, 3]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'llvm.insertvalue'(0x5fa27b0) {
%30 = "llvm.insertvalue"(%28, %29) {position = [4, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
} -> SUCCESS : operation marked legal by the target
//===-------------------------------------------===//
} -> SUCCESS : pattern applied successfully
// *** IR Dump After Pattern Application ***
ImplicitTypeIDRegistry::lookupOrInsert(mlir::OpTrait::NOperands<2>::Impl<Empty>)
"func.func"() ({
^bb0(%arg0: memref<2x?x?x?xf32>):
%0 = "builtin.unrealized_conversion_cast"(%arg0) : (memref<2x?x?x?xf32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>
%1 = "llvm.mlir.undef"() : () -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%2 = "llvm.extractvalue"(%0) {position = [0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> !llvm.ptr<f32>
%3 = "llvm.insertvalue"(%1, %2) {position = [0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr<f32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%4 = "llvm.extractvalue"(%0) {position = [1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> !llvm.ptr<f32>
%5 = "llvm.insertvalue"(%3, %4) {position = [1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr<f32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%6 = "llvm.extractvalue"(%0) {position = [2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%7 = "llvm.insertvalue"(%5, %6) {position = [2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%8 = "llvm.mlir.constant"() {value = 1 : index} : () -> i64
%9 = "llvm.extractvalue"(%0) {position = [3, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%10 = "llvm.mul"(%8, %9) : (i64, i64) -> i64
%11 = "llvm.extractvalue"(%0) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%12 = "llvm.mul"(%10, %11) : (i64, i64) -> i64
%13 = "llvm.mlir.constant"() {value = 1 : index} : () -> i64
%14 = "llvm.extractvalue"(%0) {position = [3, 3]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%15 = "llvm.mul"(%13, %14) : (i64, i64) -> i64
%16 = "llvm.mlir.constant"() {value = 2 : index} : () -> i64
%17 = "llvm.insertvalue"(%7, %16) {position = [3, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%18 = "llvm.insertvalue"(%17, %12) {position = [3, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%19 = "llvm.insertvalue"(%18, %15) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%20 = "llvm.extractvalue"(%0) {position = [4, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%21 = "llvm.insertvalue"(%19, %20) {position = [4, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%22 = "llvm.extractvalue"(%0) {position = [4, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%23 = "llvm.mlir.constant"() {value = 1 : i32} : () -> i64
%24 = "llvm.extractvalue"(%0) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%25 = "llvm.icmp"(%24, %23) {predicate = 1 : i64} : (i64, i64) -> i1
"llvm.cond_br"(%25, %22)[^bb2, ^bb1] {operand_segment_sizes = dense<[1, 1, 0]> : vector<3xi32>} : (i1, i64) -> ()
^bb1: // pred: ^bb0
%26 = "llvm.extractvalue"(%0) {position = [4, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
"llvm.br"(%26)[^bb2] : (i64) -> ()
^bb2(%27: i64): // 2 preds: ^bb0, ^bb1
%28 = "llvm.insertvalue"(%21, %27) {position = [4, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%29 = "llvm.extractvalue"(%0) {position = [4, 3]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%30 = "llvm.insertvalue"(%28, %29) {position = [4, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%31 = "memref.collapse_shape"(%arg0) {reassociation = [[0], [1, 2], [3]]} : (memref<2x?x?x?xf32>) -> memref<2x?x?xf32>
"func.return"(%31) : (memref<2x?x?xf32>) -> ()
}) {function_type = (memref<2x?x?x?xf32>) -> memref<2x?x?xf32>, sym_name = "collapse_dynamic_shape"} : () -> ()
} -> SUCCESS
//===-------------------------------------------===//
//===-------------------------------------------===//
Legalizing operation : 'func.return'(0x5ef5ab0) {
"func.return"(%31) : (memref<2x?x?xf32>) -> ()
* Fold {
} -> FAILURE : unable to fold
} -> FAILURE : no matched legalization pattern
//===-------------------------------------------===//
** Insert : 'builtin.unrealized_conversion_cast'(0x5fa3270)
** Insert : 'builtin.unrealized_conversion_cast'(0x5fa31c0)
../memref-to-llvm-local.mlir:17:8: error: operand #0 does not dominate this use
%0 = tensor.collapse_shape %arg0 [[0], [1, 2], [3]]: tensor<2x?x?x?xf32> into tensor<2x?x?xf32>
^
../memref-to-llvm-local.mlir:17:8: note: see current operation: %30 = "llvm.insertvalue"(%28, %29) {position = [4, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
../memref-to-llvm-local.mlir:17:8: note: operand defined here (op in the same region)
// -----// IR Dump After ConvertMemRefToLLVM Failed //----- //
"builtin.module"() ({
"func.func"() ({
^bb0(%arg0: memref<2x?x?x?xf32>):
%0 = "builtin.unrealized_conversion_cast"(%arg0) : (memref<2x?x?x?xf32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>
%1 = "llvm.mlir.undef"() : () -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%2 = "llvm.extractvalue"(%0) {position = [0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> !llvm.ptr<f32>
%3 = "llvm.insertvalue"(%1, %2) {position = [0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr<f32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%4 = "llvm.extractvalue"(%0) {position = [1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> !llvm.ptr<f32>
%5 = "llvm.insertvalue"(%3, %4) {position = [1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr<f32>) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%6 = "llvm.extractvalue"(%0) {position = [2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%7 = "llvm.insertvalue"(%5, %6) {position = [2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%8 = "llvm.mlir.constant"() {value = 1 : index} : () -> i64
%9 = "llvm.extractvalue"(%0) {position = [3, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%10 = "llvm.mul"(%8, %9) : (i64, i64) -> i64
%11 = "llvm.extractvalue"(%0) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%12 = "llvm.mul"(%10, %11) : (i64, i64) -> i64
%13 = "llvm.mlir.constant"() {value = 1 : index} : () -> i64
%14 = "llvm.extractvalue"(%0) {position = [3, 3]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%15 = "llvm.mul"(%13, %14) : (i64, i64) -> i64
%16 = "llvm.mlir.constant"() {value = 2 : index} : () -> i64
%17 = "llvm.insertvalue"(%7, %16) {position = [3, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%18 = "llvm.insertvalue"(%17, %12) {position = [3, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%19 = "llvm.insertvalue"(%18, %15) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%20 = "llvm.extractvalue"(%0) {position = [4, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%21 = "llvm.insertvalue"(%19, %20) {position = [4, 0]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%22 = "llvm.extractvalue"(%0) {position = [4, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%23 = "llvm.mlir.constant"() {value = 1 : i32} : () -> i64
%24 = "llvm.extractvalue"(%0) {position = [3, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%25 = "llvm.icmp"(%24, %23) {predicate = 1 : i64} : (i64, i64) -> i1
"llvm.cond_br"(%25, %22)[^bb2, ^bb1] {operand_segment_sizes = dense<[1, 1, 0]> : vector<3xi32>} : (i1, i64) -> ()
^bb1: // pred: ^bb0
%26 = "llvm.extractvalue"(%0) {position = [4, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
"llvm.br"(%26)[^bb2] : (i64) -> ()
^bb2(%27: i64): // 2 preds: ^bb0, ^bb1
%28 = "llvm.insertvalue"(%21, %27) {position = [4, 1]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%29 = "llvm.extractvalue"(%0) {position = [4, 3]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<4 x i64>, array<4 x i64>)>) -> i64
%30 = "llvm.insertvalue"(%28, %29) {position = [4, 2]} : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>, i64) -> !llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>
%31 = "builtin.unrealized_conversion_cast"(%30) : (!llvm.struct<(ptr<f32>, ptr<f32>, i64, array<3 x i64>, array<3 x i64>)>) -> memref<2x?x?xf32>
"func.return"(%31) : (memref<2x?x?xf32>) -> ()
}) {function_type = (memref<2x?x?x?xf32>) -> memref<2x?x?xf32>, sym_name = "collapse_dynamic_shape"} : () -> ()
}) : () -> ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment