[mlir][Linalg] Small refactoring of ConvOpVectorization
authorJakub Lichman <limo@google.com>
Thu, 10 Sep 2020 07:03:43 +0000 (07:03 +0000)
committerJakub Lichman <limo@google.com>
Thu, 10 Sep 2020 07:05:30 +0000 (07:05 +0000)
This commit addresses comments that were requested on D86619
after it was landed.

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

mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp

index ce3b5fd..3049570 100644 (file)
@@ -568,10 +568,11 @@ struct AffineMinSCFCanonicalizationPattern
 /// Subsequently, they are contracted together and the result is written to
 /// the first entry of the output buffer.
 template <typename ConvOp, int N>
-struct ConvOpVectorization : public OpRewritePattern<ConvOp> {
+class ConvOpVectorization : public OpRewritePattern<ConvOp> {
   using OpRewritePattern<ConvOp>::OpRewritePattern;
   SmallVector<bool, 4> mask;
 
+public:
   ConvOpVectorization(MLIRContext *context, SmallVector<bool, 4> msk)
       : OpRewritePattern<ConvOp>(context) {
     assert(msk.size() == N && "Mask size does not match rank");
index 51781af..f4aabf8 100644 (file)
@@ -371,7 +371,7 @@ LogicalResult LinalgCopyVTWForwardingPattern::matchAndRewrite(
 template <class ConvOp, int N>
 LogicalResult ConvOpVectorization<ConvOp, N>::matchAndRewrite(
     ConvOp op, PatternRewriter &rewriter) const {
-  const unsigned dimSize = 3;
+  unsigned dimSize = 3;
   Location loc = op.getLoc();
   MLIRContext *context = op.getContext();
   edsc::ScopedContext scope(rewriter, loc);