Skip to content

Commit

Permalink
Fix zero on non pointer allocation (#1938)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Jun 23, 2024
1 parent 7fee772 commit e422ba2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions enzyme/Enzyme/CallDerivatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3144,18 +3144,18 @@ bool AdjointGenerator::handleKnownCallDerivatives(
if (EnzymeShadowAllocRewrite)
EnzymeShadowAllocRewrite(wrap(anti), gutils);
}
if (Mode == DerivativeMode::ReverseModeCombined ||
(Mode == DerivativeMode::ReverseModePrimal &&
forwardsShadow) ||
(Mode == DerivativeMode::ReverseModeGradient &&
backwardsShadow) ||
(Mode == DerivativeMode::ForwardModeSplit &&
backwardsShadow)) {
if (!inLoop) {
zeroKnownAllocation(bb, anti, args, funcName, gutils->TLI,
&call);
zeroed = true;
}
}
if (Mode == DerivativeMode::ReverseModeCombined ||
(Mode == DerivativeMode::ReverseModePrimal &&
forwardsShadow) ||
(Mode == DerivativeMode::ReverseModeGradient &&
backwardsShadow) ||
(Mode == DerivativeMode::ForwardModeSplit &&
backwardsShadow)) {
if (!inLoop) {
zeroKnownAllocation(bb, anti, args, funcName, gutils->TLI,
&call);
zeroed = true;
}
}
return anti;
Expand Down

0 comments on commit e422ba2

Please sign in to comment.