[Mlir-commits] [mlir] Support polynomial attributes with floating point coefficients (PR #91137)

Jeremy Kun llvmlistbot at llvm.org
Tue May 7 13:44:15 PDT 2024


================
@@ -149,7 +172,7 @@ def Polynomial_PolynomialType : Polynomial_Type<"Polynomial", "polynomial"> {
     A type for polynomials in a polynomial quotient ring.
   }];
   let parameters = (ins Polynomial_RingAttr:$ring);
-  let assemblyFormat = "`<` $ring `>`";
+  let assemblyFormat = "`<` qualified($ring) `>`";
----------------
j2kun wrote:

Without this, a polynomial type will print like

```mlir
!polynomial.polynomial<<coefficientType = f32>>
```

When I would prefer the name of the attribute be present

```mlir
!polynomial.polynomial<#polynomial.ring<coefficientType = f32>>
```

The `<< ... >>` is what feels off to me. This is tested by `tools/mlir/test/Dialect/Polynomial/types.mlir`, and this specific line in this PR was added after the ring attribute custom parser was removed, because that custom parser printed the attribute name (cf. https://github.com/llvm/llvm-project/pull/91137/files#diff-93b00b22db2663bf648011bbdce7942738b0ba9a14a98f23404d6550eacca8dfL148)

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


More information about the Mlir-commits mailing list