Commit a2bcca0
authored
[NFC] Switch to new pass generation tablegen definitions. (#4370)
This commit completes the migration from the deprecated GEN_PASS_CLASSES
to the new GEN_PASS_DEF infrastructure across all torch-mlir passes.
Changes include:
1. Remove PassDetail.h files (deprecated pattern)
- Deleted lib/Conversion/PassDetail.h
- Deleted lib/RefBackend/PassDetail.h
- Deleted lib/Dialect/Torch/Transforms/PassDetail.h
- Deleted lib/Dialect/TorchConversion/Transforms/PassDetail.h
- Deleted lib/Dialect/TMTensor/Transforms/PassDetail.h
2. Migrate conversion passes to GEN_PASS_DEF
- Updated all passes in lib/Conversion/ to use #define GEN_PASS_DEF_*
- Removed GEN_PASS_DECL from .cpp files (move to headers where needed)
- Fixed includes and namespace declarations
3. Migrate dialect transform passes
- Updated Torch, TorchConversion, and TMTensor transform passes
- Properly scoped GEN_PASS_DEF in namespace blocks
4. Handle passes with options (TorchToStablehlo, TorchToTosa)
- Added GEN_PASS_DECL_* to headers
- Implemented default and convenience create functions
- Used generated constructors via `using BaseClass::BaseClass`
5. Handle passes without options (RefBackend)
- Removed manual create function implementations
- Let tablegen auto-generate create functions
- Added using declarations for Base classes in impl namespace
6. Fix backend type conversion passes
- Added missing create functions in BackendTypeConversionPasses.cpp
- Fixed namespace scoping issues
7. Fix missing namespace closures
- Added proper closing namespace comments in Verify*BackendContract.cpp
The migration maintains full backward compatibility while adopting the
recommended LLVM pass infrastructure patterns. All passes now use the
generated base classes and follow consistent patterns based on whether
they have options defined in tablegen.
This is the preparation for
llvm/llvm-project#166904
Signed-off-by: hanhanW <[email protected]>
---------
Signed-off-by: hanhanW <[email protected]>1 parent bc657db commit a2bcca0
File tree
57 files changed
+492
-441
lines changed- include
- torch-mlir-dialects/Dialect/TMTensor/Transforms
- torch-mlir
- Conversion
- TorchToStablehlo
- TorchToTosa
- RefBackend
- lib
- Conversion
- TorchConversionToMLProgram
- TorchOnnxToTorch
- TorchToArith
- TorchToLinalg
- TorchToSCF
- TorchToStablehlo
- TorchToTMTensor
- TorchToTensor
- TorchToTosa
- Dialect
- TMTensor/Transforms
- TorchConversion/Transforms
- Torch/Transforms
- RefBackend
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
57 files changed
+492
-441
lines changedLines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 24 | | |
38 | 25 | | |
39 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | | - | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | 30 | | |
34 | | - | |
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
38 | 34 | | |
39 | 35 | | |
40 | | - | |
41 | 36 | | |
42 | 37 | | |
43 | 38 | | |
44 | 39 | | |
45 | | - | |
46 | 40 | | |
47 | 41 | | |
48 | 42 | | |
This file was deleted.
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| |||
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
105 | | - | |
| 111 | + | |
106 | 112 | | |
107 | 113 | | |
108 | 114 | | |
| |||
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
141 | | - | |
| 147 | + | |
142 | 148 | | |
143 | 149 | | |
| 150 | + | |
| 151 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
40 | | - | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| |||
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
85 | | - | |
86 | | - | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
| 93 | + | |
| 94 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| |||
407 | 413 | | |
408 | 414 | | |
409 | 415 | | |
410 | | - | |
| 416 | + | |
411 | 417 | | |
412 | 418 | | |
413 | 419 | | |
| |||
565 | 571 | | |
566 | 572 | | |
567 | 573 | | |
568 | | - | |
569 | | - | |
| 574 | + | |
570 | 575 | | |
571 | 576 | | |
| 577 | + | |
| 578 | + | |
0 commit comments