From 98f5a340975bc00197c57e39eb4ca26e2da0e8a2 Mon Sep 17 00:00:00 2001 From: Peiming Liu Date: Tue, 18 Apr 2023 17:19:30 +0000 Subject: [PATCH] [mlir][sparse] remove redundate integration tests. The removed tests evaluate the same kernels in existing tests, namely `sparse_conv2d.mlir` and `spares_conv3d.mlir`. Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D148644 --- .../CPU/sparse_conv_2d_slice_based.mlir | 83 ------------------ .../CPU/sparse_conv_3d_slice_based.mlir | 98 ---------------------- 2 files changed, 181 deletions(-) delete mode 100644 mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_slice_based.mlir delete mode 100644 mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_slice_based.mlir diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_slice_based.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_slice_based.mlir deleted file mode 100644 index 0191300..0000000 --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_slice_based.mlir +++ /dev/null @@ -1,83 +0,0 @@ -// DEFINE: %{option} = "enable-index-reduction=true enable-runtime-library=false" -// DEFINE: %{command} = mlir-opt %s --sparse-compiler=%{option} | \ -// DEFINE: mlir-cpu-runner \ -// DEFINE: -e entry -entry-point-result=void \ -// DEFINE: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext | \ -// DEFINE: FileCheck %s -// -// RUN: %{command} - -#map = affine_map<(d0, d1, d2, d3) -> (d0 + d2, d1 + d3)> -#map1 = affine_map<(d0, d1, d2, d3) -> (d2, d3)> -#map2 = affine_map<(d0, d1, d2, d3) -> (d0, d1)> - -#DCSR = #sparse_tensor.encoding<{ dimLevelType = [ "compressed", "compressed" ] }> - -module { - func.func @conv2d_all_sparse_CSR(%arg0: tensor<8x8xi32, #DCSR>, %arg1: tensor<3x3xi32>) -> tensor<6x6xi32, #DCSR> { - %0 = bufferization.alloc_tensor() : tensor<6x6xi32, #DCSR> - %1 = linalg.generic { - indexing_maps = [#map, #map1, #map2], - iterator_types = ["parallel", "parallel", "reduction", "reduction"]} - ins(%arg0, %arg1 : tensor<8x8xi32, #DCSR>, tensor<3x3xi32>) - outs(%0 : tensor<6x6xi32, #DCSR>) { - ^bb0(%in: i32, %in_0: i32, %out: i32): - %2 = arith.muli %in, %in_0 : i32 - %3 = arith.addi %out, %2 : i32 - linalg.yield %3 : i32 - } -> tensor<6x6xi32, #DCSR> - return %1 : tensor<6x6xi32, #DCSR> - } - - func.func @entry() { - %c0 = arith.constant 0 : index - %i0 = arith.constant 0 : i32 - - // A typical edge detection filter. - %filter = arith.constant dense<[ - [ 1, 0, -1 ], - [ 0, 0, 0 ], - [ -1, 0, 1 ] - ]> : tensor<3x3xi32> - - %input = arith.constant dense<[ - [ 1, 2, 3, 4, 0, 6, 7, 8 ], - [ 2, 2, 4, 4, 0, 0, 6, 8 ], - [ 2, 2, 4, 4, 0, 0, 6, 8 ], - [ 2, 2, 3, 4, 0, 0, 7, 8 ], - [ 1, 3, 3, 4, 0, 0, 6, 8 ], - [ 3, 2, 3, 4, 0, 0, 7, 8 ], - [ 1, 3, 3, 4, 3, 6, 6, 8 ], - [ 1, 3, 3, 4, 3, 0, 7, 8 ] - ]> : tensor<8x8xi32> - - %sparse_filter_CSR = sparse_tensor.convert %filter - : tensor<3x3xi32> to tensor<3x3xi32> - - %sparse_input_CSR = sparse_tensor.convert %input - : tensor<8x8xi32> to tensor<8x8xi32, #DCSR> - - %3 = call @conv2d_all_sparse_CSR(%sparse_input_CSR, %sparse_filter_CSR) - : (tensor<8x8xi32, #DCSR>, - tensor<3x3xi32>) -> tensor<6x6xi32, #DCSR> - - %out = sparse_tensor.convert %3 - : tensor<6x6xi32, #DCSR> to tensor<6x6xi32> - // - // CHECK: ( ( 0, 0, -1, -6, -1, 6 ), - // CHECK-SAME: ( -1, 0, 1, 0, 1, 0 ), - // CHECK-SAME: ( 0, -1, 1, 0, 0, 0 ), - // CHECK-SAME: ( -1, 0, 0, 0, 0, 0 ), - // CHECK-SAME: ( 0, 0, 3, 6, -3, -6 ), - // CHECK-SAME: ( 2, -1, 3, 0, -3, 0 ) ) - // - %v2 = vector.transfer_read %out[%c0, %c0], %i0 - : tensor<6x6xi32>, vector<6x6xi32> - vector.print %v2 : vector<6x6xi32> - - bufferization.dealloc_tensor %sparse_input_CSR : tensor<8x8xi32, #DCSR> - bufferization.dealloc_tensor %3 : tensor<6x6xi32, #DCSR> - return - } - -} diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_slice_based.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_slice_based.mlir deleted file mode 100644 index e7269c8..0000000 --- a/mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_slice_based.mlir +++ /dev/null @@ -1,98 +0,0 @@ -// DEFINE: %{option} = "enable-index-reduction=true enable-runtime-library=false" -// DEFINE: %{command} = mlir-opt %s --sparse-compiler=%{option} | \ -// DEFINE: mlir-cpu-runner \ -// DEFINE: -e entry -entry-point-result=void \ -// DEFINE: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext | \ -// DEFINE: FileCheck %s -// -// RUN: %{command} - -#CCC = #sparse_tensor.encoding<{ - dimLevelType = [ "compressed", "compressed", "compressed" ] -}> - -func.func @alloc_3d_filled_f32(%s1 : index, %s2 : index, %s3 : index, %f : f32) -> tensor { - %buf = bufferization.alloc_tensor(%s1, %s2, %s3) : tensor - %ret = linalg.fill ins(%f : f32) outs(%buf : tensor) -> tensor - return %ret : tensor -} - -func.func @conv_3d_CCC(%arg0: tensor, %arg1: tensor) -> tensor { - %c6 = arith.constant 6 : index - %s = bufferization.alloc_tensor(%c6, %c6, %c6) : tensor - %ret = linalg.conv_3d - ins (%arg0, %arg1: tensor, tensor) - outs (%s: tensor) -> tensor - return %ret : tensor -} - -func.func @entry() { - %c0 = arith.constant 0 : index - %c1 = arith.constant 1 : index - %c3 = arith.constant 3 : index - %c6 = arith.constant 6 : index - %c8 = arith.constant 8 : index - %f10 = arith.constant 10.00000e+00 : f32 - %val = arith.constant 2.00000e+00 : f32 - %zero = arith.constant 0.00000e+00 : f32 - - %filter3D = call @alloc_3d_filled_f32(%c3, %c3, %c3, %val) : (index, index, index, f32) -> (tensor) - %in3D_tmp = call @alloc_3d_filled_f32(%c8, %c8, %c8, %val) : (index, index, index, f32) -> (tensor) - %in3D = tensor.insert %f10 into %in3D_tmp[%c0, %c3, %c0] : tensor - %out3D = call @alloc_3d_filled_f32(%c6, %c6, %c6, %zero) : (index, index, index, f32) -> (tensor) - - %in3D_CCC = sparse_tensor.convert %in3D - : tensor to tensor - %CCC_ret = call @conv_3d_CCC(%in3D_CCC, %filter3D) : (tensor, tensor) -> (tensor) - // CHECK: ( ( ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 124, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 124, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 124, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ), - // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ), - // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ), - // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ), - // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ), - // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ), - // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ) ) - %1 = sparse_tensor.convert %CCC_ret - : tensor to tensor - %v1 = vector.transfer_read %1[%c0, %c0, %c0], %zero - : tensor, vector<6x6x6xf32> - vector.print %v1 : vector<6x6x6xf32> - - // Free the resources - bufferization.dealloc_tensor %in3D : tensor - bufferization.dealloc_tensor %filter3D : tensor - bufferization.dealloc_tensor %out3D : tensor - - bufferization.dealloc_tensor %in3D_CCC : tensor - bufferization.dealloc_tensor %CCC_ret : tensor - - return -} -- 2.7.4