[Mlir-commits] [mlir] [mlir][polynomial] fix polynomial.constant syntax in docstrings (PR #92818)

Jeremy Kun llvmlistbot at llvm.org
Mon May 20 16:39:06 PDT 2024


================
@@ -286,10 +286,10 @@ def Polynomial_ConstantOp : Op<Polynomial_Dialect, "constant", [Pure]> {
     ```mlir
     #poly = #polynomial.int_polynomial<x**1024 - 1>
     #ring = #polynomial.ring<coefficientType=i32, coefficientModulus=65536:i32, polynomialModulus=#poly>
-    %0 = polynomial.constant #polynomial.int_polynomial<1 + x**2> : !polynomial.polynomial<#ring>
+    %0 = polynomial.constant {value=#polynomial.int_polynomial<1 + x**2>} : !polynomial.polynomial<#ring>
----------------
j2kun wrote:

The SSA value out of the op is typed, but the attribute itself is not. A polynomial type requires an interpretation of that value within a particular ring. This includes the coefficient type (i32 vs i64), an optional coefficient modulus, and an optional polynomial modulus.

Because specifying the polynomial modulus on the type requires a polynomial attribute, I need to keep at least an untyped variant for that purpose. For but polynomial.constant, we can require the type on the attribute and not require the user to provide a type for the result of the op as a whole.

https://github.com/llvm/llvm-project/pull/92818


More information about the Mlir-commits mailing list