Skip to content

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

@j2kun

Description

@j2kun

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dialect: polynomialIssues concerning the polynomial dialect

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions