[Mlir-commits] [mlir] 93a6b49 - [mlir][python] provide bindings for ops from the sparse_tensor dialect
Alex Zinenko
llvmlistbot at llvm.org
Thu Sep 30 06:53:23 PDT 2021
Author: Alex Zinenko
Date: 2021-09-30T15:53:16+02:00
New Revision: 93a6b49d38af236a964492ac6de71d71e93a89a6
URL: https://github.com/llvm/llvm-project/commit/93a6b49d38af236a964492ac6de71d71e93a89a6
DIFF: https://github.com/llvm/llvm-project/commit/93a6b49d38af236a964492ac6de71d71e93a89a6.diff
LOG: [mlir][python] provide bindings for ops from the sparse_tensor dialect
Previously, the dialect was exposed for linking and pass management purposes,
but we did not generate op classes for it. Generate them.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D110819
Added:
mlir/python/mlir/dialects/SparseTensorOps.td
Modified:
mlir/python/CMakeLists.txt
mlir/python/mlir/dialects/sparse_tensor.py
Removed:
################################################################################
diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt
index 2ab3a9af12a93..eb7e1e40d3f18 100644
--- a/mlir/python/CMakeLists.txt
+++ b/mlir/python/CMakeLists.txt
@@ -128,6 +128,7 @@ declare_mlir_dialect_python_bindings(
declare_mlir_dialect_python_bindings(
ADD_TO_PARENT MLIRPythonSources.Dialects
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
+ TD_FILE dialects/SparseTensorOps.td
SOURCES dialects/sparse_tensor.py
DIALECT_NAME sparse_tensor)
diff --git a/mlir/python/mlir/dialects/SparseTensorOps.td b/mlir/python/mlir/dialects/SparseTensorOps.td
new file mode 100644
index 0000000000000..b3b4846dbd333
--- /dev/null
+++ b/mlir/python/mlir/dialects/SparseTensorOps.td
@@ -0,0 +1,15 @@
+//===-- SparseTensorOps.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_SPARSE_TENSOR_OPS
+#define PYTHON_BINDINGS_SPARSE_TENSOR_OPS
+
+include "mlir/Bindings/Python/Attributes.td"
+include "mlir/Dialect/SparseTensor/IR/SparseTensorOps.td"
+
+#endif
diff --git a/mlir/python/mlir/dialects/sparse_tensor.py b/mlir/python/mlir/dialects/sparse_tensor.py
index 4a89ef8ae0532..4f6b675ec9e55 100644
--- a/mlir/python/mlir/dialects/sparse_tensor.py
+++ b/mlir/python/mlir/dialects/sparse_tensor.py
@@ -2,5 +2,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+from ._sparse_tensor_ops_gen import *
from .._mlir_libs._mlir.dialects.sparse_tensor import *
from .._mlir_libs import _mlirSparseTensorPasses as _cextSparseTensorPasses
More information about the Mlir-commits
mailing list