[Mlir-commits] [mlir] [mlir][python] smaller scope for vector enumgen (PR #66992)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Thu Sep 21 02:21:49 PDT 2023


https://github.com/ftynse created https://github.com/llvm/llvm-project/pull/66992

Don't generate enums from the main VectorOps.td file as that transitively includes enums from Arith.

>From eca1bef6e126a736d56488dd37e0c7173a12b372 Mon Sep 17 00:00:00 2001
From: Alex Zinenko <zinenko at google.com>
Date: Thu, 21 Sep 2023 09:19:49 +0000
Subject: [PATCH] [mlir][python] smaller scope for vector enumgen

Don't generate enums from the main VectorOps.td file as that
transitively includes enums from Arith.
---
 mlir/python/CMakeLists.txt                    |  3 ++-
 mlir/python/mlir/dialects/VectorAttributes.td | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 mlir/python/mlir/dialects/VectorAttributes.td

diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index 25be18fced0f7ac..9368cb4c2f1657f 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -381,7 +381,8 @@ declare_mlir_dialect_python_bindings(
   TD_FILE dialects/VectorOps.td
   SOURCES dialects/vector.py
   DIALECT_NAME vector
-  GEN_ENUM_BINDINGS)
+  GEN_ENUM_BINDINGS_TD_FILE
+    "dialects/VectorAttributes.td")
 
 ################################################################################
 # Python extensions.
diff --git a/mlir/python/mlir/dialects/VectorAttributes.td b/mlir/python/mlir/dialects/VectorAttributes.td
new file mode 100644
index 000000000000000..038e0ba21c3b25e
--- /dev/null
+++ b/mlir/python/mlir/dialects/VectorAttributes.td
@@ -0,0 +1,14 @@
+//===-- VectorAttributes.td - Entry point for bindings -----*- 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 PYTHON_BINDINGS_VECTOR_ATTRDEFS_TD
+#define PYTHON_BINDINGS_VECTOR_ATTRDEFS_TD
+
+include "mlir/Dialect/Vector/IR/VectorAttributes.td"
+
+#endif // PYTHON_BINDINGS_VECTOR_ATTRDEFS_TD



More information about the Mlir-commits mailing list