[Mlir-commits] [mlir] 96aa0a4 - Enable MLIR Python bindings for TOSA.

Stella Laurenzo llvmlistbot at llvm.org
Mon May 24 11:06:51 PDT 2021


Author: Stella Laurenzo
Date: 2021-05-24T18:04:50Z
New Revision: 96aa0a4115bc89a6d63e0245559ac8204bf5b9ac

URL: https://github.com/llvm/llvm-project/commit/96aa0a4115bc89a6d63e0245559ac8204bf5b9ac
DIFF: https://github.com/llvm/llvm-project/commit/96aa0a4115bc89a6d63e0245559ac8204bf5b9ac.diff

LOG: Enable MLIR Python bindings for TOSA.

Differential Revision: https://reviews.llvm.org/D103035

Added: 
    mlir/python/mlir/dialects/TosaOps.td
    mlir/python/mlir/dialects/tosa.py
    mlir/test/python/dialects/tosa.py

Modified: 
    mlir/python/mlir/dialects/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/python/mlir/dialects/CMakeLists.txt b/mlir/python/mlir/dialects/CMakeLists.txt
index cad3bb7100e24..5eeb6d6281208 100644
--- a/mlir/python/mlir/dialects/CMakeLists.txt
+++ b/mlir/python/mlir/dialects/CMakeLists.txt
@@ -45,6 +45,11 @@ add_mlir_dialect_python_bindings(MLIRBindingsPythonTensorOps
   DIALECT_NAME tensor)
 add_dependencies(MLIRBindingsPythonSources MLIRBindingsPythonTensorOps)
 
+add_mlir_dialect_python_bindings(MLIRBindingsPythonTosaOps
+  TD_FILE TosaOps.td
+  DIALECT_NAME tosa)
+add_dependencies(MLIRBindingsPythonSources MLIRBindingsPythonTosaOps)
+
 add_mlir_dialect_python_bindings(MLIRBindingsPythonVectorOps
   TD_FILE VectorOps.td
   DIALECT_NAME vector)

diff  --git a/mlir/python/mlir/dialects/TosaOps.td b/mlir/python/mlir/dialects/TosaOps.td
new file mode 100644
index 0000000000000..d906bad7ce620
--- /dev/null
+++ b/mlir/python/mlir/dialects/TosaOps.td
@@ -0,0 +1,15 @@
+//===-- TosaOps.td - Entry point for TosaOps bind ----------*- 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_TOSA_OPS
+#define PYTHON_BINDINGS_TOSA_OPS
+
+include "mlir/Bindings/Python/Attributes.td"
+include "mlir/Dialect/Tosa/IR/TosaOps.td"
+
+#endif

diff  --git a/mlir/python/mlir/dialects/tosa.py b/mlir/python/mlir/dialects/tosa.py
new file mode 100644
index 0000000000000..aebda742fde40
--- /dev/null
+++ b/mlir/python/mlir/dialects/tosa.py
@@ -0,0 +1,5 @@
+#  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
+
+from ._tosa_ops_gen import *

diff  --git a/mlir/test/python/dialects/tosa.py b/mlir/test/python/dialects/tosa.py
new file mode 100644
index 0000000000000..29f63e030ee23
--- /dev/null
+++ b/mlir/test/python/dialects/tosa.py
@@ -0,0 +1,8 @@
+# RUN: %PYTHON %s
+
+from mlir.ir import *
+import mlir.dialects.tosa as tosa
+
+
+# Just make sure the dialect is populated with generated ops.
+assert tosa.AddOp


        


More information about the Mlir-commits mailing list