Enzyme main
Loading...
Searching...
No Matches
CallDerivatives.cpp File Reference
#include "AdjointGenerator.h"
#include "CallDerivatives.inc"
Include dependency graph for CallDerivatives.cpp:

Go to the source code of this file.

Functions

static bool hasSingleGCPreserveEnd (CallInst *Begin, GradientUtils *gutils)
 Whether Begin has exactly one llvm.julia.gc_preserve_end outside the abort-only blocks the reverse pass drops, as reversing the region requires; CanonicalizeGCPreserveEnds merges them where it can.
 
static void createMPIForwardCall (CallInst &call, ArrayRef< unsigned > ShadowArgs, GradientUtils *gutils, IRBuilder<> &Builder2)
 Forward mode of an MPI call whose derivative is the same call with the buffers ShadowArgs replaced by their shadows (for the reductions, of a sum).
 
static llvm::AtomicRMWInst::BinOp classifyAtomicModifyOp (llvm::Function *op, unsigned &opArgNo, llvm::Type *&FT)
 

Variables

void(* EnzymeShadowAllocRewrite )(LLVMValueRef, void *, LLVMValueRef, uint64_t, LLVMValueRef, uint8_t) = nullptr
 

Function Documentation

◆ classifyAtomicModifyOp()

static llvm::AtomicRMWInst::BinOp classifyAtomicModifyOp ( llvm::Function * op,
unsigned & opArgNo,
llvm::Type *& FT )
static

Definition at line 2303 of file CallDerivatives.cpp.

References Old.

Referenced by AdjointGenerator::handleKnownCallDerivatives().

◆ createMPIForwardCall()

static void createMPIForwardCall ( CallInst & call,
ArrayRef< unsigned > ShadowArgs,
GradientUtils * gutils,
IRBuilder<> & Builder2 )
static

Forward mode of an MPI call whose derivative is the same call with the buffers ShadowArgs replaced by their shadows (for the reductions, of a sum).

At vector width > 1 the call is replayed once per lane. All other arguments, including the trailing ierr of the Fortran ABI, are passed as in the original call. An inactive constant buffer, such as MPI_IN_PLACE or MPI_STATUS_IGNORE, is passed unchanged.

Definition at line 55 of file CallDerivatives.cpp.

References GradientUtils::extractMeta(), GradientUtils::getInvertedBundles(), GradientUtils::getNewFromOriginal(), GradientUtils::getWidth(), GradientUtils::invertPointerM(), GradientUtils::isConstantValue(), Primal, and Shadow.

Referenced by AdjointGenerator::handleMPI().

◆ hasSingleGCPreserveEnd()

static bool hasSingleGCPreserveEnd ( CallInst * Begin,
GradientUtils * gutils )
static

Whether Begin has exactly one llvm.julia.gc_preserve_end outside the abort-only blocks the reverse pass drops, as reversing the region requires; CanonicalizeGCPreserveEnds merges them where it can.

Definition at line 39 of file CallDerivatives.cpp.

References getFuncNameFromCall(), and GradientUtils::notForAnalysis.

Referenced by AdjointGenerator::handleKnownCallDerivatives().

Variable Documentation

◆ EnzymeShadowAllocRewrite

void(* EnzymeShadowAllocRewrite) (LLVMValueRef, void *, LLVMValueRef, uint64_t, LLVMValueRef, uint8_t) ( LLVMValueRef ,
void * ,
LLVMValueRef ,
uint64_t ,
LLVMValueRef ,
uint8_t  ) = nullptr

Definition at line 32 of file CallDerivatives.cpp.

Referenced by AdjointGenerator::handleKnownCallDerivatives().