Skip to content

Commit

Permalink
[mlir][python] smaller scope for vector enumgen (llvm#66992)
Browse files Browse the repository at this point in the history
Don't generate enums from the main VectorOps.td file as that
transitively includes enums from Arith.

---------

Co-authored-by: Nicolas Vasilache <ntv@google.com>
  • Loading branch information
ftynse and Nicolas Vasilache committed Sep 21, 2023
1 parent 0495cd8 commit d579471
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
3 changes: 2 additions & 1 deletion mlir/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 14 additions & 0 deletions mlir/python/mlir/dialects/VectorAttributes.td
Original file line number Diff line number Diff line change
@@ -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
23 changes: 18 additions & 5 deletions utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1353,21 +1353,34 @@ gentbl_filegroup(
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-gen-python-op-bindings",
"-bind-dialect=vector",
],
"mlir/dialects/_vector_enum_gen.py",
"mlir/dialects/_vector_ops_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/VectorOps.td",
deps = [
"//mlir:ArithOpsTdFiles",
"//mlir:OpBaseTdFiles",
"//mlir:VectorOpsTdFiles",
],
)

gentbl_filegroup(
name = "VectorAttributesPyGen",
tbl_outs = [
(
[
"-gen-python-op-bindings",
"-gen-python-enum-bindings",
"-bind-dialect=vector",
],
"mlir/dialects/_vector_ops_gen.py",
"mlir/dialects/_vector_enum_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/VectorOps.td",
td_file = "mlir/dialects/VectorAttributes.td",
deps = [
"//mlir:ArithOpsTdFiles",
"//mlir:OpBaseTdFiles",
Expand Down

0 comments on commit d579471

Please sign in to comment.