summaryrefslogtreecommitdiff
path: root/mlir/test/python/lib/PythonTestCAPI.cpp
diff options
context:
space:
mode:
authorAlex Zinenko <zinenko@google.com>2021-10-14 17:18:28 +0200
committerAlex Zinenko <zinenko@google.com>2021-10-25 12:50:42 +0200
commit14c9207063bb00823a5126131e50c93f6e288bd3 (patch)
tree3aa390353fc6f16d5e5e243614fe6057df52055f /mlir/test/python/lib/PythonTestCAPI.cpp
parent1f49b71fe5fa061065a30c89e6e95b7d123e4bb5 (diff)
[mlir] support interfaces in Python bindings
Introduce the initial support for operation interfaces in C API and Python bindings. Interfaces are a key component of MLIR's extensibility and should be available in bindings to make use of full potential of MLIR. This initial implementation exposes InferTypeOpInterface all the way to the Python bindings since it can be later used to simplify the operation construction methods by inferring their return types instead of requiring the user to do so. The general infrastructure for binding interfaces is defined and InferTypeOpInterface can be used as an example for binding other interfaces. Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D111656
Diffstat (limited to 'mlir/test/python/lib/PythonTestCAPI.cpp')
-rw-r--r--mlir/test/python/lib/PythonTestCAPI.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/mlir/test/python/lib/PythonTestCAPI.cpp b/mlir/test/python/lib/PythonTestCAPI.cpp
new file mode 100644
index 000000000000..474476e74198
--- /dev/null
+++ b/mlir/test/python/lib/PythonTestCAPI.cpp
@@ -0,0 +1,14 @@
+//===- PythonTestCAPI.cpp - C API for the PythonTest dialect --------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "PythonTestCAPI.h"
+#include "PythonTestDialect.h"
+#include "mlir/CAPI/Registration.h"
+
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(PythonTest, python_test,
+ python_test::PythonTestDialect)