Enzyme main
Loading...
Searching...
No Matches
ActivityAnalyzer Class Reference

Helper class to analyze the differential activity. More...

#include "MLIR/Analysis/ActivityAnalysis.h"

Collaboration diagram for ActivityAnalyzer:

Public Types

enum class  UseActivity {
  None = 0 , OnlyLoads = 1 , OnlyStores = 2 , OnlyNonPointerStores = 3 ,
  AllStores = 4
}
 

Public Member Functions

 ActivityAnalyzer (PreProcessCache &PPC, llvm::AAResults &AA_, const llvm::SmallPtrSetImpl< llvm::BasicBlock * > &notForAnalysis_, llvm::TargetLibraryInfo &TLI_, const llvm::SmallPtrSetImpl< llvm::Value * > &ConstantValues, const llvm::SmallPtrSetImpl< llvm::Value * > &ActiveValues, DIFFE_TYPE ActiveReturns)
 Construct the analyzer from the a previous set of constant and active values and whether returns are active.
 
bool isConstantInstruction (TypeResults const &TR, llvm::Instruction *inst)
 Return whether this instruction is known not to propagate adjoints Note that instructions could return an active pointer, but do not propagate adjoints themselves.
 
bool isConstantValue (TypeResults const &TR, llvm::Value *val)
 Return whether this values is known not to contain derivative.
 
bool isValueInactiveFromUsers (TypeResults const &TR, llvm::Value *val, UseActivity UA, llvm::Instruction **FoundInst=nullptr, llvm::Value **FoundValue=nullptr)
 Is the value free of any active uses.
 
bool isValueActivelyStoredOrReturned (TypeResults const &TR, llvm::Value *val, bool outside=false)
 Is the value potentially actively returned or stored.
 

Public Attributes

const DIFFE_TYPE ActiveReturns
 Whether the returns of the function being analyzed are active.
 

Detailed Description

Helper class to analyze the differential activity.

Definition at line 67 of file ActivityAnalysis.h.

Member Enumeration Documentation

◆ UseActivity

enum class ActivityAnalyzer::UseActivity
strong
Enumerator
None 
OnlyLoads 
OnlyStores 
OnlyNonPointerStores 
AllStores 

Definition at line 233 of file ActivityAnalysis.h.

Constructor & Destructor Documentation

◆ ActivityAnalyzer()

ActivityAnalyzer::ActivityAnalyzer ( PreProcessCache & PPC,
llvm::AAResults & AA_,
const llvm::SmallPtrSetImpl< llvm::BasicBlock * > & notForAnalysis_,
llvm::TargetLibraryInfo & TLI_,
const llvm::SmallPtrSetImpl< llvm::Value * > & ConstantValues,
const llvm::SmallPtrSetImpl< llvm::Value * > & ActiveValues,
DIFFE_TYPE ActiveReturns )
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 116 of file ActivityAnalysis.h.

Member Function Documentation

◆ isConstantInstruction()

bool ActivityAnalyzer::isConstantInstruction ( TypeResults const & TR,
llvm::Instruction * inst )

Return whether this instruction is known not to propagate adjoints Note that instructions could return an active pointer, but do not propagate adjoints themselves.

Previously computed inactives remain inactive

Overwrite activity using metadata

A store into all integral memory is inactive

Definition at line 744 of file ActivityAnalysis.cpp.

References EnzymePrintActivity.

◆ isConstantValue()

bool ActivityAnalyzer::isConstantValue ( TypeResults const & TR,
llvm::Value * val )

Return whether this values is known not to contain derivative.

◆ isValueActivelyStoredOrReturned()

bool ActivityAnalyzer::isValueActivelyStoredOrReturned ( TypeResults const & TR,
llvm::Value * val,
bool outside = false )

Is the value potentially actively returned or stored.

Definition at line 3497 of file ActivityAnalysis.cpp.

◆ isValueInactiveFromUsers()

bool ActivityAnalyzer::isValueInactiveFromUsers ( TypeResults const & TR,
llvm::Value * val,
UseActivity UA,
llvm::Instruction ** FoundInst = nullptr,
llvm::Value ** FoundValue = nullptr )

Is the value free of any active uses.

Member Data Documentation

◆ ActiveReturns

const DIFFE_TYPE ActivityAnalyzer::ActiveReturns

Whether the returns of the function being analyzed are active.

Definition at line 81 of file ActivityAnalysis.h.


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