[Mlir-commits] [mlir] Add a polynomial dialect shell, attributes, and types (PR #72081)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Mon Nov 13 05:05:45 PST 2023
================
@@ -0,0 +1,81 @@
+//===- PolynomialAttributes.td - Attribute definitions for the polynomial dialect ------*- tablegen -*-==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef POLYNOMIAL_ATTRIBUTES
+#define POLYNOMIAL_ATTRIBUTES
+
+include "PolynomialDialect.td"
+include "mlir/IR/BuiltinAttributes.td"
+include "mlir/IR/OpBase.td"
+
+class Polynomial_Attr<string name, string attrMnemonic, list<Trait> traits = []>
+ : AttrDef<Polynomial_Dialect, name, traits> {
+ let mnemonic = attrMnemonic;
+}
+
+def Polynomial_PolynomialAttr : Polynomial_Attr<"Polynomial", "polynomial"> {
+ let summary = "An attribute containing a single-variable polynomial.";
+ let description = [{
+ #poly = #polynomial.poly<x**1024 + 1>
+ }];
+
+ let parameters = (ins "Polynomial":$polynomial);
+
+ let builders = [
+ AttrBuilderWithInferredContext<(ins "Polynomial":$polynomial), [{
+ return $_get(polynomial.getContext(), polynomial);
+ }]>
+ ];
+
+ let skipDefaultBuilders = 1;
+ let hasCustomAssemblyFormat = 1;
+}
+
+def Polynomial_RingAttr : Polynomial_Attr<"Ring", "ring"> {
+ let summary = "An attribute specifying a polynomial ring.";
+ let description = [{
+ A ring describes the domain in which polynomial arithmetic occurs. The ring
+ attribute in `polynomial` represents the more specific case of polynomials
+ with a single indeterminate; whose coefficients can be represented by
+ another MLIR type (`ctype`); and, if the coefficient type is integral,
----------------
ftynse wrote:
It is slightly confusing here that the syntax uses `ctype` but the actual parameter has a more verbose name, `coefficientType`. Consider explaining that these are the same thing.
https://github.com/llvm/llvm-project/pull/72081
More information about the Mlir-commits
mailing list