File tree 1 file changed +43
-21
lines changed
lib/Transforms/PolynomialApproximation
1 file changed +43
-21
lines changed Original file line number Diff line number Diff line change @@ -9,36 +9,58 @@ def PolynomialApproximation : Pass<"polynomial-approximation"> {
9
9
This pass replaces certain operations that are incompatible
10
10
with the FHE computational model with polynomial approximations.
11
11
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.
32
48
33
49
Examples:
34
50
35
51
```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
37
57
```
38
58
39
59
is converted to
40
60
41
61
```mlir
62
+ #ring_f64_ = #polynomial.ring<coefficientType = f64>
63
+ !poly = !polynomial.polynomial<ring = #ring_f64_>
42
64
%0 = polynomial.eval
43
65
#polynomial<typed_float_polynomial <
44
66
0.99458116404270657
You can’t perform that action at this time.
0 commit comments