CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
83 lines
3.3 KiB
MLIR
83 lines
3.3 KiB
MLIR
// RUN: mlir-opt -split-input-file -transform-interpreter %s | FileCheck %s
|
|
|
|
module attributes {transform.with_named_sequence} {
|
|
transform.named_sequence @__transform_main(%root : !transform.any_op {transform.readonly}) {
|
|
%func_op = transform.structured.match ops{["func.func"]} in %root : (!transform.any_op) -> !transform.op<"func.func">
|
|
transform.apply_patterns to %func_op {
|
|
transform.apply_patterns.linalg.fold_pack_unpack_into_empty
|
|
} : !transform.op<"func.func">
|
|
transform.yield
|
|
}
|
|
}
|
|
|
|
func.func @pack_empty(%arg0: tensor<8x8x32x32xf32>) -> tensor<8x8x32x32xf32> {
|
|
%empty_unpacked = tensor.empty() : tensor<256x256xf32>
|
|
%packed = linalg.pack %empty_unpacked
|
|
inner_dims_pos = [0, 1] inner_tiles = [32, 32]
|
|
into %arg0 : tensor<256x256xf32> -> tensor<8x8x32x32xf32>
|
|
return %packed : tensor<8x8x32x32xf32>
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @pack_empty(
|
|
// CHECK-SAME: %[[T:.+]]: tensor<8x8x32x32xf32>
|
|
// CHECK-NOT: linalg.pack
|
|
// CHECK: return %[[T]] : tensor<8x8x32x32xf32>
|
|
|
|
func.func @pack_empty_dynamic(%arg0: tensor<?x?x32x32xf32>, %dim0: index, %dim1: index) -> tensor<?x?x32x32xf32> {
|
|
%empty_unpacked = tensor.empty(%dim0, %dim1) : tensor<?x?xf32>
|
|
%packed = linalg.pack %empty_unpacked
|
|
inner_dims_pos = [0, 1] inner_tiles = [32, 32]
|
|
into %arg0 : tensor<?x?xf32> -> tensor<?x?x32x32xf32>
|
|
return %packed : tensor<?x?x32x32xf32>
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @pack_empty_dynamic(
|
|
// CHECK-SAME: %[[T:.+]]: tensor<?x?x32x32xf32>,
|
|
// CHECK-SAME: %[[DIM0:[a-zA-Z0-9_]+]]: index,
|
|
// CHECK-SAME: %[[DIM1:[a-zA-Z0-9_]+]]: index
|
|
// CHECK-NOT: linalg.pack
|
|
// CHECK: return %[[T]] : tensor<?x?x32x32xf32>
|
|
|
|
func.func @unpack_empty(%arg0: tensor<256x256xf32>) -> tensor<256x256xf32> {
|
|
%empty_packed = tensor.empty() : tensor<8x8x32x32xf32>
|
|
%unpacked = linalg.unpack %empty_packed
|
|
inner_dims_pos = [0, 1] inner_tiles = [32, 32]
|
|
into %arg0 : tensor<8x8x32x32xf32> -> tensor<256x256xf32>
|
|
return %unpacked : tensor<256x256xf32>
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @unpack_empty(
|
|
// CHECK-SAME: %[[T:.+]]: tensor<256x256xf32>
|
|
// CHECK-NOT: linalg.unpack
|
|
// CHECK: return %[[T]] : tensor<256x256xf32>
|
|
|
|
func.func @unpack_empty_dynamic(%arg0: tensor<?x?xf32>, %dim0: index, %dim1: index) -> tensor<?x?xf32> {
|
|
%empty_packed = tensor.empty(%dim0, %dim1) : tensor<?x?x32x32xf32>
|
|
%unpacked = linalg.unpack %empty_packed
|
|
inner_dims_pos = [0, 1] inner_tiles = [32, 32]
|
|
into %arg0 : tensor<?x?x32x32xf32> -> tensor<?x?xf32>
|
|
return %unpacked : tensor<?x?xf32>
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @unpack_empty_dynamic(
|
|
// CHECK-SAME: %[[T:.+]]: tensor<?x?xf32>,
|
|
// CHECK-SAME: %[[DIM0:[a-zA-Z0-9_]+]]: index,
|
|
// CHECK-SAME: %[[DIM1:[a-zA-Z0-9_]+]]: index
|
|
// CHECK-NOT: linalg.unpack
|
|
// CHECK: return %[[T]] : tensor<?x?xf32>
|
|
|
|
func.func @pack_padded_empty(%arg0: tensor<8x8x32x32xf32>) -> tensor<8x8x32x32xf32> {
|
|
%pad = arith.constant 1.0 : f32
|
|
%empty_unpacked = tensor.empty() : tensor<256x256xf32>
|
|
%packed = linalg.pack %empty_unpacked
|
|
padding_value(%pad : f32)
|
|
inner_dims_pos = [0, 1] inner_tiles = [32, 32]
|
|
into %arg0 : tensor<256x256xf32> -> tensor<8x8x32x32xf32>
|
|
return %packed : tensor<8x8x32x32xf32>
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @pack_padded_empty(
|
|
// CHECK-SAME: %[[T:.+]]: tensor<8x8x32x32xf32>
|
|
// CHECK: %[[PACK:.+]] = linalg.pack
|
|
// CHECK: return %[[PACK]] : tensor<8x8x32x32xf32>
|