Skip to content

[mlir][python] smaller scope for vector enumgen #66992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2023
Merged

Conversation

ftynse
Copy link
Member

@ftynse ftynse commented Sep 21, 2023

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

@llvmbot llvmbot added mlir:python MLIR Python bindings mlir labels Sep 21, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 21, 2023

@llvm/pr-subscribers-mlir

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/66992.diff

2 Files Affected:

  • (modified) mlir/python/CMakeLists.txt (+2-1)
  • (added) mlir/python/mlir/dialects/VectorAttributes.td (+14)
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

@nicolasvasilache
Copy link
Contributor

Sorry, just saw this, you'll need to rebase on top of 3f30aeb in which I did the same for bazel.

@nicolasvasilache nicolasvasilache self-requested a review September 21, 2023 10:15
ftynse and others added 2 commits September 21, 2023 10:52
Don't generate enums from the main VectorOps.td file as that
transitively includes enums from Arith.
@ftynse ftynse merged commit d579471 into llvm:main Sep 21, 2023
@ftynse ftynse deleted the python-fix branch September 21, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:python MLIR Python bindings mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants