diff options
| author | Alexandre E. Eichenberger <alexe@us.ibm.com> | 2019-12-06 09:40:12 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-12-06 09:40:50 -0800 |
| commit | 3c69ca1e696645a944fac6c9794d71e8424665c5 (patch) | |
| tree | 4d7986855a49ad7b869a060787855926e8c6ab8e /mlir/lib/Transforms | |
| parent | 79047e1ab5649ddca0253178ce21b376f15bfc4b (diff) | |
| download | bcm5719-llvm-3c69ca1e696645a944fac6c9794d71e8424665c5.tar.gz bcm5719-llvm-3c69ca1e696645a944fac6c9794d71e8424665c5.zip | |
fix examples in comments
Closes tensorflow/mlir#301
COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/301 from AlexandreEichenberger:vect-doc-update 7e5418a9101a4bdad2357882fe660b02bba8bd01
PiperOrigin-RevId: 284202462
Diffstat (limited to 'mlir/lib/Transforms')
| -rw-r--r-- | mlir/lib/Transforms/Vectorize.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp index c1e0a9c0e13..16b43e3f136 100644 --- a/mlir/lib/Transforms/Vectorize.cpp +++ b/mlir/lib/Transforms/Vectorize.cpp @@ -306,10 +306,10 @@ using namespace mlir; /// terminal processing out of the use-def chains starting from loads. In the /// following snippet, there is simply no load:: /// ```mlir -/// mlfunc @fill(%A : memref<128xf32>) -> () { +/// func @fill(%A : memref<128xf32>) -> () { /// %f1 = constant 1.0 : f32 /// affine.for %i0 = 0 to 32 { -/// store %f1, %A[%i0] : memref<128xf32, 0> +/// affine.store %f1, %A[%i0] : memref<128xf32, 0> /// } /// return /// } @@ -322,7 +322,7 @@ using namespace mlir; /// vectorize by a factor 128, we want to transform the following input: /// ```mlir /// affine.for %i = %M to %N { -/// %a = load A[%i] : memref<?xf32> +/// %a = affine.load %A[%i] : memref<?xf32> /// } /// ``` /// @@ -332,7 +332,7 @@ using namespace mlir; /// ```mlir /// affine.for %i = floor(%M, 128) to ceil(%N, 128) { /// affine.for %ii = max(%M, 128 * %i) to min(%N, 128*%i + 127) { -/// %a = load A[%ii] : memref<?xf32> +/// %a = affine.load %A[%ii] : memref<?xf32> /// } /// } /// ``` @@ -341,7 +341,7 @@ using namespace mlir; /// scheduling, so we want to generate a pattern that resembles: /// ```mlir /// affine.for %i = ? to ? step ? { -/// %v_a = vector.transfer_read A[%i] : memref<?xf32>, vector<128xf32> +/// %v_a = vector.transfer_read %A[%i] : memref<?xf32>, vector<128xf32> /// } /// ``` /// @@ -361,7 +361,7 @@ using namespace mlir; /// abstraction of size 128 returns code similar to: /// ```mlir /// affine.for %i = %M to %N step 128 { -/// %v_a = vector.transfer_read A[%i] : memref<?xf32>, vector<128xf32> +/// %v_a = vector.transfer_read %A[%i] : memref<?xf32>, vector<128xf32> /// } /// ``` /// @@ -382,7 +382,7 @@ using namespace mlir; /// ========= /// Consider the following Function: /// ```mlir -/// mlfunc @vector_add_2d(%M : index, %N : index) -> f32 { +/// func @vector_add_2d(%M : index, %N : index) -> f32 { /// %A = alloc (%M, %N) : memref<?x?xf32, 0> /// %B = alloc (%M, %N) : memref<?x?xf32, 0> /// %C = alloc (%M, %N) : memref<?x?xf32, 0> @@ -391,19 +391,19 @@ using namespace mlir; /// affine.for %i0 = 0 to %M { /// affine.for %i1 = 0 to %N { /// // non-scoped %f1 -/// store %f1, %A[%i0, %i1] : memref<?x?xf32, 0> +/// affine.store %f1, %A[%i0, %i1] : memref<?x?xf32, 0> /// } /// } /// affine.for %i2 = 0 to %M { /// affine.for %i3 = 0 to %N { /// // non-scoped %f2 -/// store %f2, %B[%i2, %i3] : memref<?x?xf32, 0> +/// affine.store %f2, %B[%i2, %i3] : memref<?x?xf32, 0> /// } /// } /// affine.for %i4 = 0 to %M { /// affine.for %i5 = 0 to %N { -/// %a5 = load %A[%i4, %i5] : memref<?x?xf32, 0> -/// %b5 = load %B[%i4, %i5] : memref<?x?xf32, 0> +/// %a5 = affine.load %A[%i4, %i5] : memref<?x?xf32, 0> +/// %b5 = affine.load %B[%i4, %i5] : memref<?x?xf32, 0> /// %s5 = addf %a5, %b5 : f32 /// // non-scoped %f1 /// %s6 = addf %s5, %f1 : f32 @@ -411,7 +411,7 @@ using namespace mlir; /// %s7 = addf %s5, %f2 : f32 /// // diamond dependency. /// %s8 = addf %s7, %s6 : f32 -/// store %s8, %C[%i4, %i5] : memref<?x?xf32, 0> +/// affine.store %s8, %C[%i4, %i5] : memref<?x?xf32, 0> /// } /// } /// %c7 = constant 7 : index @@ -421,15 +421,14 @@ using namespace mlir; /// } /// ``` /// -/// TODO(ntv): update post b/119731251. -/// The -vectorize pass with the following arguments: +/// The -affine-vectorize pass with the following arguments: /// ``` -/// -vectorize -virtual-vector-size 256 --test-fastest-varying=0 +/// -affine-vectorize -virtual-vector-size 256 --test-fastest-varying=0 /// ``` /// /// produces this standard innermost-loop vectorized code: /// ```mlir -/// mlfunc @vector_add_2d(%arg0 : index, %arg1 : index) -> f32 { +/// func @vector_add_2d(%arg0 : index, %arg1 : index) -> f32 { /// %0 = alloc(%arg0, %arg1) : memref<?x?xf32> /// %1 = alloc(%arg0, %arg1) : memref<?x?xf32> /// %2 = alloc(%arg0, %arg1) : memref<?x?xf32> @@ -476,16 +475,15 @@ using namespace mlir; /// } /// ``` /// -/// TODO(ntv): update post b/119731251. -/// The -vectorize pass with the following arguments: +/// The -affine-vectorize pass with the following arguments: /// ``` -/// -vectorize -virtual-vector-size 32 -virtual-vector-size 256 +/// -affine-vectorize -virtual-vector-size 32 -virtual-vector-size 256 /// --test-fastest-varying=1 --test-fastest-varying=0 /// ``` /// /// produces this more interesting mixed outer-innermost-loop vectorized code: /// ```mlir -/// mlfunc @vector_add_2d(%arg0 : index, %arg1 : index) -> f32 { +/// func @vector_add_2d(%arg0 : index, %arg1 : index) -> f32 { /// %0 = alloc(%arg0, %arg1) : memref<?x?xf32> /// %1 = alloc(%arg0, %arg1) : memref<?x?xf32> /// %2 = alloc(%arg0, %arg1) : memref<?x?xf32> |

