|
Enzyme main
|
Helper class to analyze the differential activity. More...
#include "MLIR/Analysis/ActivityAnalysis.h"

Public Types | |
| enum class | UseActivity { None = 0 , OnlyLoads = 1 , OnlyStores = 2 , OnlyNonPointerStores = 3 , AllStores = 4 } |
Public Member Functions | |
| ActivityAnalyzer (const llvm::SmallPtrSetImpl< Block * > ¬ForAnalysis_, llvm::DenseMap< Operation *, bool > &readOnlyCache_, const llvm::SmallPtrSetImpl< Value > &ConstantValues, const llvm::SmallPtrSetImpl< Value > &ActiveValues, llvm::ArrayRef< DIFFE_TYPE > ActiveReturns) | |
| Construct the analyzer from the a previous set of constant and active values and whether returns are active. | |
| bool | isConstantOperation (MTypeResults const &TR, Operation *op) |
| Return whether this operation is known not to propagate adjoints Note that operations could return an active pointer, but do not propagate adjoints themselves. | |
| bool | isConstantValue (MTypeResults const &TR, Value val) |
| Return whether this values is known not to contain derivative information, either directly or as a pointer to. | |
| bool | isReadOnly (Operation *val) |
| bool | isValueInactiveFromUsers (MTypeResults const &TR, Value val, UseActivity UA, Operation **FoundInst=nullptr) |
| Is the value free of any active uses. | |
| bool | isValueActivelyStoredOrReturned (MTypeResults const &TR, Value val, bool outside=false) |
| Is the value potentially actively returned or stored. | |
Public Attributes | |
| const llvm::ArrayRef< DIFFE_TYPE > | ActiveReturns |
| Library Information. | |
Helper class to analyze the differential activity.
Definition at line 19 of file ActivityAnalysis.h.
|
strong |
| Enumerator | |
|---|---|
| None | |
| OnlyLoads | |
| OnlyStores | |
| OnlyNonPointerStores | |
| AllStores | |
Definition at line 166 of file ActivityAnalysis.h.
|
inline |
Construct the analyzer from the a previous set of constant and active values and whether returns are active.
The all arguments of the functions being analyzed must be in the set of constant and active values, lest an error occur during analysis
Definition at line 71 of file ActivityAnalysis.h.
| bool ActivityAnalyzer::isConstantOperation | ( | MTypeResults const & | TR, |
| Operation * | I ) |
Return whether this operation is known not to propagate adjoints Note that operations could return an active pointer, but do not propagate adjoints themselves.
Call the function propagateFromOperand on all operands of CI that could impact the activity of the call instruction.
Return whether this operation is known not to propagate adjoints Note that operation could return an active pointer, but do not propagate adjoints themselves
Previously computed inactives remain inactive
A store into all integral memory is inactive
Definition at line 518 of file ActivityAnalysis.cpp.
| bool ActivityAnalyzer::isConstantValue | ( | MTypeResults const & | TR, |
| Value | val ) |
Return whether this values is known not to contain derivative information, either directly or as a pointer to.
If we've already shown this value to be inactive
If we've already shown this value to be active
Definition at line 1318 of file ActivityAnalysis.cpp.
References allFollowersOf(), DemangledKnownInactiveFunctionsStartingWith, EnzymePrintActivity, getFunctionFromCall(), getFunctionIfArgument(), getPotentialIncomingValues(), getUnderlyingObject(), mlir::enzyme::MTypeResults::intType(), ConcreteType::isIntegral(), isValuePotentiallyUsedAsPointer(), KnownInactiveFunctionInsts, KnownInactiveFunctions, KnownInactiveFunctionsContains, KnownInactiveFunctionsStartingWith, mayAllocateMemory(), mayReadFromMemory(), mayWriteToMemory(), MPIInactiveCommAllocators, mlir::enzyme::MTypeResults::query(), startsWith(), and ConcreteType::str().
| bool ActivityAnalyzer::isReadOnly | ( | Operation * | val | ) |
Definition at line 299 of file ActivityAnalysis.cpp.
References isReadOnly().
Referenced by isReadOnly().
| bool ActivityAnalyzer::isValueActivelyStoredOrReturned | ( | MTypeResults const & | TR, |
| Value | val, | ||
| bool | outside = false ) |
Is the value potentially actively returned or stored.
Definition at line 3475 of file ActivityAnalysis.cpp.
References EnzymePrintActivity.
| bool ActivityAnalyzer::isValueInactiveFromUsers | ( | MTypeResults const & | TR, |
| Value | val, | ||
| UseActivity | UA, | ||
| Operation ** | FoundInst = nullptr ) |
Is the value free of any active uses.
Definition at line 2858 of file ActivityAnalysis.cpp.
References CONSTANT, EnzymePrintActivity, getFunctionFromCall(), getPotentialTerminatorUsers(), isFunctionReturn(), and isReadOnly().
| const llvm::ArrayRef<DIFFE_TYPE> mlir::enzyme::ActivityAnalyzer::ActiveReturns |
Library Information.
Whether the returns of the function being analyzed are active
Definition at line 36 of file ActivityAnalysis.h.