File tree Expand file tree Collapse file tree 5 files changed +14
-5
lines changed Expand file tree Collapse file tree 5 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -136,8 +136,10 @@ NB_MODULE(_mlir, m) {
136
136
populateRewriteSubmodule (rewriteModule);
137
137
138
138
// Define and populate PassManager submodule.
139
- auto passModule =
139
+ auto passManagerModule =
140
140
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);
143
145
}
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ namespace {
26
26
// A base class for defining passes in Python
27
27
// Users are expected to subclass this and implement the `run` method, e.g.
28
28
// ```
29
- // class MyPass(mlir.passmanager. Pass):
29
+ // class MyPass(Pass):
30
30
// def __init__(self):
31
31
// super().__init__("MyPass", ..)
32
32
// # other init stuff..
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ declare_mlir_python_sources(MLIRPythonSources.Core.Python
20
20
SOURCES
21
21
_mlir_libs/__init__.py
22
22
ir.py
23
+ passes.py
23
24
passmanager.py
24
25
rewrite.py
25
26
dialects/_ods_common.py
Original file line number Diff line number Diff line change
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 *
Original file line number Diff line number Diff line change 3
3
import gc , sys
4
4
from mlir .ir import *
5
5
from mlir .passmanager import *
6
+ from mlir .passes import *
6
7
from mlir .dialects .builtin import ModuleOp
7
8
from mlir .dialects import pdl
8
9
from mlir .rewrite import *
@@ -51,13 +52,13 @@ def rew():
51
52
def testCustomPass ():
52
53
with Context ():
53
54
pdl_module = make_pdl_module ()
55
+ frozen = PDLModule (pdl_module ).freeze ()
54
56
55
57
class CustomPass (Pass ):
56
58
def __init__ (self ):
57
59
super ().__init__ ("CustomPass" , op_name = "builtin.module" )
58
60
59
61
def run (self , m ):
60
- frozen = PDLModule (pdl_module ).freeze ()
61
62
apply_patterns_and_fold_greedily_with_op (m , frozen )
62
63
63
64
module = ModuleOp .parse (
You can’t perform that action at this time.
0 commit comments