Distributive Property Optimization
- Dominant language
- MLIR
- Stars
- 906
- Forks
- 171
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 32
Description
Given a tree of operations, say (a*b + a*c), reduce the number of operations by using the distributive property to obtain (a * (b + c)). Note that this provides the same error growth (we think, anyway) while eliminating one multiplication operation, decreasing the number of computations.
Another example, (a*c + a*d + b * c + b * d), it can be optimized into (a * (c + d) + b * (c + d)) and then even (a + b) * (c + d). The former has 4 multiplications and 4 additions while the latter only has 2 additions and 1 multiplication.
As far as I know, this has not been implemented as an optimization in homomorphic encryption compilers (but it may have already been explored by the broader compilers community).
See related issue for operation balancing #836.
Contributor guide
Assessment
This issue has not been assessed yet.