33 IRMapping &invertedPointers_,
const llvm::ArrayRef<bool> returnPrimals,
34 const llvm::ArrayRef<bool> returnShadows,
35 const SmallPtrSetImpl<mlir::Value> &constantvalues_,
36 const SmallPtrSetImpl<mlir::Value> &activevals_,
37 ArrayRef<DIFFE_TYPE> ReturnActivity, ArrayRef<DIFFE_TYPE> ArgDiffeTypes_,
38 IRMapping &originalToNewFn_,
39 std::map<Operation *, Operation *> &originalToNewFnOps_,
40 DerivativeMode mode,
unsigned width,
bool omp, llvm::StringRef postpasses,
41 bool verifyPostPasses,
bool strongZero)
42 : newFunc(newFunc_), Logic(Logic), AtomicAdd(false), mode(mode),
43 oldFunc(oldFunc_), invertedPointers(invertedPointers_),
44 originalToNewFn(originalToNewFn_),
45 originalToNewFnOps(originalToNewFnOps_), blocksNotForAnalysis(),
47 blocksNotForAnalysis, readOnlyCache, constantvalues_, activevals_,
49 TA(TA_), TR(TR_), omp(omp), verifyPostPasses(verifyPostPasses),
50 postpasses(postpasses), strongZero(strongZero),
51 returnPrimals(returnPrimals), returnShadows(returnShadows), width(width),
52 ArgDiffeTypes(ArgDiffeTypes_), RetDiffeTypes(ReturnActivity) {}
88 auto found = originalToNewFnOps.find(originst);
89 if (found == originalToNewFnOps.end()) {
90 llvm::errs() << oldFunc <<
"\n";
91 llvm::errs() << newFunc <<
"\n";
92 for (
auto &pair : originalToNewFnOps) {
93 llvm::errs() <<
" map[" << pair.first <<
"] = " << pair.second <<
"\n";
94 llvm::errs() <<
" map[" << *pair.first <<
"] = " << *pair.second <<
"\n";
96 llvm::errs() << originst <<
" - " << *originst <<
"\n";
97 llvm_unreachable(
"Could not get new op from original");
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)