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

#include "MLIR/Interfaces/GradientUtils.h"

Inheritance diagram for mlir::enzyme::MGradientUtils:
Collaboration diagram for mlir::enzyme::MGradientUtils:

Public Member Functions

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 llvm::SmallVector< mlir::Value, 1 > reindex_arguments (llvm::ArrayRef< mlir::Value > vals, mlir::OperandRange range)
 

Public Attributes

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 20 of file GradientUtils.h.

Constructor & Destructor Documentation

◆ MGradientUtils()

mlir::enzyme::MGradientUtils::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 )

Definition at line 30 of file GradientUtils.cpp.

Member Function Documentation

◆ cloneWithNewOperands()

Operation * mlir::enzyme::MGradientUtils::cloneWithNewOperands ( OpBuilder & B,
Operation * op )

Definition at line 102 of file GradientUtils.cpp.

◆ erase()

◆ eraseIfUnused()

void mlir::enzyme::MGradientUtils::eraseIfUnused ( Operation * op,
bool erase = true,
bool check = true )
inline

Definition at line 78 of file GradientUtils.h.

Referenced by mlir::enzyme::detail::allocationForwardHandler().

◆ forceAugmentedReturns()

void mlir::enzyme::MGradientUtils::forceAugmentedReturns ( )

Definition at line 251 of file GradientUtils.cpp.

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

◆ getNewFromOriginal() [1/4]

mlir::Value mlir::enzyme::MGradientUtils::getNewFromOriginal ( const mlir::Value originst) const

Definition at line 54 of file GradientUtils.cpp.

◆ getNewFromOriginal() [2/4]

Block * mlir::enzyme::MGradientUtils::getNewFromOriginal ( mlir::Block * originst) const

Definition at line 75 of file GradientUtils.cpp.

◆ getNewFromOriginal() [3/4]

Operation * mlir::enzyme::MGradientUtils::getNewFromOriginal ( Operation * originst) const

Definition at line 86 of file GradientUtils.cpp.

◆ getNewFromOriginal() [4/4]

◆ getShadowType()

mlir::Type mlir::enzyme::MGradientUtils::getShadowType ( mlir::Type T)
inline

Definition at line 93 of file GradientUtils.h.

Referenced by GradientUtils::GradientUtils().

◆ invertPointerM()

◆ isConstantInstruction()

bool mlir::enzyme::MGradientUtils::isConstantInstruction ( mlir::Operation * v) const

Definition at line 110 of file GradientUtils.cpp.

Referenced by isFullyInactive().

◆ isConstantValue()

◆ reindex_arguments()

static llvm::SmallVector< mlir::Value, 1 > mlir::enzyme::MGradientUtils::reindex_arguments ( llvm::ArrayRef< mlir::Value > vals,
mlir::OperandRange range )
inlinestatic

Definition at line 99 of file GradientUtils.h.

◆ replaceOrigOpWith()

void mlir::enzyme::MGradientUtils::replaceOrigOpWith ( Operation * op,
ValueRange vals )
inline

◆ setDiffe()

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

◆ setInvertedPointer()

void mlir::enzyme::MGradientUtils::setInvertedPointer ( mlir::Value origv,
mlir::Value newv )

Definition at line 241 of file GradientUtils.cpp.

References getShadowType().

◆ visitChild()

LogicalResult MGradientUtils::visitChild ( Operation * op)

Member Data Documentation

◆ activityAnalyzer

std::unique_ptr<enzyme::ActivityAnalyzer> mlir::enzyme::MGradientUtils::activityAnalyzer

Definition at line 35 of file GradientUtils.h.

Referenced by visitChild().

◆ ArgDiffeTypes

ArrayRef<DIFFE_TYPE> mlir::enzyme::MGradientUtils::ArgDiffeTypes

Definition at line 47 of file GradientUtils.h.

◆ AtomicAdd

bool mlir::enzyme::MGradientUtils::AtomicAdd

Definition at line 26 of file GradientUtils.h.

◆ blocksNotForAnalysis

SmallPtrSet<Block *, 4> mlir::enzyme::MGradientUtils::blocksNotForAnalysis

Definition at line 33 of file GradientUtils.h.

◆ invertedPointers

IRMapping mlir::enzyme::MGradientUtils::invertedPointers

◆ Logic

◆ mode

DerivativeMode mlir::enzyme::MGradientUtils::mode

Definition at line 27 of file GradientUtils.h.

Referenced by visitChild().

◆ newFunc

◆ oldFunc

FunctionOpInterface mlir::enzyme::MGradientUtils::oldFunc

◆ omp

◆ originalToNewFn

IRMapping mlir::enzyme::MGradientUtils::originalToNewFn

Definition at line 30 of file GradientUtils.h.

Referenced by replaceOrigOpWith().

◆ originalToNewFnOps

std::map<Operation *, Operation *> mlir::enzyme::MGradientUtils::originalToNewFnOps

◆ postpasses

llvm::StringRef mlir::enzyme::MGradientUtils::postpasses

◆ readOnlyCache

DenseMap<Operation *, bool> mlir::enzyme::MGradientUtils::readOnlyCache

Definition at line 34 of file GradientUtils.h.

◆ RetDiffeTypes

ArrayRef<DIFFE_TYPE> mlir::enzyme::MGradientUtils::RetDiffeTypes

Definition at line 48 of file GradientUtils.h.

Referenced by mlir::enzyme::detail::returnReverseHandler().

◆ returnPrimals

const llvm::ArrayRef<bool> mlir::enzyme::MGradientUtils::returnPrimals

◆ returnShadows

const llvm::ArrayRef<bool> mlir::enzyme::MGradientUtils::returnShadows

◆ strongZero

◆ TA

◆ TR

MTypeResults mlir::enzyme::MGradientUtils::TR

Definition at line 38 of file GradientUtils.h.

Referenced by visitChild().

◆ verifyPostPasses

bool mlir::enzyme::MGradientUtils::verifyPostPasses

◆ width


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