[Mlir-commits] [mlir] [AffineParallelize] expose options when creating pass (PR #124959)

Scott Manley llvmlistbot at llvm.org
Wed Jan 29 19:42:28 PST 2025


https://github.com/rscottmanley updated https://github.com/llvm/llvm-project/pull/124959

>From db1f6426877c02aab85d5c27b5babf916352106f Mon Sep 17 00:00:00 2001
From: Scott Manley <rscottmanley at gmail.com>
Date: Wed, 29 Jan 2025 09:34:53 -0800
Subject: [PATCH] [AffineParallelize] expose options when creating pass

Use the constructors auto generated in AffineParallelizeBase so
AffineParallelizeOptions can be used when adding it to a pass pipeline.

Also remove the constructor from the def in the pass table.
---
 mlir/include/mlir/Dialect/Affine/Passes.h                | 4 ----
 mlir/include/mlir/Dialect/Affine/Passes.td               | 1 -
 mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp | 7 ++-----
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Affine/Passes.h b/mlir/include/mlir/Dialect/Affine/Passes.h
index e152101236dc7a..bc29d04287ac46 100644
--- a/mlir/include/mlir/Dialect/Affine/Passes.h
+++ b/mlir/include/mlir/Dialect/Affine/Passes.h
@@ -44,10 +44,6 @@ createSimplifyAffineStructuresPass();
 std::unique_ptr<OperationPass<func::FuncOp>>
 createAffineLoopInvariantCodeMotionPass();
 
-/// Creates a pass to convert all parallel affine.for's into 1-d affine.parallel
-/// ops.
-std::unique_ptr<OperationPass<func::FuncOp>> createAffineParallelizePass();
-
 /// Apply normalization transformations to affine loop-like ops. If
 /// `promoteSingleIter` is true, single iteration loops are promoted (i.e., the
 /// loop is replaced by its loop body).
diff --git a/mlir/include/mlir/Dialect/Affine/Passes.td b/mlir/include/mlir/Dialect/Affine/Passes.td
index 77073aa29da73e..d7c7897c657301 100644
--- a/mlir/include/mlir/Dialect/Affine/Passes.td
+++ b/mlir/include/mlir/Dialect/Affine/Passes.td
@@ -370,7 +370,6 @@ def AffineVectorize : Pass<"affine-super-vectorize", "func::FuncOp"> {
 
 def AffineParallelize : Pass<"affine-parallelize", "func::FuncOp"> {
   let summary = "Convert affine.for ops into 1-D affine.parallel";
-  let constructor = "mlir::affine::createAffineParallelizePass()";
   let options = [
     Option<"maxNested", "max-nested", "unsigned", /*default=*/"-1u",
            "Maximum number of nested parallel loops to produce. "
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
index 64f2bc6e745c37..fa0676b206826f 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
@@ -42,6 +42,8 @@ namespace {
 /// Convert all parallel affine.for op into 1-D affine.parallel op.
 struct AffineParallelize
     : public affine::impl::AffineParallelizeBase<AffineParallelize> {
+  using AffineParallelizeBase<AffineParallelize>::AffineParallelizeBase;
+
   void runOnOperation() override;
 };
 
@@ -90,8 +92,3 @@ void AffineParallelize::runOnOperation() {
     }
   }
 }
-
-std::unique_ptr<OperationPass<func::FuncOp>>
-mlir::affine::createAffineParallelizePass() {
-  return std::make_unique<AffineParallelize>();
-}



More information about the Mlir-commits mailing list