-
Notifications
You must be signed in to change notification settings - Fork 162
Expand file tree
/
Copy pathPasses.td
More file actions
134 lines (112 loc) · 5.08 KB
/
Passes.td
File metadata and controls
134 lines (112 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#ifndef POlYGEIST_PASSES
#define POLYGEIST_PASSES
include "mlir/Pass/PassBase.td"
def AffineCFG : Pass<"affine-cfg"> {
let summary = "Replace scf.if and similar with affine.if";
let constructor = "mlir::polygeist::replaceAffineCFGPass()";
}
def Mem2Reg : Pass<"mem2reg"> {
let summary = "Replace scf.if and similar with affine.if";
let constructor = "mlir::polygeist::createMem2RegPass()";
}
def ParallelLower : Pass<"parallel-lower", "mlir::ModuleOp"> {
let summary = "Replace scf.if and similar with affine.if";
let dependentDialects =
["memref::MemRefDialect", "func::FuncDialect", "LLVM::LLVMDialect"];
let constructor = "mlir::polygeist::createParallelLowerPass()";
}
def AffineReduction : Pass<"detect-reduction"> {
let summary = "Detect reductions in affine.for";
let constructor = "mlir::polygeist::detectReductionPass()";
}
def SCFCPUify : Pass<"cpuify"> {
let summary = "remove scf.barrier";
let constructor = "mlir::polygeist::createCPUifyPass()";
let dependentDialects =
["memref::MemRefDialect", "func::FuncDialect", "LLVM::LLVMDialect"];
let options = [
Option<"method", "method", "std::string", /*default=*/"\"distribute\"", "Method of doing distribution">
];
}
def InnerSerialization : Pass<"inner-serialize"> {
let summary = "remove scf.barrier";
let constructor = "mlir::polygeist::createInnerSerializationPass()";
let dependentDialects =
["memref::MemRefDialect", "func::FuncDialect", "LLVM::LLVMDialect"];
}
def SCFBarrierRemovalContinuation : InterfacePass<"barrier-removal-continuation", "FunctionOpInterface"> {
let summary = "Remove scf.barrier using continuations";
let constructor = "mlir::polygeist::createBarrierRemovalContinuation()";
let dependentDialects = ["memref::MemRefDialect", "func::FuncDialect"];
}
def SCFRaiseToAffine : Pass<"raise-scf-to-affine"> {
let summary = "Raise SCF to affine";
let constructor = "mlir::polygeist::createRaiseSCFToAffinePass()";
let dependentDialects = ["AffineDialect"];
}
def SCFCanonicalizeFor : Pass<"canonicalize-scf-for"> {
let summary = "Run some additional canonicalization for scf::for";
let constructor = "mlir::polygeist::createCanonicalizeForPass()";
}
def ParallelLICM : Pass<"parallel-licm"> {
let summary = "Perform LICM on known parallel (and serial) loops";
let constructor = "mlir::polygeist::createParallelLICMPass()";
}
def OpenMPOptPass : Pass<"openmp-opt"> {
let summary = "Optimize OpenMP";
let constructor = "mlir::polygeist::createOpenMPOptPass()";
}
def LoopRestructure : Pass<"loop-restructure"> {
let constructor = "mlir::polygeist::createLoopRestructurePass()";
let dependentDialects = ["::mlir::scf::SCFDialect"];
}
def RemoveTrivialUse : Pass<"trivialuse"> {
let constructor = "mlir::polygeist::createRemoveTrivialUsePass()";
}
def LowerPolygeistOps : Pass<"lower-polygeist-ops"> {
let summary = "Lower polygeist ops to memref operations";
let constructor = "mlir::polygeist::createLowerPolygeistOpsPass()";
let dependentDialects = ["::mlir::memref::MemRefDialect"];
}
def ConvertPolygeistToLLVM : Pass<"convert-polygeist-to-llvm", "mlir::ModuleOp"> {
let summary = "Convert scalar and vector operations from the Standard to the "
"LLVM dialect";
let description = [{
Convert standard operations into the LLVM IR dialect operations.
#### Input invariant
- operations including: arithmetic on integers and floats, constants,
direct calls, returns and branches;
- no `tensor` types;
- all `vector` are one-dimensional;
- all blocks are reachable by following the successors of the first basic
block;
If other operations are present and their results are required by the LLVM
IR dialect operations, the pass will fail. Any LLVM IR operations or types
already present in the IR will be kept as is.
#### Output IR
Functions converted to LLVM IR. Function arguments types are converted
one-to-one. Function results are converted one-to-one and, in case more than
1 value is returned, packed into an LLVM IR struct type. Function calls and
returns are updated accordingly. Block argument types are updated to use
LLVM IR types.
}];
let constructor = "mlir::polygeist::createConvertPolygeistToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
let options = [
Option<"useBarePtrCallConv", "use-bare-ptr-memref-call-conv", "bool",
/*default=*/"false",
"Replace FuncOp's MemRef arguments with bare pointers to the MemRef "
"element types">,
Option<"emitCWrappers", "emit-c-wrappers", "bool", /*default=*/"false",
"Emit wrappers for C-compatible pointer-to-struct memref "
"descriptors">,
Option<"indexBitwidth", "index-bitwidth", "unsigned",
/*default=kDeriveIndexBitwidthFromDataLayout*/"0",
"Bitwidth of the index type, 0 to use size of machine word">,
Option<"dataLayout", "data-layout", "std::string",
/*default=*/"\"\"",
"String description (LLVM format) of the data layout that is "
"expected on the produced module">
];
}
#endif // POLYGEIST_PASSES