Skip to content

Commit d579471

Browse files
ftynseNicolas Vasilache
and
Nicolas Vasilache
authored
[mlir][python] smaller scope for vector enumgen (llvm#66992)
Don't generate enums from the main VectorOps.td file as that transitively includes enums from Arith. --------- Co-authored-by: Nicolas Vasilache <[email protected]>
1 parent 0495cd8 commit d579471

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

mlir/python/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ declare_mlir_dialect_python_bindings(
381381
TD_FILE dialects/VectorOps.td
382382
SOURCES dialects/vector.py
383383
DIALECT_NAME vector
384-
GEN_ENUM_BINDINGS)
384+
GEN_ENUM_BINDINGS_TD_FILE
385+
"dialects/VectorAttributes.td")
385386

386387
################################################################################
387388
# Python extensions.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- VectorAttributes.td - Entry point for bindings -----*- tablegen -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef PYTHON_BINDINGS_VECTOR_ATTRDEFS_TD
10+
#define PYTHON_BINDINGS_VECTOR_ATTRDEFS_TD
11+
12+
include "mlir/Dialect/Vector/IR/VectorAttributes.td"
13+
14+
#endif // PYTHON_BINDINGS_VECTOR_ATTRDEFS_TD

utils/bazel/llvm-project-overlay/mlir/python/BUILD.bazel

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,21 +1353,34 @@ gentbl_filegroup(
13531353
tbl_outs = [
13541354
(
13551355
[
1356-
"-gen-python-enum-bindings",
1356+
"-gen-python-op-bindings",
13571357
"-bind-dialect=vector",
13581358
],
1359-
"mlir/dialects/_vector_enum_gen.py",
1359+
"mlir/dialects/_vector_ops_gen.py",
13601360
),
1361+
],
1362+
tblgen = "//mlir:mlir-tblgen",
1363+
td_file = "mlir/dialects/VectorOps.td",
1364+
deps = [
1365+
"//mlir:ArithOpsTdFiles",
1366+
"//mlir:OpBaseTdFiles",
1367+
"//mlir:VectorOpsTdFiles",
1368+
],
1369+
)
1370+
1371+
gentbl_filegroup(
1372+
name = "VectorAttributesPyGen",
1373+
tbl_outs = [
13611374
(
13621375
[
1363-
"-gen-python-op-bindings",
1376+
"-gen-python-enum-bindings",
13641377
"-bind-dialect=vector",
13651378
],
1366-
"mlir/dialects/_vector_ops_gen.py",
1379+
"mlir/dialects/_vector_enum_gen.py",
13671380
),
13681381
],
13691382
tblgen = "//mlir:mlir-tblgen",
1370-
td_file = "mlir/dialects/VectorOps.td",
1383+
td_file = "mlir/dialects/VectorAttributes.td",
13711384
deps = [
13721385
"//mlir:ArithOpsTdFiles",
13731386
"//mlir:OpBaseTdFiles",

0 commit comments

Comments
 (0)