Skip to content

Commit

Permalink
Use shouldrecompute of primal in shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Feb 12, 2025
1 parent d6d5243 commit 089916d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions enzyme/Enzyme/GradientUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3833,6 +3833,12 @@ bool GradientUtils::legalRecompute(const Value *val,
reverse); // TODO ADD && !TR.intType(getOriginal(dli),
// /*mustfind*/false).isPossibleFloat();
}
if (auto ci = dyn_cast<CallInst>(uiv)) {
auto called = ci->getCalledFunction();
if (ci->hasFnAttr("enzyme_shouldrecompute") ||
(called && called->hasFnAttribute("enzyme_shouldrecompute")))
return true;
}
if (phi->getNumIncomingValues() == 0) {
return false;
}
Expand Down

0 comments on commit 089916d

Please sign in to comment.