Benjamin Kramer
c1ebefdf77
[mlir] Make polynomial approximation emit std instead of LLVM ops
...
This is a bit cleaner and removes issues with 2d vectors. It also has a
big impact on constant folding, hence the test changes.
Differential Revision: https://reviews.llvm.org/D107896
2021-08-11 16:37:21 +02:00
Eugene Zhulenev
d94426d22a
[mlir] Math: add algebraic simplification patterns to math transforms
...
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D106822
2021-07-27 09:22:33 -07:00
Eugene Zhulenev
ce976d2db3
[mlir] Add polynomial approximation for math::LogOp (using builders API)
...
Replace math::LogOp with an approximations from the the Julien Pommier's SSE math library
Link: http://gruntthepeon.free.fr/ssemath
Reviewed By: asaadaldien
Differential Revision: https://reviews.llvm.org/D97304
2021-02-24 07:50:25 -08:00
Eugene Zhulenev
f99ccf6516
[mlir] Add math polynomial approximation pass
...
This gives ~30x speedup compared to expanding Tanh into exp operations:
```
name old cpu/op new cpu/op delta
BM_mlir_Tanh_f32/10 253ns ± 3% 55ns ± 7% -78.35% (p=0.000 n=44+41)
BM_mlir_Tanh_f32/100 2.21µs ± 4% 0.14µs ± 8% -93.85% (p=0.000 n=48+49)
BM_mlir_Tanh_f32/1k 22.6µs ± 4% 0.7µs ± 5% -96.68% (p=0.000 n=32+42)
BM_mlir_Tanh_f32/10k 225µs ± 5% 7µs ± 6% -96.88% (p=0.000 n=49+55)
name old time/op new time/op delta
BM_mlir_Tanh_f32/10 259ns ± 1% 56ns ± 2% -78.31% (p=0.000 n=41+39)
BM_mlir_Tanh_f32/100 2.27µs ± 1% 0.14µs ± 5% -93.89% (p=0.000 n=46+49)
BM_mlir_Tanh_f32/1k 22.9µs ± 1% 0.8µs ± 4% -96.67% (p=0.000 n=30+42)
BM_mlir_Tanh_f32/10k 230µs ± 0% 7µs ± 3% -96.88% (p=0.000 n=37+55)
```
This approximations is based on Eigen::generic_fast_tanh function
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D96739
2021-02-19 12:43:36 -08:00
Stephan Herhut
2bfe27da17
[mlir][math] Fix cmake files after dialect splitting.
...
This fixes some missing dependencies that broke the shared library
build.
2021-02-12 11:25:15 +01:00
Stephan Herhut
4348d8ab7f
[mlir][math] Split off the math dialect.
...
This does not split transformations, yet. Those will be done as future clean ups.
Differential Revision: https://reviews.llvm.org/D96272
2021-02-12 10:55:12 +01:00