google / google/heir

polynomial.constant: transform argument coefficients to NTT form if needed

Open
#2,865 0 comments 0 reactions 0 assignees View on GitHub
dialect: polynomial
Dominant language
MLIR
Stars
906
Forks
171
Avg merge
4d 12h
Merged PRs (30d)
32

Description

In PolyMulToNTT, the polynomial.constant op can be changed to have its output in eval form if needed. In this case, we should eagerly apply a compile-time NTT to the static coefficients array attached to the op, so that the semantics of the `polynomial.constant` op can be straightforwardly redefined as: "the operand are coefficients if the result type is in coeff form, and evaluations if the result type is in eval form."

We may want to do this for some other ops, like `polynomial.monomial`, but since `polynomial.monomial` is manly used as an interim implementation detail of the lowering of _coefficient_ form `polynomial.mul`, it is unlikely to be load bearing here. But `polynomial.constant` would participate in more meaningful optimizations, such as constant folding.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.