Skip to content

Commit 67a910b

Browse files
committed
[mlir][python] Remove PythonAttr mapping functionality
This functionality has been replaced by TypeCasters (see D151840) depends on D154468 Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D154469
1 parent fe22b90 commit 67a910b

31 files changed

+26
-102
lines changed

mlir/cmake/modules/AddMLIRPython.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ endfunction()
271271
# SOURCES: Same as declare_mlir_python_sources().
272272
# SOURCES_GLOB: Same as declare_mlir_python_sources().
273273
# DEPENDS: Additional dependency targets.
274+
#
275+
# TODO: Right now `TD_FILE` can't be the actual dialect tablegen file, since we
276+
# use its path to determine where to place the generated python file. If
277+
# we made the output path an additional argument here we could remove the
278+
# need for the separate "wrapper" .td files
274279
function(declare_mlir_dialect_python_bindings)
275280
cmake_parse_arguments(ARG
276281
""

mlir/docs/Bindings/Python.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ the `Func` (which is assigned the namespace `func` as a special case):
919919
#ifndef PYTHON_BINDINGS_FUNC_OPS
920920
#define PYTHON_BINDINGS_FUNC_OPS
921921
922-
include "mlir/Bindings/Python/Attributes.td"
923922
include "mlir/Dialect/Func/IR/FuncOps.td"
924923
925924
#endif // PYTHON_BINDINGS_FUNC_OPS
@@ -1125,14 +1124,10 @@ Dialect operations are provided in Python by wrapping the generic
11251124
properties. Therefore, there is no need to implement a separate C API for them.
11261125
For operations defined in ODS, `mlir-tblgen -gen-python-op-bindings
11271126
-bind-dialect=<dialect-namespace>` generates the Python API from the declarative
1128-
description. If the build API uses specific attribute types, such as
1129-
`::mlir::IntegerAttr` or `::mlir::DenseIntElementsAttr`, for its arguments, the
1130-
mapping to the corresponding Python types should be provided in ODS definition.
1131-
For built-in attribute types, this mapping is available in
1132-
[`include/mlir/Bindings/Python/Attributes.td`](https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Bindings/Python/Attributes.td);
1133-
it is sufficient to create a new `.td` file that includes this file and the
1134-
original ODS definition and use it as source for the `mlir-tblgen` call. Such
1135-
`.td` files reside in
1127+
description.
1128+
It is sufficient to create a new `.td` file that includes the original ODS
1129+
definition and use it as source for the `mlir-tblgen` call.
1130+
Such `.td` files reside in
11361131
[`python/mlir/dialects/`](https://github.com/llvm/llvm-project/tree/main/mlir/python/mlir/dialects).
11371132
The results of `mlir-tblgen` are expected to produce a file named
11381133
`_<dialect-namespace>_ops_gen.py` by convention. The generated operation classes

mlir/examples/standalone/python/mlir_standalone/dialects/StandaloneOps.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef PYTHON_BINDINGS_STANDALONE_OPS
1010
#define PYTHON_BINDINGS_STANDALONE_OPS
1111

12-
include "mlir/Bindings/Python/Attributes.td"
1312
include "Standalone/StandaloneOps.td"
1413

1514
#endif

mlir/include/mlir/Bindings/Python/Attributes.td

Lines changed: 0 additions & 24 deletions
This file was deleted.

mlir/python/mlir/dialects/ArithOps.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef PYTHON_BINDINGS_ARITH_OPS
1010
#define PYTHON_BINDINGS_ARITH_OPS
1111

12-
include "mlir/Bindings/Python/Attributes.td"
1312
include "mlir/Dialect/Arith/IR/ArithOps.td"
1413

1514
#endif

mlir/python/mlir/dialects/AsyncOps.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef PYTHON_BINDINGS_ASYNC_OPS
1010
#define PYTHON_BINDINGS_ASYNC_OPS
1111

12-
include "mlir/Bindings/Python/Attributes.td"
1312
include "mlir/Dialect/Async/IR/AsyncOps.td"
1413

1514
#endif

mlir/python/mlir/dialects/BufferizationOps.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef PYTHON_BINDINGS_BUFFERIZATION_OPS
1010
#define PYTHON_BINDINGS_BUFFERIZATION_OPS
1111

12-
include "mlir/Bindings/Python/Attributes.td"
1312
include "mlir/Dialect/Bufferization/IR/BufferizationOps.td"
1413

1514
#endif

mlir/python/mlir/dialects/BufferizationTransformOps.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#ifndef PYTHON_BINDINGS_BUFFERIZATION_TRANSFORM_OPS
1616
#define PYTHON_BINDINGS_BUFFERIZATION_TRANSFORM_OPS
1717

18-
include "mlir/Bindings/Python/Attributes.td"
1918
include "mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.td"
2019

2120
#endif // PYTHON_BINDINGS_BUFFERIZATION_TRANSFORM_OPS

mlir/python/mlir/dialects/BuiltinOps.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef PYTHON_BINDINGS_BUILTIN_OPS
1010
#define PYTHON_BINDINGS_BUILTIN_OPS
1111

12-
include "mlir/Bindings/Python/Attributes.td"
1312
include "mlir/IR/BuiltinOps.td"
1413

1514
#endif

mlir/python/mlir/dialects/ComplexOps.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef PYTHON_BINDINGS_COMPLEX_OPS
1010
#define PYTHON_BINDINGS_COMPLEX_OPS
1111

12-
include "mlir/Bindings/Python/Attributes.td"
1312
include "mlir/Dialect/Complex/IR/ComplexOps.td"
1413

1514
#endif

0 commit comments

Comments
 (0)