2022-04-07 02:20:39 +08:00
|
|
|
# This file is licensed 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
|
|
|
|
|
2022-08-19 13:42:58 +08:00
|
|
|
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
2022-11-16 04:34:27 +08:00
|
|
|
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
|
2022-04-07 02:20:39 +08:00
|
|
|
|
|
|
|
package(
|
|
|
|
default_visibility = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"//visibility:public",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-11-16 04:34:27 +08:00
|
|
|
# Format bazel BUILD and .bzl files with a standard convention
|
|
|
|
# Invoke as `bazel run @torch-mlir//:buildifier`
|
|
|
|
buildifier(
|
|
|
|
name = "buildifier",
|
|
|
|
)
|
|
|
|
|
2022-04-07 02:20:39 +08:00
|
|
|
# Torch Dialect/IR
|
|
|
|
td_library(
|
|
|
|
name = "MLIRTorchOpsIncGenTdFiles",
|
2023-01-12 06:18:35 +08:00
|
|
|
srcs = glob([
|
|
|
|
"include/torch-mlir/Dialect/Torch/IR/*.td",
|
|
|
|
]),
|
2022-04-07 02:20:39 +08:00
|
|
|
includes = ["include"],
|
|
|
|
deps = [
|
|
|
|
"@llvm-project//mlir:CastInterfacesTdFiles",
|
|
|
|
"@llvm-project//mlir:ControlFlowInterfacesTdFiles",
|
|
|
|
"@llvm-project//mlir:InferTypeOpInterfaceTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
|
|
"@llvm-project//mlir:SideEffectInterfacesTdFiles",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "MLIRTorchOpsIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-op-decls"],
|
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchOps.h.inc",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-op-defs"],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchOps.cpp.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
[
|
|
|
|
"-gen-dialect-decls",
|
|
|
|
"-dialect=torch",
|
|
|
|
],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchDialect.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
[
|
|
|
|
"-gen-dialect-defs",
|
|
|
|
"-dialect=torch",
|
|
|
|
],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchDialect.cpp.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
|
|
td_file = "include/torch-mlir/Dialect/Torch/IR/TorchOps.td",
|
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":MLIRTorchOpsIncGenTdFiles",
|
2024-06-07 20:02:17 +08:00
|
|
|
"@llvm-project//mlir:BuiltinDialectTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "MLIRTorchTypesIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-typedef-decls"],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTypes.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-typedef-defs"],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTypes.cpp.inc",
|
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
|
|
td_file = "include/torch-mlir/Dialect/Torch/IR/TorchTypes.td",
|
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":MLIRTorchOpsIncGenTdFiles",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchDialectUtils",
|
|
|
|
srcs = [
|
2024-05-16 01:09:27 +08:00
|
|
|
"lib/Dialect/Torch/Utils/SparsityUtils.cpp",
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/Dialect/Torch/Utils/TorchUpstream.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
"lib/Dialect/Torch/Utils/Utils.cpp",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchOps.h",
|
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTraits.h",
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTypes.h",
|
2024-05-16 01:09:27 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/Utils/SparsityUtils.h",
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h",
|
|
|
|
"include/torch-mlir/Dialect/Torch/Utils/Utils.h",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
2022-08-19 13:42:58 +08:00
|
|
|
strip_include_prefix = "include",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":MLIRTorchOpsIncGen",
|
|
|
|
":MLIRTorchTypesIncGen",
|
2023-06-29 23:45:35 +08:00
|
|
|
"@llvm-project//mlir:CastInterfaces",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:ControlFlowInterfaces",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:IR",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:InferTypeOpInterface",
|
2024-05-17 12:44:46 +08:00
|
|
|
"@llvm-project//mlir:SparseTensorDialect",
|
|
|
|
"@llvm-project//mlir:SparseTensorEnums",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchDialect",
|
|
|
|
srcs = [
|
|
|
|
"lib/Dialect/Torch/IR/TorchDialect.cpp",
|
|
|
|
"lib/Dialect/Torch/IR/TorchOps.cpp",
|
|
|
|
"lib/Dialect/Torch/IR/TorchOpsODSGenerated.cpp",
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/Dialect/Torch/IR/TorchTypes.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
"lib/Dialect/Torch/IR/UtilsForODSGenerated.cpp",
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/Dialect/Torch/IR/UtilsForODSGenerated.h",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
hdrs = glob([
|
|
|
|
"include/torch-mlir/Dialect/Torch/IR/*.h",
|
|
|
|
]),
|
|
|
|
includes = ["include"],
|
|
|
|
deps = [
|
|
|
|
":MLIRTorchOpsIncGen",
|
|
|
|
":MLIRTorchTypesIncGen",
|
|
|
|
":TorchMLIRTorchDialectUtils",
|
|
|
|
"@llvm-project//mlir:ControlFlowInterfaces",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:FuncDialect",
|
|
|
|
"@llvm-project//mlir:IR",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:InferTypeOpInterface",
|
2024-01-26 04:54:40 +08:00
|
|
|
"@llvm-project//mlir:SparseTensorDialect",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:TransformUtils",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Torch Dialect/Transforms
|
|
|
|
td_library(
|
|
|
|
name = "TorchMLIRTorchPassesTdFiles",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/Torch/Transforms/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
includes = ["include"],
|
|
|
|
deps = [
|
|
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRTorchPassesIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-pass-decls"],
|
|
|
|
"include/torch-mlir/Dialect/Torch/Transforms/Passes.h.inc",
|
2022-08-19 13:42:58 +08:00
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2022-08-19 13:42:58 +08:00
|
|
|
td_file = "include/torch-mlir/Dialect/Torch/Transforms/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":TorchMLIRTorchPassesTdFiles",
|
|
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchPasses",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Dialect/Torch/Transforms/*.cpp",
|
|
|
|
"lib/Dialect/Torch/Transforms/*.h",
|
|
|
|
]),
|
2022-04-07 02:20:39 +08:00
|
|
|
hdrs = [
|
|
|
|
"include/torch-mlir/Dialect/Torch/Transforms/Passes.h",
|
|
|
|
],
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
2024-03-27 10:22:42 +08:00
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTorchDialect",
|
|
|
|
":TorchMLIRTorchPassesIncGen",
|
|
|
|
"@llvm-project//mlir:FuncDialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:IR",
|
|
|
|
"@llvm-project//mlir:Parser",
|
|
|
|
"@llvm-project//mlir:Pass",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:Transforms",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# TorchConversion diaelct
|
|
|
|
td_library(
|
|
|
|
name = "MLIRTorchConversionOpsTdFiles",
|
|
|
|
srcs = [
|
|
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionBase.td",
|
|
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.td",
|
|
|
|
],
|
|
|
|
includes = ["include"],
|
|
|
|
deps = [
|
|
|
|
":MLIRTorchOpsIncGenTdFiles",
|
2022-04-27 10:21:52 +08:00
|
|
|
"@llvm-project//mlir:AttrTdFiles",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:CastInterfacesTdFiles",
|
|
|
|
"@llvm-project//mlir:ControlFlowInterfacesTdFiles",
|
|
|
|
"@llvm-project//mlir:InferTypeOpInterfaceTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
|
|
"@llvm-project//mlir:SideEffectInterfacesTdFiles",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "MLIRTorchConversionOpsIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-op-decls"],
|
|
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.h.inc",
|
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-op-defs"],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.cpp.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
[
|
|
|
|
"-gen-dialect-decls",
|
|
|
|
"-dialect=torch_c",
|
|
|
|
],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionDialect.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
[
|
|
|
|
"-gen-dialect-defs",
|
|
|
|
"-dialect=torch_c",
|
|
|
|
],
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionDialect.cpp.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
|
|
td_file = "include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.td",
|
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":MLIRTorchConversionOpsTdFiles",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchConversionDialect",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob(["lib/Dialect/TorchConversion/IR/*.cpp"]),
|
|
|
|
hdrs = glob(["include/torch-mlir/Dialect/TorchConversion/IR/*.h"]),
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":MLIRTorchConversionOpsIncGen",
|
|
|
|
":TorchMLIRTorchDialect",
|
|
|
|
"@llvm-project//mlir:IR",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:InferTypeOpInterface",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Conversion
|
|
|
|
td_library(
|
|
|
|
name = "TorchMLIRConversionPassesTdFiles",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Conversion/Passes.td",
|
|
|
|
],
|
|
|
|
includes = ["include"],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRConversionPassesIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
2022-08-19 13:42:58 +08:00
|
|
|
[
|
|
|
|
"-gen-pass-decls",
|
2023-02-02 21:29:47 +08:00
|
|
|
"-DTORCH_MLIR_ENABLE_STABLEHLO",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
"include/torch-mlir/Conversion/Passes.h.inc",
|
2022-08-19 13:42:58 +08:00
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2022-08-19 13:42:58 +08:00
|
|
|
td_file = "include/torch-mlir/Conversion/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionPassesTdFiles",
|
|
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
2023-11-29 05:06:35 +08:00
|
|
|
td_library(
|
|
|
|
name = "TorchMLIRConversionTorchOnnxToTorchPassTdFiles",
|
|
|
|
srcs = [
|
|
|
|
"include/torch-mlir/Conversion/TorchOnnxToTorch/Passes.td",
|
|
|
|
],
|
|
|
|
includes = ["include"],
|
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRConversionTorchOnnxToTorchPassIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-pass-decls"],
|
|
|
|
"include/torch-mlir/Conversion/TorchOnnxToTorch/Passes.h.inc",
|
|
|
|
),
|
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
|
|
td_file = "include/torch-mlir/Conversion/TorchOnnxToTorch/Passes.td",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionTorchOnnxToTorchPassTdFiles",
|
|
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-04-07 02:20:39 +08:00
|
|
|
# TorchConversion transforms
|
|
|
|
td_library(
|
|
|
|
name = "TorchMLIRTorchConversionPassesTdFiles",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
2022-08-19 13:42:58 +08:00
|
|
|
|
2022-04-07 02:20:39 +08:00
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRTorchConversionPassesIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
2024-06-04 15:50:29 +08:00
|
|
|
[
|
|
|
|
"-gen-pass-decls",
|
|
|
|
"-DTORCH_MLIR_ENABLE_STABLEHLO",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.h.inc",
|
2022-08-19 13:42:58 +08:00
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2022-08-19 13:42:58 +08:00
|
|
|
td_file = "include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":TorchMLIRTorchConversionPassesTdFiles",
|
|
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRConversionUtils",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/Conversion/Utils/Utils.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
hdrs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Conversion/Utils/Utils.h",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRTorchDialect",
|
2022-10-06 14:51:00 +08:00
|
|
|
"@llvm-project//mlir:ArithDialect",
|
2022-06-23 11:50:39 +08:00
|
|
|
"@llvm-project//mlir:ControlFlowDialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:IR",
|
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
|
|
"@llvm-project//mlir:Transforms",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchToLinalg",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
|
|
|
"lib/Conversion/TorchToLinalg/*.cpp",
|
|
|
|
"lib/Conversion/TorchToLinalg/*.h",
|
|
|
|
]),
|
|
|
|
hdrs = glob(["include/torch-mlir/Conversion/TorchToLinalg/*.h"]),
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRConversionPassesIncGen",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRConversionUtils",
|
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchDialect",
|
2022-10-06 14:51:00 +08:00
|
|
|
"@llvm-project//mlir:ArithDialect",
|
2022-06-23 11:50:39 +08:00
|
|
|
"@llvm-project//mlir:ControlFlowDialect",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:Dialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
|
|
"@llvm-project//mlir:Pass",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:TensorUtils",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:TransformUtils",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchToSCF",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
|
|
|
"lib/Conversion/TorchToSCF/*.cpp",
|
|
|
|
]),
|
|
|
|
hdrs = glob(["include/torch-mlir/Conversion/TorchToSCF/*.h"]),
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRConversionPassesIncGen",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
2022-10-06 14:51:00 +08:00
|
|
|
"@llvm-project//mlir:ArithDialect",
|
2022-06-23 11:50:39 +08:00
|
|
|
"@llvm-project//mlir:ControlFlowDialect",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:Dialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
|
|
"@llvm-project//mlir:Pass",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:TensorUtils",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:TransformUtils",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
2022-08-11 05:51:13 +08:00
|
|
|
name = "TorchMLIRTorchToArith",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
|
|
|
"lib/Conversion/TorchToArith/*.cpp",
|
|
|
|
]),
|
|
|
|
hdrs = glob([
|
|
|
|
"include/torch-mlir/Conversion/TorchToArith/*.h",
|
|
|
|
]),
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionPassesIncGen",
|
2022-04-28 14:22:27 +08:00
|
|
|
":TorchMLIRConversionUtils",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
"@llvm-project//mlir:Dialect",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
2023-12-17 22:07:43 +08:00
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchToTensor",
|
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
|
|
|
"lib/Conversion/TorchToTensor/*.cpp",
|
|
|
|
]),
|
|
|
|
hdrs = glob([
|
|
|
|
"include/torch-mlir/Conversion/TorchToTensor/*.h",
|
|
|
|
]),
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionPassesIncGen",
|
|
|
|
":TorchMLIRConversionUtils",
|
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
":TorchMLIRTorchDialect",
|
|
|
|
"@llvm-project//mlir:Dialect",
|
|
|
|
"@llvm-project//mlir:IR",
|
|
|
|
"@llvm-project//mlir:Pass",
|
|
|
|
"@llvm-project//mlir:TensorDialect",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-12-09 01:49:54 +08:00
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchConversionToMLProgram",
|
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
|
|
|
"lib/Conversion/TorchConversionToMLProgram/*.cpp",
|
|
|
|
]),
|
|
|
|
hdrs = glob([
|
|
|
|
"include/torch-mlir/Conversion/TorchConversionToMLProgram/*.h",
|
|
|
|
]),
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionPassesIncGen",
|
|
|
|
":TorchMLIRConversionUtils",
|
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
"@llvm-project//mlir:Dialect",
|
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
|
|
"@llvm-project//mlir:MLProgramDialect",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-04-07 02:20:39 +08:00
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchToTMTensor",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
|
|
|
"lib/Conversion/TorchToTMTensor/*.cpp",
|
|
|
|
]),
|
|
|
|
hdrs = glob(["include/torch-mlir/Conversion/TorchToTMTensor/*.h"]),
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionPassesIncGen",
|
|
|
|
":TorchMLIRConversionUtils",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTMTensorDialect",
|
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
2022-07-29 14:24:42 +08:00
|
|
|
cc_library(
|
2023-02-02 21:29:47 +08:00
|
|
|
name = "TorchMLIRTorchToStablehlo",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
2023-02-02 21:29:47 +08:00
|
|
|
"lib/Conversion/TorchToStablehlo/*.h",
|
|
|
|
"lib/Conversion/TorchToStablehlo/*.cpp",
|
2022-10-26 03:23:24 +08:00
|
|
|
]),
|
2023-02-02 21:29:47 +08:00
|
|
|
hdrs = glob(["include/torch-mlir/Conversion/TorchToStablehlo/*.h"]),
|
2024-06-04 15:50:29 +08:00
|
|
|
defines = [
|
|
|
|
"TORCH_MLIR_ENABLE_STABLEHLO",
|
|
|
|
],
|
2022-07-29 14:24:42 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionPassesIncGen",
|
|
|
|
":TorchMLIRConversionUtils",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
"@llvm-project//mlir:Dialect",
|
2023-09-14 23:59:31 +08:00
|
|
|
"@stablehlo//:register",
|
|
|
|
"@stablehlo//:stablehlo_passes",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-07-29 14:24:42 +08:00
|
|
|
)
|
|
|
|
|
2023-11-29 05:06:35 +08:00
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchOnnxToTorch",
|
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/TorchOnnxToTorch/*.h",
|
|
|
|
"lib/Conversion/TorchOnnxToTorch/*.cpp",
|
|
|
|
]),
|
|
|
|
hdrs = glob(["include/torch-mlir/Conversion/TorchOnnxToTorch/*.h"]),
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionTorchOnnxToTorchPassIncGen",
|
|
|
|
":TorchMLIRTorchDialect",
|
|
|
|
"@llvm-project//mlir:IR",
|
|
|
|
"@llvm-project//mlir:Pass",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2022-04-07 02:20:39 +08:00
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRConversionPasses",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/Conversion/Passes.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
hdrs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Conversion/Passes.h",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
2023-02-25 07:07:34 +08:00
|
|
|
defines = [
|
|
|
|
"TORCH_MLIR_ENABLE_STABLEHLO",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
2022-12-09 07:56:57 +08:00
|
|
|
":TorchMLIRTorchConversionToMLProgram",
|
2023-11-29 05:06:35 +08:00
|
|
|
":TorchMLIRTorchOnnxToTorch",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchToArith",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTorchToLinalg",
|
|
|
|
":TorchMLIRTorchToSCF",
|
2023-02-02 21:29:47 +08:00
|
|
|
":TorchMLIRTorchToStablehlo",
|
2022-07-29 14:24:42 +08:00
|
|
|
":TorchMLIRTorchToTMTensor",
|
2023-12-17 22:07:43 +08:00
|
|
|
":TorchMLIRTorchToTensor",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchToTosa",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchConversionPasses",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Dialect/TorchConversion/Transforms/*.cpp",
|
2022-10-27 04:28:00 +08:00
|
|
|
"lib/Dialect/TorchConversion/Transforms/*.h",
|
2022-10-26 03:23:24 +08:00
|
|
|
]),
|
|
|
|
hdrs = glob(["include/torch-mlir/Dialect/TorchConversion/Transforms/*.h"]),
|
2024-06-04 15:50:29 +08:00
|
|
|
defines = [
|
|
|
|
"TORCH_MLIR_ENABLE_STABLEHLO",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
":TorchMLIRTorchConversionPassesIncGen",
|
2022-12-09 07:56:57 +08:00
|
|
|
":TorchMLIRTorchConversionToMLProgram",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTorchDialect",
|
|
|
|
":TorchMLIRTorchPasses",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchToArith",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTorchToLinalg",
|
|
|
|
":TorchMLIRTorchToSCF",
|
2023-02-02 21:29:47 +08:00
|
|
|
":TorchMLIRTorchToStablehlo",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTorchToTMTensor",
|
2024-02-01 14:07:06 +08:00
|
|
|
":TorchMLIRTorchToTensor",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchToTosa",
|
|
|
|
"@llvm-project//mlir:ConversionPasses",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:FuncDialect",
|
2022-06-23 11:50:39 +08:00
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:LinalgTransforms",
|
|
|
|
"@llvm-project//mlir:MemRefDialect",
|
|
|
|
"@llvm-project//mlir:MemRefTransforms",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:Pass",
|
|
|
|
"@llvm-project//mlir:TosaDialect",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchToTosa",
|
2022-10-26 03:23:24 +08:00
|
|
|
srcs = glob([
|
|
|
|
"lib/Conversion/*.h",
|
|
|
|
"lib/Conversion/TorchToTosa/*.cpp",
|
|
|
|
]),
|
|
|
|
hdrs = glob(["include/torch-mlir/Conversion/TorchToTosa/*.h"]),
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRConversionPassesIncGen",
|
2022-12-22 13:27:03 +08:00
|
|
|
":TorchMLIRConversionUtils",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
"@llvm-project//mlir:Dialect",
|
|
|
|
"@llvm-project//mlir:QuantOps",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:TosaDialect",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Dialects.TorchConversion
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTorchBackendTypeConversion",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/Dialect/TorchConversion/Transforms/BackendTypeConversion.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
hdrs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/Dialect/TorchConversion/Transforms/BackendTypeConversion.h",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:FuncTransforms",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
td_library(
|
|
|
|
name = "TorchMLIRTMTensorOpsTdFiles",
|
|
|
|
srcs = [
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td",
|
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorBase.td",
|
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td",
|
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
2023-11-03 23:45:51 +08:00
|
|
|
includes = ["include"],
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:ControlFlowInterfacesTdFiles",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
|
|
"@llvm-project//mlir:SideEffectInterfacesTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRTMTensorInterfacesIncGen",
|
2023-11-03 23:45:51 +08:00
|
|
|
strip_include_prefix = "include",
|
2022-04-07 02:20:39 +08:00
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-op-interface-decls"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterfaces.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-op-interface-defs"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterfaces.cpp.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-type-interface-decls"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorTypeInterfaces.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-type-interface-defs"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorTypeInterfaces.cpp.inc",
|
2022-08-19 13:42:58 +08:00
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2023-11-03 23:45:51 +08:00
|
|
|
td_file = "include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":TorchMLIRTMTensorOpsTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRTMTensorScalarLoopOpInterfaceIncGen",
|
2023-11-03 23:45:51 +08:00
|
|
|
strip_include_prefix = "include",
|
2022-04-07 02:20:39 +08:00
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-op-interface-decls"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-op-interface-defs"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp.inc",
|
2022-08-19 13:42:58 +08:00
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2023-11-03 23:45:51 +08:00
|
|
|
td_file = "include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":TorchMLIRTMTensorOpsTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRTMTensorOpsIncGen",
|
2023-11-03 23:45:51 +08:00
|
|
|
strip_include_prefix = "include",
|
2022-04-07 02:20:39 +08:00
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-op-decls"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-op-defs"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.cpp.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-typedef-decls"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorTypes.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
[
|
|
|
|
"-gen-dialect-decls",
|
2022-08-19 13:42:58 +08:00
|
|
|
"-dialect=tm_tensor",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
[
|
|
|
|
"-gen-dialect-defs",
|
2022-08-19 13:42:58 +08:00
|
|
|
"-dialect=tm_tensor",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.cpp.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2023-11-03 23:45:51 +08:00
|
|
|
td_file = "include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTMTensorOpsTdFiles",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTMTensorDialect",
|
2022-10-27 04:28:00 +08:00
|
|
|
srcs = [
|
2023-11-03 23:45:51 +08:00
|
|
|
"lib/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp",
|
|
|
|
"lib/Dialect/TMTensor/IR/TMTensorDialect.cpp",
|
|
|
|
"lib/Dialect/TMTensor/IR/TMTensorInterfaces.cpp",
|
|
|
|
"lib/Dialect/TMTensor/IR/TMTensorOps.cpp",
|
2022-10-27 04:28:00 +08:00
|
|
|
],
|
|
|
|
hdrs = [
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h",
|
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h",
|
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.h",
|
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h",
|
2022-10-27 04:28:00 +08:00
|
|
|
],
|
2023-11-03 23:45:51 +08:00
|
|
|
strip_include_prefix = "include",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTMTensorInterfacesIncGen",
|
2022-04-07 02:20:39 +08:00
|
|
|
":TorchMLIRTMTensorOpsIncGen",
|
|
|
|
":TorchMLIRTMTensorScalarLoopOpInterfaceIncGen",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:AffineDialect",
|
|
|
|
"@llvm-project//mlir:ControlFlowInterfaces",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:Dialect",
|
|
|
|
"@llvm-project//mlir:DialectUtils",
|
[Bazel] Use bazel 6 to support dict select union (#3100)
Bazel builds broke with the recent LLVM bump due to union select of
dictionaries:
```bazel
substitutions = {
"#cmakedefine01 MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE": "#define MLIR_DEPRECATED_GPU_SERIALIZATION_ENABLE 0",
"#cmakedefine01 MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS": "#define MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS 0",
"#cmakedefine MLIR_GREEDY_REWRITE_RANDOMIZER_SEED ${MLIR_GREEDY_REWRITE_RANDOMIZER_SEED}": "/* #undef MLIR_GREEDY_REWRITE_RANDOMIZER_SEED */",
"#cmakedefine01 MLIR_ENABLE_NVPTXCOMPILER": "#define MLIR_ENABLE_NVPTXCOMPILER 0",
"#cmakedefine01 MLIR_ENABLE_PDL_IN_PATTERNMATCH": "#define MLIR_ENABLE_PDL_IN_PATTERNMATCH 1",
"#cmakedefine01 MLIR_ENABLE_ROCM_CONVERSIONS": "#define MLIR_ENABLE_ROCM_CONVERSIONS 0",
} | if_cuda_available(
{"#cmakedefine01 MLIR_ENABLE_CUDA_CONVERSIONS": "#define MLIR_ENABLE_CUDA_CONVERSIONS 1"},
{"#cmakedefine01 MLIR_ENABLE_CUDA_CONVERSIONS": "#define MLIR_ENABLE_CUDA_CONVERSIONS 0"},
),
```
```
Analyzing: target @torch-mlir//:torch-mlir-opt (1 packages loaded, 0 targets configured)
ERROR: Traceback (most recent call last):
File "/root/.cache/bazel/_bazel_root/b89349c08f7224396763d[14](https://github.com/llvm/torch-mlir/actions/runs/8515127977/job/23322023669#step:8:15)fe35cba11/external/llvm-project/mlir/BUILD.bazel", line 41, column 7, in <toplevel>
} | if_cuda_available(
Error: unsupported binary operation: dict | select
```
Bazel 6 supports dict select union
https://github.com/bazelbuild/bazel/commit/ebae4860db44c754d41768698024732979132705
after starlark added support for union over dictionaries. This PR bumps
bazel to 6.4, and adds a missing dep.
torch-mlir's bazel build:
https://github.com/sjain-stanford/torch-mlir/actions/runs/8530438588/job/23368225180
2024-04-03 06:51:01 +08:00
|
|
|
"@llvm-project//mlir:FuncDialect",
|
2022-06-23 11:50:39 +08:00
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:ViewLikeInterface",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
td_library(
|
|
|
|
name = "TorchMLIRTMTensorTransformsPassesTdFiles",
|
|
|
|
srcs = [
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRTMTensorTransformsPassesIncGen",
|
2023-11-03 23:45:51 +08:00
|
|
|
strip_include_prefix = "include",
|
2022-04-07 02:20:39 +08:00
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-pass-decls"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-pass-capi-header"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h.cpi.inc",
|
2022-04-07 02:20:39 +08:00
|
|
|
),
|
|
|
|
(
|
|
|
|
["-gen-pass-capi-impl"],
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.cpi.cpp.inc",
|
2022-08-19 13:42:58 +08:00
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2023-11-03 23:45:51 +08:00
|
|
|
td_file = "include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTMTensorTransformsPassesTdFiles",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRTMTensorPasses",
|
2022-10-27 04:28:00 +08:00
|
|
|
srcs = [
|
2023-11-03 23:45:51 +08:00
|
|
|
"lib/Dialect/TMTensor/Transforms/Bufferize.cpp",
|
|
|
|
"lib/Dialect/TMTensor/Transforms/ConvertToLoops.cpp",
|
|
|
|
"lib/Dialect/TMTensor/Transforms/Passes.cpp",
|
2022-10-27 04:28:00 +08:00
|
|
|
],
|
|
|
|
hdrs = [
|
2023-11-03 23:45:51 +08:00
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/Transforms/PassDetail.h",
|
|
|
|
"include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h",
|
2022-10-27 04:28:00 +08:00
|
|
|
],
|
2023-11-03 23:45:51 +08:00
|
|
|
strip_include_prefix = "include",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":TorchMLIRTMTensorDialect",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTMTensorTransformsPassesIncGen",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:BufferizationTransforms",
|
|
|
|
"@llvm-project//mlir:FuncTransforms",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
|
|
"@llvm-project//mlir:LinalgTransforms",
|
|
|
|
"@llvm-project//mlir:Pass",
|
|
|
|
"@llvm-project//mlir:Transforms",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# RefBackend
|
|
|
|
filegroup(
|
|
|
|
name = "TorchMLIRRefBackendPassesDetails",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/RefBackend/PassDetail.h",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
td_library(
|
|
|
|
name = "TorchMLIRRefBackendPassTdFiles",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/RefBackend/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
gentbl_cc_library(
|
|
|
|
name = "TorchMLIRRefBackendPassIncGen",
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
tbl_outs = [
|
|
|
|
(
|
|
|
|
["-gen-pass-decls"],
|
|
|
|
"include/torch-mlir/RefBackend/Passes.h.inc",
|
2022-08-19 13:42:58 +08:00
|
|
|
),
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
2022-08-19 13:42:58 +08:00
|
|
|
td_file = "include/torch-mlir/RefBackend/Passes.td",
|
2022-04-07 02:20:39 +08:00
|
|
|
deps = [
|
|
|
|
":TorchMLIRRefBackendPassTdFiles",
|
|
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRRefBackendPass",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/RefBackend/RefBackend.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
] + [":TorchMLIRRefBackendPassesDetails"],
|
|
|
|
hdrs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/RefBackend/Passes.h",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRRefBackendPassIncGen",
|
|
|
|
":TorchMLIRTorchBackendTypeConversion",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTorchConversionDialect",
|
2022-10-06 14:51:00 +08:00
|
|
|
"@llvm-project//mlir:ArithTransforms",
|
2022-06-23 11:50:39 +08:00
|
|
|
"@llvm-project//mlir:LinalgDialect",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:LinalgTransforms",
|
2022-12-09 07:56:57 +08:00
|
|
|
"@llvm-project//mlir:MLProgramDialect",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:MathTransforms",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:MemRefDialect",
|
|
|
|
"@llvm-project//mlir:Pass",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "TorchMLIRInitAll",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"lib/InitAll.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
hdrs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"include/torch-mlir/InitAll.h",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
2024-02-16 01:38:13 +08:00
|
|
|
copts = [
|
|
|
|
"-DTORCH_MLIR_ENABLE_REFBACKEND",
|
|
|
|
"-DTORCH_MLIR_ENABLE_STABLEHLO",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRConversionPasses",
|
|
|
|
":TorchMLIRRefBackendPass",
|
2022-08-19 13:42:58 +08:00
|
|
|
":TorchMLIRTMTensorDialect",
|
|
|
|
":TorchMLIRTMTensorPasses",
|
|
|
|
":TorchMLIRTorchConversionDialect",
|
|
|
|
":TorchMLIRTorchConversionPasses",
|
|
|
|
":TorchMLIRTorchDialect",
|
|
|
|
":TorchMLIRTorchPasses",
|
2023-07-24 12:38:56 +08:00
|
|
|
"@llvm-project//mlir:AllExtensions",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:Dialect",
|
|
|
|
"@llvm-project//mlir:DialectUtils",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:IR",
|
2024-06-04 15:50:29 +08:00
|
|
|
"@llvm-project//mlir:TensorInferTypeOpInterfaceImpl",
|
2024-02-16 01:38:13 +08:00
|
|
|
"@stablehlo//:linalg_passes",
|
2024-02-16 01:56:09 +08:00
|
|
|
"@stablehlo//:stablehlo_passes",
|
2022-08-19 13:42:58 +08:00
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# tools
|
|
|
|
cc_binary(
|
|
|
|
name = "torch-mlir-opt",
|
|
|
|
srcs = [
|
2022-08-19 13:42:58 +08:00
|
|
|
"tools/torch-mlir-opt/torch-mlir-opt.cpp",
|
2022-04-07 02:20:39 +08:00
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":TorchMLIRInitAll",
|
|
|
|
":TorchMLIRTorchDialect",
|
|
|
|
":TorchMLIRTorchPasses",
|
2023-06-29 23:45:35 +08:00
|
|
|
"@llvm-project//mlir:AllExtensions",
|
2022-04-07 02:20:39 +08:00
|
|
|
"@llvm-project//mlir:AllPassesAndDialects",
|
2022-08-19 13:42:58 +08:00
|
|
|
"@llvm-project//mlir:MlirOptLib",
|
|
|
|
],
|
2022-04-07 02:20:39 +08:00
|
|
|
)
|