[Mlir-commits] [mlir] d1dffa4 - [mlir][Vector] Add a vector.materialize_masks transform operation

Nicolas Vasilache llvmlistbot at llvm.org
Thu Apr 13 12:21:28 PDT 2023


Author: Nicolas Vasilache
Date: 2023-04-13T12:21:19-07:00
New Revision: d1dffa402384af63496979905536dd180c51eedc

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

LOG: [mlir][Vector] Add a vector.materialize_masks transform operation

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
    mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td b/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
index 9b693554d7ed..45a9a42e3132 100644
--- a/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
+++ b/mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
@@ -162,6 +162,25 @@ def LowerMaskedTransfersOp : TransformWithPatternsOp<"vector.lower_masked_transf
   }];
 }
 
+def MaterializeMasksOp : TransformWithPatternsOp<"vector.materialize_masks"> {
+  let description = [{
+    Indicates that mask operations nested under the isolated from above op 
+    `target` should be lowered to fine-grained arithemtic operations.
+
+    This is usually the last step that is run after bufferization as part of the
+    process of lowering to e.g. LLVM or NVVM.
+  }];
+
+  let arguments = (ins TransformHandleTypeInterface:$target);
+  let results = (outs TransformHandleTypeInterface:$results);
+
+  let assemblyFormat = [{
+    $target
+    attr-dict
+    `:` functional-type($target, results)
+  }];
+}
+
 // TODO: evolve lowering_strategy to proper enums.
 def LowerMultiReductionOp
     : TransformWithPatternsOp<"vector.lower_multi_reduction"> {

diff  --git a/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp b/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
index 679df80f8e82..9c7184de8811 100644
--- a/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
+++ b/mlir/lib/Dialect/Vector/TransformOps/VectorTransformOps.cpp
@@ -79,6 +79,15 @@ void transform::LowerMaskedTransfersOp::populatePatterns(
   populateVectorMaskLoweringPatternsForSideEffectingOps(patterns);
 }
 
+//===----------------------------------------------------------------------===//
+// MaterializeMasksOp
+//===----------------------------------------------------------------------===//
+
+void transform::MaterializeMasksOp::populatePatterns(RewritePatternSet &patterns) {
+  populateVectorMaskMaterializationPatterns(patterns,
+                                            /*force32BitVectorIndices=*/false);
+}
+
 //===----------------------------------------------------------------------===//
 // LowerMultiReductionOp
 //===----------------------------------------------------------------------===//


        


More information about the Mlir-commits mailing list