Skip to content

Commit bd17556

Browse files
[mlir][memref][transform][python] Create .td file for bindings.
This patch creates the .td files for the Python bindings of the transform ops of the MemRef dialect and integrates them into the build systems (CMake and Bazel). Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D156536
1 parent 259d56d commit bd17556

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

mlir/python/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ declare_mlir_dialect_extension_python_bindings(
164164
DIALECT_NAME transform
165165
EXTENSION_NAME loop_transform)
166166

167+
declare_mlir_dialect_extension_python_bindings(
168+
ADD_TO_PARENT MLIRPythonSources.Dialects
169+
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
170+
TD_FILE dialects/MemRefTransformOps.td
171+
SOURCES
172+
dialects/transform/memref.py
173+
DIALECT_NAME transform
174+
EXTENSION_NAME memref_transform)
175+
167176
declare_mlir_dialect_extension_python_bindings(
168177
ADD_TO_PARENT MLIRPythonSources.Dialects
169178
ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/mlir"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- MemRefTransformOps.td - Memref transform ops -------*- 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_MEMREF_TRANSFORM_OPS
10+
#define PYTHON_BINDINGS_MEMREF_TRANSFORM_OPS
11+
12+
include "mlir/Dialect/MemRef/TransformOps/MemRefTransformOps.td"
13+
14+
#endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
from .._memref_transform_ops_gen import *

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,25 @@ gentbl_filegroup(
841841
],
842842
)
843843

844+
gentbl_filegroup(
845+
name = "MemRefTransformOpsPyGen",
846+
tbl_outs = [
847+
(
848+
[
849+
"-gen-python-op-bindings",
850+
"-bind-dialect=transform",
851+
"-dialect-extension=memref_transform",
852+
],
853+
"mlir/dialects/_memref_transform_ops_gen.py",
854+
),
855+
],
856+
tblgen = "//mlir:mlir-tblgen",
857+
td_file = "mlir/dialects/MemRefTransformOps.td",
858+
deps = [
859+
"//mlir:MemRefTransformOpsTdFiles",
860+
],
861+
)
862+
844863
gentbl_filegroup(
845864
name = "PDLTransformOpsPyGen",
846865
tbl_outs = [
@@ -876,6 +895,7 @@ filegroup(
876895
":BufferizationTransformOpsPyGen",
877896
":GPUTransformOpsPyGen",
878897
":LoopTransformOpsPyGen",
898+
":MemRefTransformOpsPyGen",
879899
":PDLTransformOpsPyGen",
880900
":StructuredTransformOpsPyGen",
881901
":TransformOpsPyGen",

0 commit comments

Comments
 (0)