Enzyme main
Loading...
Searching...
No Matches
Passes.h
Go to the documentation of this file.
1//===- Passes.h - Enzyme pass include header -----------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8#ifndef ENZYME_PASSES_H
9#define ENZYME_PASSES_H
10
11#include "../../Utils.h"
12#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
13#include "mlir/Pass/Pass.h"
14#include <memory>
15
16#include "mlir/Dialect/Arith/IR/Arith.h"
17#include "mlir/Dialect/Complex/IR/Complex.h"
18#include "mlir/Dialect/GPU/IR/GPUDialect.h"
19#include "mlir/Dialect/Linalg/IR/Linalg.h"
20#include "mlir/Dialect/MemRef/IR/MemRef.h"
21#include "mlir/Dialect/Tensor/IR/Tensor.h"
22#include "mlir/Interfaces/LoopLikeInterface.h"
23
24#include "Dialect/Dialect.h"
25
26namespace mlir {
27class PatternRewriter;
28class RewritePatternSet;
29class DominanceInfo;
30} // namespace mlir
31
32namespace mlir {
33// Forward declaration from Dialect.h
34template <typename ConcreteDialect>
35void registerDialect(DialectRegistry &registry);
36
37namespace arith {
38class ArithDialect;
39} // end namespace arith
40
41namespace complex {
42class ComplexDialect;
43} // end namespace complex
44
45namespace cf {
46class ControlFlowDialect;
47} // end namespace cf
48
49namespace scf {
50class SCFDialect;
51} // end namespace scf
52
53namespace memref {
54class MemRefDialect;
55} // end namespace memref
56
57namespace func {
58class FuncDialect;
59} // end namespace func
60
61namespace affine {
62class AffineDialect;
63} // end namespace affine
64
65namespace tensor {
66class TensorDialect;
67} // end namespace tensor
68
69namespace LLVM {
70class LLVMDialect;
71} // end namespace LLVM
72
73namespace tensor {
74class TensorDialect;
75} // end namespace tensor
76
77namespace linalg {
78class LinalgDialect;
79} // end namespace linalg
80
81namespace memref {
82class MemRefDialect;
83} // end namespace memref
84
85namespace enzyme {
86
87#define GEN_PASS_DECL
88#include "Passes/Passes.h.inc"
89
90#define GEN_PASS_REGISTRATION
91#include "Passes/Passes.h.inc"
92
93class AutoDiffOp;
94bool inlineAutodiffOp(enzyme::AutoDiffOp &op, RewriterBase &rewriter,
95 SymbolTableCollection &symbolTable);
96
97/// Moves allocation/deallocation pairs that are private to one iteration of
98/// `loop` out of it, so the buffer is allocated once for the whole loop.
99/// `maxHoistedBytes` bounds the size of a hoisted buffer; 0 means no bound.
100/// Returns whether anything moved.
101bool hoistLoopAllocations(LoopLikeOpInterface loop,
102 uint64_t maxHoistedBytes = 0);
103} // namespace enzyme
104
105} // end namespace mlir
106
107#endif // ENZYME_PASSES_H
bool hoistLoopAllocations(LoopLikeOpInterface loop, uint64_t maxHoistedBytes=0)
Moves allocation/deallocation pairs that are private to one iteration of loop out of it,...
bool inlineAutodiffOp(enzyme::AutoDiffOp &op, RewriterBase &rewriter, SymbolTableCollection &symbolTable)
void registerDialect(DialectRegistry &registry)