update bazel for python binding

This commit is contained in:
Yijia Gu 2023-08-23 17:50:29 -07:00
parent 8ce75acd1a
commit ad7e6e90c2
6 changed files with 233 additions and 11 deletions

View File

@ -0,0 +1,14 @@
//===-- BufferizationEnums.td - Entry point for BufferizationEnums bindings ---===//
//
// 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_BUFFERIZATION_ENUMS
#define PYTHON_BINDINGS_BUFFERIZATION_ENUMS
include "mlir/Dialect/Bufferization/IR/BufferizationEnums.td"
#endif // PYTHON_BINDINGS_BUFFERIZATION_ENUMS

View File

@ -0,0 +1,20 @@
//===-- LinalgStructuredTransformEnums.td --------------------*- 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
//
//===----------------------------------------------------------------------===//
//
// Entry point of the Python bindings generator for the structured transform ops
// provided by Linalg (and other dialects).
//
//===----------------------------------------------------------------------===//
#ifndef PYTHON_BINDINGS_LINALG_STRUCTURED_TRANSFORM_ENUMS
#define PYTHON_BINDINGS_LINALG_STRUCTURED_TRANSFORM_ENUMS
include "mlir/Dialect/Linalg/TransformOps/LinalgTransformEnums.td"
#endif // PYTHON_BINDINGS_LINALG_STRUCTURED_TRANSFORM_ENUMS

View File

@ -0,0 +1,14 @@
//===-- SparseTensorAttrDefs.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_ATTR_DEFS
#define PYTHON_BINDINGS_SPARSE_TENSOR_ATTR_DEFS
include "mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.td"
#endif // PYTHON_BINDINGS_SPARSE_TENSOR_ATTR_DEFS

View File

@ -0,0 +1,14 @@
//===-- TransformAttrs.td - Transform attrs bind entry point ---*- 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_TRANSFORM_ATTRS
#define PYTHON_BINDINGS_TRANSFORM_ATTRS
include "mlir/Dialect/Transform/IR/TransformAttrs.td"
#endif // PYTHON_BINDINGS_TRANSFORM_ATTRS

View File

@ -0,0 +1,19 @@
//===-- VectorTransformsBase.td ------------------------------*- 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
//
//===----------------------------------------------------------------------===//
//
// Entry point of the Python bindings generator for the vector transform ops.
//
//===----------------------------------------------------------------------===//
#ifndef PYTHON_BINDINGS_VECTORTRANSFORMBASE
#define PYTHON_BINDINGS_VECTORTRANSFORMBASE
include "mlir/Dialect/Vector/Transforms/VectorTransformsBase.td"
#endif // PYTHON_BINDINGS_VECTORTRANSFORMBASE

View File

@ -142,6 +142,13 @@ td_library(
gentbl_filegroup(
name = "AMDGPUOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=amdgpu",
],
"mlir/dialects/_amdgpu_enum_gen.py",
),
(
[
"-gen-python-op-bindings",
@ -184,6 +191,13 @@ td_library(
gentbl_filegroup(
name = "LinalgOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=linalg",
],
"mlir/dialects/_linalg_enum_gen.py",
),
(
[
"-gen-python-op-bindings",
@ -232,6 +246,44 @@ filegroup(
srcs = glob(["mlir/dialects/linalg/passes/*.py"]),
)
##---------------------------------------------------------------------------##
# LLVM dialect.
##---------------------------------------------------------------------------##
gentbl_filegroup(
name = "LLVMOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=llvm",
],
"mlir/dialects/_llvm_enum_gen.py",
),
(
[
"-gen-python-op-bindings",
"-bind-dialect=llvm",
],
"mlir/dialects/_llvm_ops_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/LLVMOps.td",
deps = [
"//mlir:LLVMOpsTdFiles",
"//mlir:OpBaseTdFiles",
],
)
filegroup(
name = "LLVMOpsPyFiles",
srcs = [
"mlir/dialects/llvm.py",
":LLVMOpsPyGen",
],
)
##---------------------------------------------------------------------------##
# Arith dialect.
##---------------------------------------------------------------------------##
@ -239,6 +291,13 @@ filegroup(
gentbl_filegroup(
name = "ArithOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=arith",
],
"mlir/dialects/_arith_enum_gen.py",
),
(
[
"-gen-python-op-bindings",
@ -274,11 +333,30 @@ td_library(
includes = ["../include"],
deps = [
"//mlir:BufferizableOpInterfaceTdFiles",
"//mlir:BufferizationEnumsTdFiles
"//mlir:BufferizationOpsTdFiles",
"//mlir:OpBaseTdFiles",
],
)
gentbl_filegroup(
name = "BufferizationEnumPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=bufferization",
],
"mlir/dialects/_bufferization_enum_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/BufferizationEnums.td",
deps = [
":BufferizationOpsPyTdFiles",
],
)
gentbl_filegroup(
name = "BufferizationOpsPyGen",
tbl_outs = [
@ -302,6 +380,7 @@ filegroup(
srcs = [
"mlir/dialects/_bufferization_ops_ext.py",
"mlir/dialects/bufferization.py",
":BufferizationEnumPyGen",
":BufferizationOpsPyGen",
],
)
@ -568,6 +647,13 @@ td_library(
gentbl_filegroup(
name = "NVGPUOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=nvgpu",
],
"mlir/dialects/_nvgpu_enum_gen.py",
),
(
[
"-gen-python-op-bindings",
@ -608,6 +694,13 @@ td_library(
gentbl_filegroup(
name = "NVVMOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=nvvm",
],
"mlir/dialects/_nvvm_enum_gen.py",
),
(
[
"-gen-python-op-bindings",
@ -790,6 +883,24 @@ td_library(
],
)
gentbl_filegroup(
name = "SparseTensorEnumPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=sparse_tensor",
],
"mlir/dialects/_sparse_tensor_enum_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/SparseTensorAttrDefs.td",
deps = [
":SparseTensorOpsPyTdFiles",
],
)
gentbl_filegroup(
name = "SparseTensorOpsPyGen",
tbl_outs = [
@ -812,6 +923,7 @@ filegroup(
name = "SparseTensorOpsPyFiles",
srcs = [
"mlir/dialects/sparse_tensor.py",
":SparseTensorEnumPyGen",
":SparseTensorOpsPyGen",
],
)
@ -897,12 +1009,15 @@ gentbl_filegroup(
name = "TransformEnumPyGen",
tbl_outs = [
(
["-gen-python-enum-bindings"],
[
"-gen-python-enum-bindings",
"-bind-dialect=transform",
],
"mlir/dialects/_transform_enum_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/TransformOps.td",
td_file = "mlir/dialects/TransformAttrs.td",
deps = [
"//mlir:CallInterfacesTdFiles",
"//mlir:FunctionInterfacesTdFiles",
@ -935,13 +1050,6 @@ gentbl_filegroup(
gentbl_filegroup(
name = "BufferizationTransformOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=transform",
],
"mlir/dialects/_bufferization_transform_enum_gen.py",
),
(
[
"-gen-python-op-bindings",
@ -981,6 +1089,28 @@ gentbl_filegroup(
],
)
gentbl_filegroup(
name = "StructureTransformEnumPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=transform",
],
"mlir/dialects/_structure_transform_enum_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/LinalgStructuredTransformEnums.td",
deps = [
"//mlir:CallInterfacesTdFiles",
"//mlir:FunctionInterfacesTdFiles",
"//mlir:LinalgTransformOpsTdFiles",
"//mlir:OpBaseTdFiles",
"//mlir:TransformDialectTdFiles",
],
)
gentbl_filegroup(
name = "StructuredTransformOpsPyGen",
tbl_outs = [
@ -1092,12 +1222,15 @@ gentbl_filegroup(
name = "VectorTransformEnumPyGen",
tbl_outs = [
(
["-gen-python-enum-bindings"],
[
"-gen-python-enum-bindings",
"-bind-dialect=transform",
],
"mlir/dialects/_vector_transform_enum_gen.py",
),
],
tblgen = "//mlir:mlir-tblgen",
td_file = "mlir/dialects/VectorTransformOps.td",
td_file = "mlir/dialects/VectorTransformsBase.td",
deps = [
"//mlir:OpBaseTdFiles",
"//mlir:TransformDialectTdFiles",
@ -1143,6 +1276,7 @@ filegroup(
":LoopTransformOpsPyGen",
":MemRefTransformOpsPyGen",
":PDLTransformOpsPyGen",
":StructureTransformEnumPyGen",
":StructuredTransformOpsPyGen",
":TensorTransformOpsPyGen",
":TransformEnumPyGen",
@ -1164,6 +1298,13 @@ filegroup(
gentbl_filegroup(
name = "VectorOpsPyGen",
tbl_outs = [
(
[
"-gen-python-enum-bindings",
"-bind-dialect=vector",
],
"mlir/dialects/_vector_enum_gen.py",
),
(
[
"-gen-python-op-bindings",