Enzyme main
Loading...
Searching...
No Matches
mlir::enzyme::MDiffeGradientUtils Class Reference

#include "MLIR/Interfaces/GradientUtils.h"

Inheritance diagram for mlir::enzyme::MDiffeGradientUtils:
Collaboration diagram for mlir::enzyme::MDiffeGradientUtils:

Public Member Functions

void registerGradientCreatorHook (std::function< Value(Location, Type)> hook)
 
void deregisterGradientCreatorHook (std::function< Value(Location, Type)> hook)
 
Value getNewGradient (Location loc, Type t)
 
mlir::Value getDifferential (mlir::Value origv)
 
void setDiffe (mlir::Value origv, mlir::Value newv, mlir::OpBuilder &builder)
 
void zeroDiffe (mlir::Value origv, mlir::OpBuilder &builder)
 
mlir::Value diffe (mlir::Value origv, mlir::OpBuilder &builder)
 
 MDiffeGradientUtils (MEnzymeLogic &Logic, FunctionOpInterface newFunc_, FunctionOpInterface oldFunc_, MTypeAnalysis &TA, MTypeResults TR, IRMapping &invertedPointers_, const llvm::ArrayRef< bool > returnPrimals, const llvm::ArrayRef< bool > returnShadows, const SmallPtrSetImpl< mlir::Value > &constantvalues_, const SmallPtrSetImpl< mlir::Value > &activevals_, ArrayRef< DIFFE_TYPE > RetActivity, ArrayRef< DIFFE_TYPE > ArgActivity, IRMapping &origToNew_, std::map< Operation *, Operation * > &origToNewOps_, DerivativeMode mode, unsigned width, bool omp, llvm::StringRef postpasses, bool verifyPostPasses, bool strongZero)
 
- Public Member Functions inherited from mlir::enzyme::MGradientUtils
SmallVector< mlir::Value, 1 > getNewFromOriginal (ValueRange originst) const
 
mlir::Value getNewFromOriginal (const mlir::Value originst) const
 
mlir::Block * getNewFromOriginal (mlir::Block *originst) const
 
Operation * getNewFromOriginal (Operation *originst) const
 
 MGradientUtils (MEnzymeLogic &Logic, FunctionOpInterface newFunc_, FunctionOpInterface oldFunc_, MTypeAnalysis &TA_, MTypeResults TR_, IRMapping &invertedPointers_, const llvm::ArrayRef< bool > returnPrimals, const llvm::ArrayRef< bool > returnShadows, const SmallPtrSetImpl< mlir::Value > &constantvalues_, const SmallPtrSetImpl< mlir::Value > &activevals_, ArrayRef< DIFFE_TYPE > ReturnActivities, ArrayRef< DIFFE_TYPE > ArgDiffeTypes_, IRMapping &originalToNewFn_, std::map< Operation *, Operation * > &originalToNewFnOps_, DerivativeMode mode, unsigned width, bool omp, llvm::StringRef postpasses, bool verifyPostPasses, bool strongZero)
 
void erase (Operation *op)
 
void replaceOrigOpWith (Operation *op, ValueRange vals)
 
void eraseIfUnused (Operation *op, bool erase=true, bool check=true)
 
bool isConstantInstruction (mlir::Operation *v) const
 
bool isConstantValue (mlir::Value v) const
 
mlir::Value invertPointerM (mlir::Value v, OpBuilder &Builder2)
 
void forceAugmentedReturns ()
 
Operation * cloneWithNewOperands (OpBuilder &B, Operation *op)
 
LogicalResult visitChild (Operation *op)
 
void setDiffe (mlir::Value origv, mlir::Value newv, mlir::OpBuilder &builder)
 
void setInvertedPointer (mlir::Value origv, mlir::Value newv)
 
mlir::Type getShadowType (mlir::Type T)
 

Static Public Member Functions

static MDiffeGradientUtilsCreateFromClone (MEnzymeLogic &Logic, DerivativeMode mode, unsigned width, FunctionOpInterface todiff, MTypeAnalysis &TA, MFnTypeInfo &oldTypeInfo, const llvm::ArrayRef< bool > returnPrimals, const llvm::ArrayRef< bool > returnShadows, ArrayRef< DIFFE_TYPE > RetActivity, ArrayRef< DIFFE_TYPE > ArgActivity, mlir::Type additionalArg, bool omp, llvm::StringRef postpasses, bool verifyPostPasses, bool strongZero)
 
- Static Public Member Functions inherited from mlir::enzyme::MGradientUtils
static llvm::SmallVector< mlir::Value, 1 > reindex_arguments (llvm::ArrayRef< mlir::Value > vals, mlir::OperandRange range)
 

Protected Attributes

IRMapping differentials
 
Block * initializationBlock
 
SmallVector< std::function< Value(Location, Type)> > gradientCreatorHook
 

Additional Inherited Members

- Public Attributes inherited from mlir::enzyme::MGradientUtils
FunctionOpInterface newFunc
 
MEnzymeLogicLogic
 
bool AtomicAdd
 
DerivativeMode mode
 
FunctionOpInterface oldFunc
 
IRMapping invertedPointers
 
IRMapping originalToNewFn
 
std::map< Operation *, Operation * > originalToNewFnOps
 
SmallPtrSet< Block *, 4 > blocksNotForAnalysis
 
DenseMap< Operation *, bool > readOnlyCache
 
std::unique_ptr< enzyme::ActivityAnalyzeractivityAnalyzer
 
MTypeAnalysisTA
 
MTypeResults TR
 
bool omp
 
bool verifyPostPasses
 
llvm::StringRef postpasses
 
bool strongZero
 
const llvm::ArrayRef< bool > returnPrimals
 
const llvm::ArrayRef< bool > returnShadows
 
unsigned width
 
ArrayRef< DIFFE_TYPEArgDiffeTypes
 
ArrayRef< DIFFE_TYPERetDiffeTypes
 

Detailed Description

Definition at line 109 of file GradientUtils.h.

Constructor & Destructor Documentation

◆ MDiffeGradientUtils()

mlir::enzyme::MDiffeGradientUtils::MDiffeGradientUtils ( MEnzymeLogic & Logic,
FunctionOpInterface newFunc_,
FunctionOpInterface oldFunc_,
MTypeAnalysis & TA,
MTypeResults TR,
IRMapping & invertedPointers_,
const llvm::ArrayRef< bool > returnPrimals,
const llvm::ArrayRef< bool > returnShadows,
const SmallPtrSetImpl< mlir::Value > & constantvalues_,
const SmallPtrSetImpl< mlir::Value > & activevals_,
ArrayRef< DIFFE_TYPE > RetActivity,
ArrayRef< DIFFE_TYPE > ArgActivity,
IRMapping & origToNew_,
std::map< Operation *, Operation * > & origToNewOps_,
DerivativeMode mode,
unsigned width,
bool omp,
llvm::StringRef postpasses,
bool verifyPostPasses,
bool strongZero )
inline

Definition at line 129 of file GradientUtils.h.

Member Function Documentation

◆ CreateFromClone()

static MDiffeGradientUtils * mlir::enzyme::MDiffeGradientUtils::CreateFromClone ( MEnzymeLogic & Logic,
DerivativeMode mode,
unsigned width,
FunctionOpInterface todiff,
MTypeAnalysis & TA,
MFnTypeInfo & oldTypeInfo,
const llvm::ArrayRef< bool > returnPrimals,
const llvm::ArrayRef< bool > returnShadows,
ArrayRef< DIFFE_TYPE > RetActivity,
ArrayRef< DIFFE_TYPE > ArgActivity,
mlir::Type additionalArg,
bool omp,
llvm::StringRef postpasses,
bool verifyPostPasses,
bool strongZero )
inlinestatic

Definition at line 150 of file GradientUtils.h.

◆ deregisterGradientCreatorHook()

void MDiffeGradientUtils::deregisterGradientCreatorHook ( std::function< Value(Location, Type)> hook)

Definition at line 149 of file GradientUtils.cpp.

References gradientCreatorHook.

◆ diffe()

mlir::Value mlir::enzyme::MDiffeGradientUtils::diffe ( mlir::Value origv,
mlir::OpBuilder & builder )

◆ getDifferential()

mlir::Value mlir::enzyme::MDiffeGradientUtils::getDifferential ( mlir::Value origv)

Definition at line 173 of file GradientUtils.cpp.

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

◆ getNewGradient()

Value MDiffeGradientUtils::getNewGradient ( Location loc,
Type t )

Definition at line 155 of file GradientUtils.cpp.

◆ registerGradientCreatorHook()

void MDiffeGradientUtils::registerGradientCreatorHook ( std::function< Value(Location, Type)> hook)

Definition at line 143 of file GradientUtils.cpp.

References gradientCreatorHook.

◆ setDiffe()

void mlir::enzyme::MDiffeGradientUtils::setDiffe ( mlir::Value origv,
mlir::Value newv,
mlir::OpBuilder & builder )

Definition at line 183 of file GradientUtils.cpp.

References mlir::enzyme::MGradientUtils::setDiffe().

◆ zeroDiffe()

void mlir::enzyme::MDiffeGradientUtils::zeroDiffe ( mlir::Value origv,
mlir::OpBuilder & builder )

Definition at line 196 of file GradientUtils.cpp.

References getShadowType().

Referenced by mlir::enzyme::MEnzymeLogic::handlePredecessors().

Member Data Documentation

◆ differentials

IRMapping mlir::enzyme::MDiffeGradientUtils::differentials
protected

Definition at line 111 of file GradientUtils.h.

◆ gradientCreatorHook

SmallVector<std::function<Value(Location, Type)> > mlir::enzyme::MDiffeGradientUtils::gradientCreatorHook
protected

Definition at line 114 of file GradientUtils.h.

Referenced by deregisterGradientCreatorHook(), and registerGradientCreatorHook().

◆ initializationBlock

Block* mlir::enzyme::MDiffeGradientUtils::initializationBlock
protected

Definition at line 113 of file GradientUtils.h.

Referenced by GradientUtils::GradientUtils().


The documentation for this class was generated from the following files: