[Mlir-commits] [mlir] 0c74b12 - [mlir][Vector] NFC - Add test to exercise lowering of vector.transfer to scf

Nicolas Vasilache llvmlistbot at llvm.org
Tue Oct 12 05:38:37 PDT 2021


Author: Nicolas Vasilache
Date: 2021-10-12T12:38:33Z
New Revision: 0c74b12a2e819902db0615d2c5c8123e05e084c7

URL: https://github.com/llvm/llvm-project/commit/0c74b12a2e819902db0615d2c5c8123e05e084c7
DIFF: https://github.com/llvm/llvm-project/commit/0c74b12a2e819902db0615d2c5c8123e05e084c7.diff

LOG: [mlir][Vector] NFC - Add test to exercise lowering of vector.transfer to scf

This revision also renames and moves some tests around.

Differential Revision: https://reviews.llvm.org/D111606

Added: 
    mlir/test/Conversion/VectorToSCF/vector-to-scf-mask-and-permutation-map.mlir
    mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
    mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir

Modified: 
    

Removed: 
    mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
    mlir/test/Dialect/Vector/vector-transfer-lowering-to-scf.mlir
    mlir/test/Dialect/Vector/vector-transfer-lowering.mlir


################################################################################
diff  --git a/mlir/test/Dialect/Vector/vector-transfer-lowering-to-scf.mlir b/mlir/test/Conversion/VectorToSCF/vector-to-scf-mask-and-permutation-map.mlir
similarity index 100%
rename from mlir/test/Dialect/Vector/vector-transfer-lowering-to-scf.mlir
rename to mlir/test/Conversion/VectorToSCF/vector-to-scf-mask-and-permutation-map.mlir

diff  --git a/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir b/mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
similarity index 95%
rename from mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
rename to mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
index 3dce006ab7833..dd5cf13ad52da 100644
--- a/mlir/test/Conversion/VectorToSCF/vector-to-loops.mlir
+++ b/mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
@@ -1,6 +1,32 @@
 // RUN: mlir-opt %s -convert-vector-to-scf -split-input-file -allow-unregistered-dialect | FileCheck %s
 // RUN: mlir-opt %s -convert-vector-to-scf=full-unroll=true -split-input-file -allow-unregistered-dialect | FileCheck %s --check-prefix=FULL-UNROLL
 
+// CHECK-LABEL: func @vector_transfer_ops_0d(
+//  CHECK-SAME:   %[[MEM:.*]]: memref<f32>) {
+func @vector_transfer_ops_0d(%M: memref<f32>) {
+    %f0 = constant 0.0 : f32
+
+//  CHECK: %[[V0:.*]] = constant dense<0{{.*}}> : vector<1xf32>
+//  CHECK: %[[R0:.*]] = scf.for %[[I:.*]] = {{.*}} iter_args(%[[V0_ITER:.*]] = %[[V0]]) -> (vector<1xf32>) {
+//  CHECK:   %[[IDX:.*]] = index_cast %[[I]] : index to i32
+//  CHECK:   %[[S:.*]] = memref.load %[[MEM]][] : memref<f32>
+//  CHECK:   %[[R_ITER:.*]] = vector.insertelement %[[S]], %[[V0_ITER]][%[[IDX]] : i32] : vector<1xf32>
+//  CHECK:   scf.yield %[[R_ITER]] : vector<1xf32>
+    %0 = vector.transfer_read %M[], %f0 {permutation_map = affine_map<()->(0)>} :
+      memref<f32>, vector<1xf32>
+
+//  C-HECK: scf.for %[[J:.*]] = %{{.*}}
+//  C-HECK:   %[[JDX:.*]] = index_cast %[[J]] : index to i32
+//  C-HECK:   %[[SS:.*]] = vector.extractelement %[[R0]][%[[JDX]] : i32] : vector<1xf32>
+//  C-HECK:   memref.store %[[SS]], %[[MEM]][] : memref<f32>
+    vector.transfer_write %0, %M[] {permutation_map = affine_map<()->(0)>} :
+      vector<1xf32>, memref<f32>
+
+    return
+}
+
+// -----
+
 // CHECK-LABEL: func @materialize_read_1d() {
 func @materialize_read_1d() {
   %f0 = constant 0.0: f32

diff  --git a/mlir/test/Dialect/Vector/vector-transfer-lowering.mlir b/mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir
similarity index 99%
rename from mlir/test/Dialect/Vector/vector-transfer-lowering.mlir
rename to mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir
index c2db8a501d6bc..4139a80527afa 100644
--- a/mlir/test/Dialect/Vector/vector-transfer-lowering.mlir
+++ b/mlir/test/Dialect/Vector/vector-transfer-to-vector-load-store.mlir
@@ -12,7 +12,7 @@ func @vector_transfer_ops_0d(%M: memref<f32>) {
 //  CHECK-NEXT:   memref.store %[[V]], %[[MEM]][] : memref<f32>
     vector.transfer_write %0, %M[] {permutation_map = affine_map<()->(0)>} :
       vector<1xf32>, memref<f32>
-  
+
     return
 }
 


        


More information about the Mlir-commits mailing list