diff --git a/lib/Transform/Affine/AffineFullUnroll.cpp b/lib/Transform/Affine/AffineFullUnroll.cpp deleted file mode 100644 index d6a22ab..0000000 --- a/lib/Transform/Affine/AffineFullUnroll.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "lib/Transform/Affine/AffineFullUnroll.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" -#include "mlir/Dialect/Affine/LoopUtils.h" -#include "mlir/include/mlir/Pass/Pass.h" - -namespace mlir { -namespace tutorial { - -#define GEN_PASS_DEF_AFFINEFULLUNROLL -#include "lib/Transform/Affine/Passes.h.inc" - -using mlir::affine::AffineForOp; -using mlir::affine::loopUnrollFull; - -// A pass that manually walks the IR -struct AffineFullUnroll : impl::AffineFullUnrollBase { - using AffineFullUnrollBase::AffineFullUnrollBase; - - void runOnOperation() { - getOperation()->walk([&](AffineForOp op) { - if (failed(loopUnrollFull(op))) { - op.emitError("unrolling failed"); - signalPassFailure(); - } - }); - } -}; - - - -} // namespace tutorial -} // namespace mlir diff --git a/lib/Transform/Affine/AffineFullUnroll.h b/lib/Transform/Affine/AffineFullUnroll.h deleted file mode 100644 index 6bb7f4d..0000000 --- a/lib/Transform/Affine/AffineFullUnroll.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef LIB_TRANSFORM_AFFINE_AFFINEFULLUNROLL_H_ -#define LIB_TRANSFORM_AFFINE_AFFINEFULLUNROLL_H_ - -#include "mlir/Pass/Pass.h" - -namespace mlir { -namespace tutorial { - -#define GEN_PASS_DECL_AFFINEFULLUNROLL -#include "lib/Transform/Affine/Passes.h.inc" - -} // namespace tutorial -} // namespace mlir - -#endif // LIB_TRANSFORM_AFFINE_AFFINEFULLUNROLL_H_ diff --git a/lib/Transform/Affine/AffineFullUnrollPatternRewrite.cpp b/lib/Transform/Affine/AffineFullUnrollPatternRewrite.cpp deleted file mode 100644 index 8e283c7..0000000 --- a/lib/Transform/Affine/AffineFullUnrollPatternRewrite.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "lib/Transform/Affine/AffineFullUnrollPatternRewrite.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" -#include "mlir/Dialect/Affine/LoopUtils.h" -#include "mlir/IR/PatternMatch.h" -#include "mlir/Transforms/GreedyPatternRewriteDriver.h" -#include "mlir/include/mlir/Pass/Pass.h" - -namespace mlir { -namespace tutorial { - -#define GEN_PASS_DEF_AFFINEFULLUNROLLPATTERNREWRITE -#include "lib/Transform/Affine/Passes.h.inc" - -using mlir::affine::AffineForOp; -using mlir::affine::loopUnrollFull; - -// A pattern that matches on AffineForOp and unrolls it. -struct AffineFullUnrollPattern : public OpRewritePattern { - AffineFullUnrollPattern(mlir::MLIRContext *context) - : OpRewritePattern(context, /*benefit=*/1) {} - - LogicalResult matchAndRewrite(AffineForOp op, - PatternRewriter &rewriter) const override { - // This is technically not allowed, since in a RewritePattern all - // modifications to the IR are supposed to go through the `rewriter` arg, - // but it works for our limited test cases. - return loopUnrollFull(op); - } -}; - -// A pass that invokes the pattern rewrite engine. -struct AffineFullUnrollPatternRewrite - : impl::AffineFullUnrollPatternRewriteBase { - using AffineFullUnrollPatternRewriteBase::AffineFullUnrollPatternRewriteBase; - void runOnOperation() { - mlir::RewritePatternSet patterns(&getContext()); - patterns.add(&getContext()); - // One could use GreedyRewriteConfig here to slightly tweak the behavior of - // the pattern application. - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); - } -}; - -} // namespace tutorial -} // namespace mlir diff --git a/lib/Transform/Affine/AffineFullUnrollPatternRewrite.h b/lib/Transform/Affine/AffineFullUnrollPatternRewrite.h deleted file mode 100644 index 34fe796..0000000 --- a/lib/Transform/Affine/AffineFullUnrollPatternRewrite.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef LIB_TRANSFORM_AFFINE_AFFINEFULLUNROLLPATTERNREWRITE_H_ -#define LIB_TRANSFORM_AFFINE_AFFINEFULLUNROLLPATTERNREWRITE_H_ - -#include "mlir/Pass/Pass.h" - -namespace mlir { -namespace tutorial { - -#define GEN_PASS_DECL_AFFINEFULLUNROLLPATTERNREWRITE -#include "lib/Transform/Affine/Passes.h.inc" - -} // namespace tutorial -} // namespace mlir - -#endif // LIB_TRANSFORM_AFFINE_AFFINEFULLUNROLLPATTERNREWRITE_H_ diff --git a/lib/Transform/Affine/BUILD b/lib/Transform/Affine/BUILD index 16818b8..15ff97d 100644 --- a/lib/Transform/Affine/BUILD +++ b/lib/Transform/Affine/BUILD @@ -48,47 +48,11 @@ cc_library( ], ) -# cc_library( -# name = "AffineFullUnroll", -# srcs = ["AffineFullUnroll.cpp"], -# hdrs = [ -# "AffineFullUnroll.h", -# "Passes.h", -# ], -# deps = [ -# ":pass_inc_gen", -# "@llvm-project//mlir:AffineDialect", -# "@llvm-project//mlir:AffineUtils", -# "@llvm-project//mlir:FuncDialect", -# "@llvm-project//mlir:Pass", -# "@llvm-project//mlir:Transforms", -# ], -# ) - -# cc_library( -# name = "AffineFullUnrollPatternRewrite", -# srcs = ["AffineFullUnrollPatternRewrite.cpp"], -# hdrs = [ -# "AffineFullUnrollPatternRewrite.h", -# "Passes.h", -# ], -# deps = [ -# ":pass_inc_gen", -# "@llvm-project//mlir:AffineDialect", -# "@llvm-project//mlir:AffineUtils", -# "@llvm-project//mlir:FuncDialect", -# "@llvm-project//mlir:Pass", -# "@llvm-project//mlir:Transforms", -# ], -# ) - cc_library( name = "Passes", hdrs = ["Passes.h"], deps = [ "AffineDistributeToMPI", - # ":AffineFullUnroll", - # ":AffineFullUnrollPatternRewrite", ":pass_inc_gen", ], ) diff --git a/lib/Transform/Affine/Passes.h b/lib/Transform/Affine/Passes.h index e7833bb..e072460 100644 --- a/lib/Transform/Affine/Passes.h +++ b/lib/Transform/Affine/Passes.h @@ -2,8 +2,6 @@ #define LIB_TRANSFORM_AFFINE_PASSES_H_ #include "lib/Transform/Affine/AffineDistributeToMPI.h" -// #include "lib/Transform/Affine/AffineFullUnroll.h" -// #include "lib/Transform/Affine/AffineFullUnrollPatternRewrite.h" namespace mlir { namespace tutorial { diff --git a/lib/Transform/Affine/Passes.td b/lib/Transform/Affine/Passes.td index a60dda1..088f20d 100644 --- a/lib/Transform/Affine/Passes.td +++ b/lib/Transform/Affine/Passes.td @@ -3,22 +3,6 @@ include "mlir/Pass/PassBase.td" -// def AffineFullUnroll : Pass<"affine-full-unroll"> { -// let summary = "Fully unroll all affine loops"; -// let description = [{ -// Fully unroll all affine loops. -// }]; -// let dependentDialects = ["mlir::affine::AffineDialect"]; -// } - -// def AffineFullUnrollPatternRewrite : Pass<"affine-full-unroll-rewrite"> { -// let summary = "Fully unroll all affine loops using the pattern rewrite engine"; -// let description = [{ -// Fully unroll all affine loops using the pattern rewrite engine. -// }]; -// let dependentDialects = ["mlir::affine::AffineDialect"]; -// } - def AffineDistributeToMPI : Pass<"affine-distribute-to-mpi"> { let summary = "Distribute affine loops to MPI processes"; let description = [{