Skip to content

Commit 6e06a22

Browse files
committed
math.sqrt reverse derivative
1 parent 6a8416d commit 6e06a22

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

enzyme/Enzyme/MLIR/Implementations/MathDerivatives.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ def : MLIRDerivative<"math", "SinOp", (Op $x),
1515
(CheckedMulF (DiffeRet), (CosF $x))
1616
]
1717
>;
18+
def : MLIRDerivative<"math", "SqrtOp", (Op $x),
19+
[
20+
(Arith_Select (CmpF (Arith_OEQ), $x, (ConstantFP<"0","arith","ConstantOp"> $x):$zero), $zero, (DivF (DiffeRet), (MulF (ConstantFP<"2.0","arith","ConstantOp"> $x), (SqrtF $x))))
21+
]
22+
>;

0 commit comments

Comments
 (0)