Enzyme main
Loading...
Searching...
No Matches
RemovalUtils.cpp File Reference
#include "RemovalUtils.h"
#include "Interfaces/AutoDiffOpInterface.h"
#include "Interfaces/AutoDiffTypeInterface.h"
#include "Interfaces/GradientUtilsReverse.h"
#include "Utils.h"
#include "mlir/Analysis/TopologicalSortUtils.h"
#include "mlir/IR/PatternMatch.h"
#include <cassert>
#include <deque>
#include "llvm/ADT/MapVector.h"
Include dependency graph for RemovalUtils.cpp:

Go to the source code of this file.

Classes

struct  Graph
 

Macros

#define DEBUG_TYPE   "enzyme-mincut"
 

Typedefs

typedef llvm::PointerUnion< Operation *, Value > Node
 

Functions

static llvm::cl::opt< bool > DebugGraphviz ("mincut-print-graphviz", llvm::cl::init(false), llvm::cl::Hidden, llvm::cl::desc("Use with DEBUG_TYPE 'enzyme-mincut' to print " "the mincut graphs in GraphViz"))
 
void dump (const Node &n)
 
static void dumpGraphviz (Graph &G)
 
static void dump (Graph &G)
 
static void bfs (const Graph &G, const llvm::SetVector< Value > &Sources, DenseMap< Node, Node > &parent)
 
static bool isMovable (Operation *op)
 
template<typename T >
static Graph filterGraph (const Graph &Orig, const SetVector< Value > &Roots, const SetVector< T > &Required)
 
static int64_t computeSizeOfType (Value val)
 
static int64_t computeRankOfType (Value val)
 
static Operation * findCommonAncestor (ArrayRef< Operation * > ops)
 Find a common IsolatedFromAbove ancestor of the given ops.
 
static void annotate_ops (Block *forward, Block *reverse)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "enzyme-mincut"

Definition at line 24 of file RemovalUtils.cpp.

Typedef Documentation

◆ Node

typedef llvm::PointerUnion<Operation *, Value> Node

Definition at line 143 of file RemovalUtils.cpp.

Function Documentation

◆ annotate_ops()

static void annotate_ops ( Block * forward,
Block * reverse )
static

Definition at line 405 of file RemovalUtils.cpp.

Referenced by mlir::enzyme::minCutCache().

◆ bfs()

static void bfs ( const Graph & G,
const llvm::SetVector< Value > & Sources,
DenseMap< Node, Node > & parent )
inlinestatic

Definition at line 235 of file RemovalUtils.cpp.

Referenced by mlir::enzyme::minCutCache().

◆ computeRankOfType()

static int64_t computeRankOfType ( Value val)
static

Definition at line 364 of file RemovalUtils.cpp.

Referenced by mlir::enzyme::minCutCache().

◆ computeSizeOfType()

static int64_t computeSizeOfType ( Value val)
static

Definition at line 359 of file RemovalUtils.cpp.

Referenced by mlir::enzyme::minCutCache().

◆ DebugGraphviz()

static llvm::cl::opt< bool > DebugGraphviz ( "mincut-print-graphviz" ,
llvm::cl::init(false) ,
llvm::cl::Hidden ,
llvm::cl::desc("Use with DEBUG_TYPE 'enzyme-mincut' to print " "the mincut graphs in GraphViz")  )
static

Referenced by dump(), and mlir::enzyme::minCutCache().

◆ dump() [1/2]

void dump ( const Node & n)

Definition at line 145 of file RemovalUtils.cpp.

Referenced by dump(), and mlir::enzyme::minCutCache().

◆ dump() [2/2]

static void dump ( Graph & G)
static

Definition at line 215 of file RemovalUtils.cpp.

References DebugGraphviz(), dump(), and dumpGraphviz().

◆ dumpGraphviz()

static void dumpGraphviz ( Graph & G)
static

Definition at line 170 of file RemovalUtils.cpp.

Referenced by dump().

◆ filterGraph()

template<typename T >
static Graph filterGraph ( const Graph & Orig,
const SetVector< Value > & Roots,
const SetVector< T > & Required )
static

Definition at line 276 of file RemovalUtils.cpp.

Referenced by mlir::enzyme::minCutCache().

◆ findCommonAncestor()

static Operation * findCommonAncestor ( ArrayRef< Operation * > ops)
static

Find a common IsolatedFromAbove ancestor of the given ops.

If at least one op is a top-level module op (which is expected to be isolated from above), return that op.

Definition at line 372 of file RemovalUtils.cpp.

Referenced by mlir::enzyme::minCutCache().

◆ isMovable()

static bool isMovable ( Operation * op)
inlinestatic

Definition at line 268 of file RemovalUtils.cpp.

Referenced by mlir::enzyme::minCutCache().