[PATCH] D141923: [mlir][vector] Add a custom builder for LowerVectorsOp
Quentin Colombet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 03:15:56 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe91a5ce27838: [mlir][vector] Add a custom builder for LowerVectorsOp (authored by qcolombet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141923/new/
https://reviews.llvm.org/D141923
Files:
mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h
mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
Index: mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
===================================================================
--- mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
+++ mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.td
@@ -46,6 +46,18 @@
);
let results = (outs PDL_Operation:$results);
+ let builders = [
+ OpBuilder<(ins "Type":$resultType, "Value":$target,
+ "const vector::LowerVectorsOptions &":$options), [{
+ return build($_builder, $_state, resultType, target,
+ options.vectorContractLowering,
+ options.vectorMultiReductionLowering, options.vectorTransferSplit,
+ options.vectorTransposeLowering, options.transposeAVX2Lowering,
+ options.unrollVectorTransfers);
+ }]
+ >
+ ];
+
let assemblyFormat = [{
$target
oilist (
Index: mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h
===================================================================
--- mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h
+++ mlir/include/mlir/Dialect/Vector/TransformOps/VectorTransformOps.h
@@ -11,12 +11,14 @@
#include "mlir/Dialect/PDL/IR/PDLTypes.h"
#include "mlir/Dialect/Transform/IR/TransformInterfaces.h"
+#include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"
#include "mlir/Dialect/Vector/Transforms/VectorTransforms.h"
#include "mlir/IR/OpImplementation.h"
namespace mlir {
namespace vector {
class VectorOp;
+struct LowerVectorsOptions;
} // namespace vector
} // namespace mlir
@@ -32,6 +34,53 @@
namespace vector {
void registerTransformDialectExtension(DialectRegistry ®istry);
+
+/// Helper structure used to hold the different options of LowerVectorsOp.
+struct LowerVectorsOptions : public VectorTransformsOptions {
+ // Have the default values match the LowerVectorsOp values in the td file.
+ LowerVectorsOptions() : VectorTransformsOptions() {
+ setVectorTransformsOptions(VectorContractLowering::OuterProduct);
+ setVectorMultiReductionLowering(
+ VectorMultiReductionLowering::InnerParallel);
+ setVectorTransposeLowering(VectorTransposeLowering::EltWise);
+ setVectorTransferSplit(VectorTransferSplit::LinalgCopy);
+ }
+
+ /// Duplicate the base API of VectorTransformsOptions but return the
+ /// LowerVectorsOptions type. This allows to really set up the different
+ /// options in any order via chained setXXX calls. @{
+ LowerVectorsOptions &setVectorTransformsOptions(VectorContractLowering opt) {
+ VectorTransformsOptions::setVectorTransformsOptions(opt);
+ return *this;
+ }
+
+ LowerVectorsOptions &
+ setVectorMultiReductionLowering(VectorMultiReductionLowering opt) {
+ VectorTransformsOptions::setVectorMultiReductionLowering(opt);
+ return *this;
+ }
+ LowerVectorsOptions &setVectorTransposeLowering(VectorTransposeLowering opt) {
+ VectorTransformsOptions::setVectorTransposeLowering(opt);
+ return *this;
+ }
+ LowerVectorsOptions &setVectorTransferSplit(VectorTransferSplit opt) {
+ VectorTransformsOptions::setVectorTransferSplit(opt);
+ return *this;
+ }
+ /// @}
+
+ bool transposeAVX2Lowering = false;
+ LowerVectorsOptions &setTransposeAVX2Lowering(bool opt) {
+ transposeAVX2Lowering = opt;
+ return *this;
+ }
+
+ bool unrollVectorTransfers = true;
+ LowerVectorsOptions &setUnrollVectorTransfers(bool opt) {
+ unrollVectorTransfers = opt;
+ return *this;
+ }
+};
} // namespace vector
} // namespace mlir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141923.490439.patch
Type: text/x-patch
Size: 3538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230119/3d9a6f58/attachment.bin>
More information about the llvm-commits
mailing list