Skip to content

Commit 7d1d584

Browse files
committed
improve docs
1 parent 0c31f39 commit 7d1d584

File tree

1 file changed

+43
-21
lines changed

1 file changed

+43
-21
lines changed

lib/Transforms/PolynomialApproximation/PolynomialApproximation.td

+43-21
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,58 @@ def PolynomialApproximation : Pass<"polynomial-approximation"> {
99
This pass replaces certain operations that are incompatible
1010
with the FHE computational model with polynomial approximations.
1111

12-
The pass applies to all `math` dialect ops except:
13-
14-
- `absi`
15-
- `ctlz`
16-
- `ctpop`
17-
- `cttz`
18-
- `isfinite`
19-
- `isinf`
20-
- `isnan`
21-
- `isnormal`
22-
// TODO(#1487): support these ops when all but one operand is constant
23-
- `atan2`
24-
- `copysign`
25-
- `fpowi`
26-
- `ipowi`
27-
- `powf`
28-
- `fma`
29-
30-
These ops are replaced with `polynomial.eval` ops with a static
31-
polynomial attribute.
12+
The pass applies to the following ops in the `math` dialect:
13+
14+
15+
- `absf`
16+
- `acos`
17+
- `acosh`
18+
- `asin`
19+
- `asinh`
20+
- `atan`
21+
- `atanh`
22+
- `cbrt`
23+
- `ceil`
24+
- `cos`
25+
- `cosh`
26+
- `erf`
27+
- `erfc`
28+
- `exp`
29+
- `exp2`
30+
- `expm1`
31+
- `floor`
32+
- `log`
33+
- `log10`
34+
- `log1p`
35+
- `log2`
36+
- `round`
37+
- `roundeven`
38+
- `rsqrt`
39+
- `sin`
40+
- `sinh`
41+
- `sqrt`
42+
- `tan`
43+
- `tanh`
44+
- `trunc`
45+
46+
These ops are replaced with `polynomial.eval` ops with a static polynomial
47+
attribute.
3248

3349
Examples:
3450

3551
```mlir
36-
%0 = math.exp %x {degree = 3 : i32, domain_lower = -1.0 : f64, domain_upper = 1.0 : f64} : f32
52+
%0 = math.exp %x {
53+
degree = 3 : i32,
54+
domain_lower = -1.0 : f64,
55+
domain_upper = 1.0 : f64
56+
} : f32
3757
```
3858

3959
is converted to
4060

4161
```mlir
62+
#ring_f64_ = #polynomial.ring<coefficientType = f64>
63+
!poly = !polynomial.polynomial<ring = #ring_f64_>
4264
%0 = polynomial.eval
4365
#polynomial<typed_float_polynomial <
4466
0.99458116404270657

0 commit comments

Comments
 (0)