[Mlir-commits] [mlir] 11bec2a - [mlir][sparse] reduce tensor dimensions in sparse test
Aart Bik
llvmlistbot at llvm.org
Wed Feb 10 17:59:28 PST 2021
Author: Aart Bik
Date: 2021-02-10T17:59:19-08:00
New Revision: 11bec2a81c5cf565793f2334aa7ff5ac6b39340c
URL: https://github.com/llvm/llvm-project/commit/11bec2a81c5cf565793f2334aa7ff5ac6b39340c
DIFF: https://github.com/llvm/llvm-project/commit/11bec2a81c5cf565793f2334aa7ff5ac6b39340c.diff
LOG: [mlir][sparse] reduce tensor dimensions in sparse test
Rationale:
BuiltinTypes.cpp observed overflow when computing size of
tensor<100x200x300x400x500x600x700x800xf32>.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D96475
Added:
Modified:
mlir/test/Dialect/Linalg/sparse_nd.mlir
Removed:
################################################################################
diff --git a/mlir/test/Dialect/Linalg/sparse_nd.mlir b/mlir/test/Dialect/Linalg/sparse_nd.mlir
index d697ce8571e9..62f3c5e4dded 100644
--- a/mlir/test/Dialect/Linalg/sparse_nd.mlir
+++ b/mlir/test/Dialect/Linalg/sparse_nd.mlir
@@ -20,28 +20,28 @@
}
// CHECK-LABEL: func @mul(
-// CHECK-SAME: %[[VAL_0:.*0]]: tensor<100x200x300x400x500x600x700x800xf32>,
-// CHECK-SAME: %[[VAL_1:.*1]]: tensor<100x200x300x400x500x600x700x800xf32>,
-// CHECK-SAME: %[[VAL_2:.*2]]: tensor<100x200x300x400x500x600x700x800xf32>) -> tensor<100x200x300x400x500x600x700x800xf32> {
+// CHECK-SAME: %[[VAL_0:.*0]]: tensor<10x20x30x40x50x60x70x80xf32>,
+// CHECK-SAME: %[[VAL_1:.*1]]: tensor<10x20x30x40x50x60x70x80xf32>,
+// CHECK-SAME: %[[VAL_2:.*2]]: tensor<10x20x30x40x50x60x70x80xf32>) -> tensor<10x20x30x40x50x60x70x80xf32> {
// CHECK: %[[VAL_3:.*]] = constant 3 : index
// CHECK: %[[VAL_4:.*]] = constant 4 : index
-// CHECK: %[[VAL_5:.*]] = constant 100 : index
-// CHECK: %[[VAL_6:.*]] = constant 200 : index
-// CHECK: %[[VAL_7:.*]] = constant 300 : index
-// CHECK: %[[VAL_8:.*]] = constant 600 : index
-// CHECK: %[[VAL_9:.*]] = constant 700 : index
-// CHECK: %[[VAL_10:.*]] = constant 800 : index
+// CHECK: %[[VAL_5:.*]] = constant 10 : index
+// CHECK: %[[VAL_6:.*]] = constant 20 : index
+// CHECK: %[[VAL_7:.*]] = constant 30 : index
+// CHECK: %[[VAL_8:.*]] = constant 60 : index
+// CHECK: %[[VAL_9:.*]] = constant 70 : index
+// CHECK: %[[VAL_10:.*]] = constant 80 : index
// CHECK: %[[VAL_11:.*]] = constant 0 : index
// CHECK: %[[VAL_12:.*]] = constant 1 : index
-// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_0]] : memref<100x200x300x400x500x600x700x800xf32>
-// CHECK: %[[VAL_14:.*]] = linalg.sparse_pointers %[[VAL_1]], %[[VAL_3]] : tensor<100x200x300x400x500x600x700x800xf32> to memref<?xindex>
-// CHECK: %[[VAL_15:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_3]] : tensor<100x200x300x400x500x600x700x800xf32> to memref<?xindex>
-// CHECK: %[[VAL_16:.*]] = linalg.sparse_pointers %[[VAL_1]], %[[VAL_4]] : tensor<100x200x300x400x500x600x700x800xf32> to memref<?xindex>
-// CHECK: %[[VAL_17:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<100x200x300x400x500x600x700x800xf32> to memref<?xindex>
-// CHECK: %[[VAL_18:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<100x200x300x400x500x600x700x800xf32> to memref<?xf32>
-// CHECK: %[[VAL_19:.*]] = tensor_to_memref %[[VAL_2]] : memref<100x200x300x400x500x600x700x800xf32>
-// CHECK: %[[VAL_20:.*]] = alloc() : memref<100x200x300x400x500x600x700x800xf32>
-// CHECK: linalg.copy(%[[VAL_19]], %[[VAL_20]]) : memref<100x200x300x400x500x600x700x800xf32>, memref<100x200x300x400x500x600x700x800xf32>
+// CHECK: %[[VAL_13:.*]] = tensor_to_memref %[[VAL_0]] : memref<10x20x30x40x50x60x70x80xf32>
+// CHECK: %[[VAL_14:.*]] = linalg.sparse_pointers %[[VAL_1]], %[[VAL_3]] : tensor<10x20x30x40x50x60x70x80xf32> to memref<?xindex>
+// CHECK: %[[VAL_15:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_3]] : tensor<10x20x30x40x50x60x70x80xf32> to memref<?xindex>
+// CHECK: %[[VAL_16:.*]] = linalg.sparse_pointers %[[VAL_1]], %[[VAL_4]] : tensor<10x20x30x40x50x60x70x80xf32> to memref<?xindex>
+// CHECK: %[[VAL_17:.*]] = linalg.sparse_indices %[[VAL_1]], %[[VAL_4]] : tensor<10x20x30x40x50x60x70x80xf32> to memref<?xindex>
+// CHECK: %[[VAL_18:.*]] = linalg.sparse_values %[[VAL_1]] : tensor<10x20x30x40x50x60x70x80xf32> to memref<?xf32>
+// CHECK: %[[VAL_19:.*]] = tensor_to_memref %[[VAL_2]] : memref<10x20x30x40x50x60x70x80xf32>
+// CHECK: %[[VAL_20:.*]] = alloc() : memref<10x20x30x40x50x60x70x80xf32>
+// CHECK: linalg.copy(%[[VAL_19]], %[[VAL_20]]) : memref<10x20x30x40x50x60x70x80xf32>, memref<10x20x30x40x50x60x70x80xf32>
// CHECK: scf.for %[[VAL_21:.*]] = %[[VAL_11]] to %[[VAL_10]] step %[[VAL_12]] {
// CHECK: scf.for %[[VAL_22:.*]] = %[[VAL_11]] to %[[VAL_9]] step %[[VAL_12]] {
// CHECK: %[[VAL_23:.*]] = muli %[[VAL_21]], %[[VAL_9]] : index
@@ -68,10 +68,10 @@
// CHECK: scf.for %[[VAL_44:.*]] = %[[VAL_11]] to %[[VAL_5]] step %[[VAL_12]] {
// CHECK: %[[VAL_45:.*]] = muli %[[VAL_43]], %[[VAL_5]] : index
// CHECK: %[[VAL_46:.*]] = addi %[[VAL_45]], %[[VAL_44]] : index
-// CHECK: %[[VAL_47:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_44]], %[[VAL_41]], %[[VAL_38]], %[[VAL_37]], %[[VAL_32]], %[[VAL_25]], %[[VAL_22]], %[[VAL_21]]] : memref<100x200x300x400x500x600x700x800xf32>
+// CHECK: %[[VAL_47:.*]] = load %[[VAL_13]]{{\[}}%[[VAL_44]], %[[VAL_41]], %[[VAL_38]], %[[VAL_37]], %[[VAL_32]], %[[VAL_25]], %[[VAL_22]], %[[VAL_21]]] : memref<10x20x30x40x50x60x70x80xf32>
// CHECK: %[[VAL_48:.*]] = load %[[VAL_18]]{{\[}}%[[VAL_46]]] : memref<?xf32>
// CHECK: %[[VAL_49:.*]] = mulf %[[VAL_47]], %[[VAL_48]] : f32
-// CHECK: store %[[VAL_49]], %[[VAL_20]]{{\[}}%[[VAL_44]], %[[VAL_41]], %[[VAL_38]], %[[VAL_37]], %[[VAL_32]], %[[VAL_25]], %[[VAL_22]], %[[VAL_21]]] : memref<100x200x300x400x500x600x700x800xf32>
+// CHECK: store %[[VAL_49]], %[[VAL_20]]{{\[}}%[[VAL_44]], %[[VAL_41]], %[[VAL_38]], %[[VAL_37]], %[[VAL_32]], %[[VAL_25]], %[[VAL_22]], %[[VAL_21]]] : memref<10x20x30x40x50x60x70x80xf32>
// CHECK: }
// CHECK: }
// CHECK: }
@@ -80,20 +80,20 @@
// CHECK: }
// CHECK: }
// CHECK: }
-// CHECK: %[[VAL_50:.*]] = tensor_load %[[VAL_20]] : memref<100x200x300x400x500x600x700x800xf32>
-// CHECK: return %[[VAL_50]] : tensor<100x200x300x400x500x600x700x800xf32>
+// CHECK: %[[VAL_50:.*]] = tensor_load %[[VAL_20]] : memref<10x20x30x40x50x60x70x80xf32>
+// CHECK: return %[[VAL_50]] : tensor<10x20x30x40x50x60x70x80xf32>
// CHECK: }
-func @mul(%arga: tensor<100x200x300x400x500x600x700x800xf32>,
- %argb: tensor<100x200x300x400x500x600x700x800xf32>,
- %argx: tensor<100x200x300x400x500x600x700x800xf32>)
- -> tensor<100x200x300x400x500x600x700x800xf32> {
+func @mul(%arga: tensor<10x20x30x40x50x60x70x80xf32>,
+ %argb: tensor<10x20x30x40x50x60x70x80xf32>,
+ %argx: tensor<10x20x30x40x50x60x70x80xf32>)
+ -> tensor<10x20x30x40x50x60x70x80xf32> {
%0 = linalg.generic #trait_mul
- ins(%arga, %argb: tensor<100x200x300x400x500x600x700x800xf32>,
- tensor<100x200x300x400x500x600x700x800xf32>)
- outs(%argx: tensor<100x200x300x400x500x600x700x800xf32>) {
+ ins(%arga, %argb: tensor<10x20x30x40x50x60x70x80xf32>,
+ tensor<10x20x30x40x50x60x70x80xf32>)
+ outs(%argx: tensor<10x20x30x40x50x60x70x80xf32>) {
^bb(%a: f32, %b: f32, %x: f32):
%0 = mulf %a, %b : f32
linalg.yield %0 : f32
- } -> tensor<100x200x300x400x500x600x700x800xf32>
- return %0 : tensor<100x200x300x400x500x600x700x800xf32>
+ } -> tensor<10x20x30x40x50x60x70x80xf32>
+ return %0 : tensor<10x20x30x40x50x60x70x80xf32>
}
More information about the Mlir-commits
mailing list