Skip to content

Commit 01e68c5

Browse files
committed
rename mlir.passmanager.Pass to mlir.passes.Pass
1 parent c8c2fae commit 01e68c5

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

mlir/lib/Bindings/Python/MainModule.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ NB_MODULE(_mlir, m) {
136136
populateRewriteSubmodule(rewriteModule);
137137

138138
// Define and populate PassManager submodule.
139-
auto passModule =
139+
auto passManagerModule =
140140
m.def_submodule("passmanager", "MLIR Pass Management Bindings");
141-
populatePassManagerSubmodule(passModule);
142-
populatePassSubmodule(passModule);
141+
populatePassManagerSubmodule(passManagerModule);
142+
auto passesModule =
143+
m.def_submodule("passes", "MLIR Pass Infrastructure Bindings");
144+
populatePassSubmodule(passesModule);
143145
}

mlir/lib/Bindings/Python/Pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace {
2626
// A base class for defining passes in Python
2727
// Users are expected to subclass this and implement the `run` method, e.g.
2828
// ```
29-
// class MyPass(mlir.passmanager.Pass):
29+
// class MyPass(Pass):
3030
// def __init__(self):
3131
// super().__init__("MyPass", ..)
3232
// # other init stuff..

mlir/python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ declare_mlir_python_sources(MLIRPythonSources.Core.Python
2020
SOURCES
2121
_mlir_libs/__init__.py
2222
ir.py
23+
passes.py
2324
passmanager.py
2425
rewrite.py
2526
dialects/_ods_common.py

mlir/python/mlir/passes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
from ._mlir_libs._mlir.passes import *

mlir/test/python/pass.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import gc, sys
44
from mlir.ir import *
55
from mlir.passmanager import *
6+
from mlir.passes import *
67
from mlir.dialects.builtin import ModuleOp
78
from mlir.dialects import pdl
89
from mlir.rewrite import *
@@ -51,13 +52,13 @@ def rew():
5152
def testCustomPass():
5253
with Context():
5354
pdl_module = make_pdl_module()
55+
frozen = PDLModule(pdl_module).freeze()
5456

5557
class CustomPass(Pass):
5658
def __init__(self):
5759
super().__init__("CustomPass", op_name="builtin.module")
5860

5961
def run(self, m):
60-
frozen = PDLModule(pdl_module).freeze()
6162
apply_patterns_and_fold_greedily_with_op(m, frozen)
6263

6364
module = ModuleOp.parse(

0 commit comments

Comments
 (0)