Skip to content

Commit

Permalink
Improve cast ft error
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Dec 31, 2024
1 parent 7cf9e90 commit 02660b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,8 @@ class AdjointGenerator : public llvm::InstVisitor<AdjointGenerator> {
ss << "Cannot deduce adding type (cast) of " << I;
EmitNoTypeError(str, I, gutils, Builder2);
}
assert(FT);

if (FT) {

auto rule = [&](Value *dif) {
if (I.getOpcode() == CastInst::CastOps::FPTrunc ||
Expand All @@ -1404,7 +1405,8 @@ class AdjointGenerator : public llvm::InstVisitor<AdjointGenerator> {
Value *dif = diffe(&I, Builder2);
Value *diff = applyChainRule(op0->getType(), Builder2, rule, dif);

addToDiffe(orig_op0, diff, Builder2, FT);
addToDiffe(orig_op0, diff, Builder2, FT);
}
}

Type *diffTy = gutils->getShadowType(I.getType());
Expand Down

0 comments on commit 02660b0

Please sign in to comment.