Skip to content

Commit

Permalink
Forward mode sincos (rust-lang#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Feb 7, 2022
1 parent 44e7122 commit 68e3c97
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8026,7 +8026,7 @@ class AdjointGenerator
return;
}
}
if (funcName == "__fd_sincos_1" || funcName == "sincos") {
if (funcName == "__fd_sincos_1") {
if (gutils->knownRecomputeHeuristic.find(orig) !=
gutils->knownRecomputeHeuristic.end()) {
if (!gutils->knownRecomputeHeuristic[orig]) {
Expand Down Expand Up @@ -8057,13 +8057,13 @@ class AdjointGenerator
Intrinsic::getDeclaration(gutils->oldFunc->getParent(),
Intrinsic::sin, tys),
args));
Value *dif0 = Builder2.CreateFSub(
Builder2.CreateFMul(Builder2.CreateExtractValue(vdiff, {0}),
dsin),
Builder2.CreateFMul(Builder2.CreateExtractValue(vdiff, {1}),
dcos));

setDiffe(orig, dif0, Builder2);
Value *res = UndefValue::get(orig->getType());
res = Builder2.CreateInsertValue(
res, Builder2.CreateFMul(vdiff, dsin), {0});
res = Builder2.CreateInsertValue(
res, Builder2.CreateFNeg(Builder2.CreateFMul(vdiff, dcos)),
{1});
setDiffe(orig, res, Builder2);
return;
}
case DerivativeMode::ReverseModeGradient:
Expand Down

0 comments on commit 68e3c97

Please sign in to comment.