[Mlir-commits] [mlir] 98f5a34 - [mlir][sparse] remove redundate integration tests.
Peiming Liu
llvmlistbot at llvm.org
Tue Apr 18 11:30:49 PDT 2023
Author: Peiming Liu
Date: 2023-04-18T18:30:43Z
New Revision: 98f5a340975bc00197c57e39eb4ca26e2da0e8a2
URL: https://github.com/llvm/llvm-project/commit/98f5a340975bc00197c57e39eb4ca26e2da0e8a2
DIFF: https://github.com/llvm/llvm-project/commit/98f5a340975bc00197c57e39eb4ca26e2da0e8a2.diff
LOG: [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
Added:
Modified:
Removed:
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_slice_based.mlir
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 0191300076737..0000000000000
--- 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 e7269c8e77b40..0000000000000
--- 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<?x?x?xf32> {
- %buf = bufferization.alloc_tensor(%s1, %s2, %s3) : tensor<?x?x?xf32>
- %ret = linalg.fill ins(%f : f32) outs(%buf : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
- return %ret : tensor<?x?x?xf32>
-}
-
-func.func @conv_3d_CCC(%arg0: tensor<?x?x?xf32, #CCC>, %arg1: tensor<?x?x?xf32>) -> tensor<?x?x?xf32, #CCC> {
- %c6 = arith.constant 6 : index
- %s = bufferization.alloc_tensor(%c6, %c6, %c6) : tensor<?x?x?xf32, #CCC>
- %ret = linalg.conv_3d
- ins (%arg0, %arg1: tensor<?x?x?xf32, #CCC>, tensor<?x?x?xf32>)
- outs (%s: tensor<?x?x?xf32, #CCC>) -> tensor<?x?x?xf32, #CCC>
- return %ret : tensor<?x?x?xf32, #CCC>
-}
-
-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<?x?x?xf32>)
- %in3D_tmp = call @alloc_3d_filled_f32(%c8, %c8, %c8, %val) : (index, index, index, f32) -> (tensor<?x?x?xf32>)
- %in3D = tensor.insert %f10 into %in3D_tmp[%c0, %c3, %c0] : tensor<?x?x?xf32>
- %out3D = call @alloc_3d_filled_f32(%c6, %c6, %c6, %zero) : (index, index, index, f32) -> (tensor<?x?x?xf32>)
-
- %in3D_CCC = sparse_tensor.convert %in3D
- : tensor<?x?x?xf32> to tensor<?x?x?xf32, #CCC>
- %CCC_ret = call @conv_3d_CCC(%in3D_CCC, %filter3D) : (tensor<?x?x?xf32, #CCC>, tensor<?x?x?xf32>) -> (tensor<?x?x?xf32, #CCC>)
- // 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<?x?x?xf32, #CCC> to tensor<?x?x?xf32>
- %v1 = vector.transfer_read %1[%c0, %c0, %c0], %zero
- : tensor<?x?x?xf32>, vector<6x6x6xf32>
- vector.print %v1 : vector<6x6x6xf32>
-
- // Free the resources
- bufferization.dealloc_tensor %in3D : tensor<?x?x?xf32>
- bufferization.dealloc_tensor %filter3D : tensor<?x?x?xf32>
- bufferization.dealloc_tensor %out3D : tensor<?x?x?xf32>
-
- bufferization.dealloc_tensor %in3D_CCC : tensor<?x?x?xf32, #CCC>
- bufferization.dealloc_tensor %CCC_ret : tensor<?x?x?xf32, #CCC>
-
- return
-}
More information about the Mlir-commits
mailing list