Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/Dialect/Linalg/canonicalize.mlir
Show First 20 Lines • Show All 655 Lines • ▼ Show 20 Lines | // CHECK-NOT: linalg.copy | ||||
linalg.copy(%arg0, %arg0): memref<2x3x?x4xf32>, memref<2x3x?x4xf32> | linalg.copy(%arg0, %arg0): memref<2x3x?x4xf32>, memref<2x3x?x4xf32> | ||||
// CHECK: return | // CHECK: return | ||||
return | return | ||||
} | } | ||||
// ----- | // ----- | ||||
// CHECK-LABEL: @self_copy_with_permutation | |||||
func @self_copy_with_permutation(%arg0 : memref<2x3x?x4xf32>) { | |||||
// CHECK: linalg.copy | |||||
linalg.copy(%arg0, %arg0) | |||||
{inputPermutation = affine_map<(i, j, k, l) -> (j, k, i, l)>, | |||||
outputPermuation = affine_map<(i, j, k, l) -> (i, j, k, l)>} : memref<2x3x?x4xf32>, memref<2x3x?x4xf32> | |||||
// CHECK: return | |||||
return | |||||
} | |||||
// ----- | |||||
// CHECK-LABEL: func @fold_fill_reshape() | // CHECK-LABEL: func @fold_fill_reshape() | ||||
func @fold_fill_reshape() -> tensor<6x4xf32> { | func @fold_fill_reshape() -> tensor<6x4xf32> { | ||||
%zero = constant 0.0 : f32 | %zero = constant 0.0 : f32 | ||||
// CHECK: %[[INIT:.+]] = linalg.init_tensor [6, 4] : tensor<6x4xf32> | // CHECK: %[[INIT:.+]] = linalg.init_tensor [6, 4] : tensor<6x4xf32> | ||||
%init = linalg.init_tensor [1, 2, 3, 4] : tensor<1x2x3x4xf32> | %init = linalg.init_tensor [1, 2, 3, 4] : tensor<1x2x3x4xf32> | ||||
// CHECK: %[[FILL:.+]] = linalg.fill(%cst, %[[INIT]]) : f32, tensor<6x4xf32> -> tensor<6x4xf32> | // CHECK: %[[FILL:.+]] = linalg.fill(%cst, %[[INIT]]) : f32, tensor<6x4xf32> -> tensor<6x4xf32> | ||||
%fill = linalg.fill(%zero, %init) : f32, tensor<1x2x3x4xf32> -> tensor<1x2x3x4xf32> | %fill = linalg.fill(%zero, %init) : f32, tensor<1x2x3x4xf32> -> tensor<1x2x3x4xf32> | ||||
%reshape = linalg.tensor_collapse_shape %fill [[0, 1, 2], [3]] | %reshape = linalg.tensor_collapse_shape %fill [[0, 1, 2], [3]] | ||||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |