mirror of https://github.com/llvm/torch-mlir
859 lines
29 KiB
Python
859 lines
29 KiB
Python
# 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
|
|
|
|
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
|
|
|
package(
|
|
default_visibility = [
|
|
"//visibility:public",
|
|
],
|
|
)
|
|
|
|
# Torch Dialect/IR
|
|
td_library(
|
|
name = "MLIRTorchOpsIncGenTdFiles",
|
|
srcs = [
|
|
"include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td",
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchBase.td",
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchOps.td",
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTypes.td",
|
|
],
|
|
includes = ["include"],
|
|
deps = [
|
|
"@llvm-project//mlir:CastInterfacesTdFiles",
|
|
"@llvm-project//mlir:ControlFlowInterfacesTdFiles",
|
|
"@llvm-project//mlir:InferTypeOpInterfaceTdFiles",
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
"@llvm-project//mlir:SideEffectInterfacesTdFiles",
|
|
],
|
|
)
|
|
|
|
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"],
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchOps.cpp.inc",
|
|
),
|
|
(
|
|
[
|
|
"-gen-dialect-decls",
|
|
"-dialect=torch",
|
|
],
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchDialect.h.inc",
|
|
),
|
|
(
|
|
[
|
|
"-gen-dialect-defs",
|
|
"-dialect=torch",
|
|
],
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchDialect.cpp.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "include/torch-mlir/Dialect/Torch/IR/TorchOps.td",
|
|
deps = [
|
|
":MLIRTorchOpsIncGenTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "MLIRTorchTypesIncGen",
|
|
strip_include_prefix = "include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-typedef-decls"],
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTypes.h.inc",
|
|
),
|
|
(
|
|
["-gen-typedef-defs"],
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTypes.cpp.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "include/torch-mlir/Dialect/Torch/IR/TorchTypes.td",
|
|
deps = [
|
|
":MLIRTorchOpsIncGenTdFiles",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchDialectUtils",
|
|
srcs = [
|
|
"lib/Dialect/Torch/Utils/TorchUpstream.cpp",
|
|
"lib/Dialect/Torch/Utils/Utils.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchOps.h",
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTraits.h",
|
|
"include/torch-mlir/Dialect/Torch/IR/TorchTypes.h",
|
|
"include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h",
|
|
"include/torch-mlir/Dialect/Torch/Utils/Utils.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":MLIRTorchOpsIncGen",
|
|
":MLIRTorchTypesIncGen",
|
|
"@llvm-project//mlir:ControlFlowInterfaces",
|
|
"@llvm-project//mlir:IR",
|
|
"@llvm-project//mlir:InferTypeOpInterface",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchDialect",
|
|
srcs = [
|
|
"lib/Dialect/Torch/IR/TorchDialect.cpp",
|
|
"lib/Dialect/Torch/IR/TorchOps.cpp",
|
|
"lib/Dialect/Torch/IR/TorchOpsODSGenerated.cpp",
|
|
"lib/Dialect/Torch/IR/TorchTypes.cpp",
|
|
"lib/Dialect/Torch/IR/UtilsForODSGenerated.cpp",
|
|
"lib/Dialect/Torch/IR/UtilsForODSGenerated.h",
|
|
],
|
|
hdrs = glob([
|
|
"include/torch-mlir/Dialect/Torch/IR/*.h",
|
|
]),
|
|
includes = ["include"],
|
|
deps = [
|
|
":MLIRTorchOpsIncGen",
|
|
":MLIRTorchTypesIncGen",
|
|
":TorchMLIRTorchDialectUtils",
|
|
"@llvm-project//mlir:ControlFlowInterfaces",
|
|
"@llvm-project//mlir:FuncDialect",
|
|
"@llvm-project//mlir:IR",
|
|
"@llvm-project//mlir:InferTypeOpInterface",
|
|
"@llvm-project//mlir:TransformUtils",
|
|
],
|
|
)
|
|
|
|
# Torch Dialect/Transforms
|
|
td_library(
|
|
name = "TorchMLIRTorchPassesTdFiles",
|
|
srcs = [
|
|
"include/torch-mlir/Dialect/Torch/Transforms/Passes.td",
|
|
],
|
|
includes = ["include"],
|
|
deps = [
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRTorchPassesIncGen",
|
|
strip_include_prefix = "include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-pass-decls"],
|
|
"include/torch-mlir/Dialect/Torch/Transforms/Passes.h.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "include/torch-mlir/Dialect/Torch/Transforms/Passes.td",
|
|
deps = [
|
|
":TorchMLIRTorchPassesTdFiles",
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchPasses",
|
|
srcs = [
|
|
"lib/Dialect/Torch/Transforms/AdjustCallingConventions.cpp",
|
|
"lib/Dialect/Torch/Transforms/DecomposeComplexOps.cpp",
|
|
"lib/Dialect/Torch/Transforms/DropShapeCalculations.cpp",
|
|
"lib/Dialect/Torch/Transforms/EraseModuleInitializer.cpp",
|
|
"lib/Dialect/Torch/Transforms/GlobalizeObjectGraph.cpp",
|
|
"lib/Dialect/Torch/Transforms/InlineGlobalSlots.cpp",
|
|
"lib/Dialect/Torch/Transforms/LowerToBackendContract.cpp",
|
|
"lib/Dialect/Torch/Transforms/MaximizeValueSemantics.cpp",
|
|
"lib/Dialect/Torch/Transforms/PassDetail.h",
|
|
"lib/Dialect/Torch/Transforms/Passes.cpp",
|
|
"lib/Dialect/Torch/Transforms/PrepareForGlobalizeObjectGraph.cpp",
|
|
"lib/Dialect/Torch/Transforms/ReduceOpVariants.cpp",
|
|
"lib/Dialect/Torch/Transforms/RefinePublicReturn.cpp",
|
|
"lib/Dialect/Torch/Transforms/RefineTypes.cpp",
|
|
"lib/Dialect/Torch/Transforms/ReifyShapeCalculations.cpp",
|
|
"lib/Dialect/Torch/Transforms/ShapeLibrary.cpp",
|
|
"lib/Dialect/Torch/Transforms/SimplifyShapeCalculations.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Dialect/Torch/Transforms/Passes.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRTorchDialect",
|
|
":TorchMLIRTorchPassesIncGen",
|
|
"@llvm-project//mlir:FuncDialect",
|
|
"@llvm-project//mlir:IR",
|
|
"@llvm-project//mlir:Parser",
|
|
"@llvm-project//mlir:Pass",
|
|
"@llvm-project//mlir:Transforms",
|
|
],
|
|
)
|
|
|
|
# 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",
|
|
"@llvm-project//mlir:AttrTdFiles",
|
|
"@llvm-project//mlir:CastInterfacesTdFiles",
|
|
"@llvm-project//mlir:ControlFlowInterfacesTdFiles",
|
|
"@llvm-project//mlir:InferTypeOpInterfaceTdFiles",
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
"@llvm-project//mlir:SideEffectInterfacesTdFiles",
|
|
],
|
|
)
|
|
|
|
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"],
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.cpp.inc",
|
|
),
|
|
(
|
|
[
|
|
"-gen-dialect-decls",
|
|
"-dialect=torch_c",
|
|
],
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionDialect.h.inc",
|
|
),
|
|
(
|
|
[
|
|
"-gen-dialect-defs",
|
|
"-dialect=torch_c",
|
|
],
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionDialect.cpp.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.td",
|
|
deps = [
|
|
":MLIRTorchConversionOpsTdFiles",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchConversionDialect",
|
|
srcs = [
|
|
"lib/Dialect/TorchConversion/IR/TorchConversionDialect.cpp",
|
|
"lib/Dialect/TorchConversion/IR/TorchConversionOps.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionDialect.h",
|
|
"include/torch-mlir/Dialect/TorchConversion/IR/TorchConversionOps.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":MLIRTorchConversionOpsIncGen",
|
|
":TorchMLIRTorchDialect",
|
|
"@llvm-project//mlir:IR",
|
|
"@llvm-project//mlir:InferTypeOpInterface",
|
|
],
|
|
)
|
|
|
|
# Conversion
|
|
td_library(
|
|
name = "TorchMLIRConversionPassesTdFiles",
|
|
srcs = [
|
|
"include/torch-mlir/Conversion/Passes.td",
|
|
],
|
|
includes = ["include"],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRConversionPassesIncGen",
|
|
strip_include_prefix = "include",
|
|
tbl_outs = [
|
|
(
|
|
[
|
|
"-gen-pass-decls",
|
|
"-DTORCH_MLIR_ENABLE_MHLO",
|
|
],
|
|
"include/torch-mlir/Conversion/Passes.h.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "include/torch-mlir/Conversion/Passes.td",
|
|
deps = [
|
|
":TorchMLIRConversionPassesTdFiles",
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
# TorchConversion transforms
|
|
td_library(
|
|
name = "TorchMLIRTorchConversionPassesTdFiles",
|
|
srcs = [
|
|
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.td",
|
|
],
|
|
deps = [
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRTorchConversionPassesIncGen",
|
|
strip_include_prefix = "include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-pass-decls"],
|
|
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.h.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.td",
|
|
deps = [
|
|
":TorchMLIRTorchConversionPassesTdFiles",
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRConversionUtils",
|
|
srcs = [
|
|
"lib/Conversion/Utils/Utils.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/Utils/Utils.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRTorchDialect",
|
|
"@llvm-project//mlir:ArithmeticDialect",
|
|
"@llvm-project//mlir:ControlFlowDialect",
|
|
"@llvm-project//mlir:IR",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
"@llvm-project//mlir:Transforms",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchToLinalg",
|
|
srcs = [
|
|
"lib/Conversion/PassDetail.h",
|
|
"lib/Conversion/TorchToLinalg/DataMovement.cpp",
|
|
"lib/Conversion/TorchToLinalg/IndirectDataMovement.cpp",
|
|
"lib/Conversion/TorchToLinalg/Linear.cpp",
|
|
"lib/Conversion/TorchToLinalg/Pooling.cpp",
|
|
"lib/Conversion/TorchToLinalg/PopulatePatterns.h",
|
|
"lib/Conversion/TorchToLinalg/Random.cpp",
|
|
"lib/Conversion/TorchToLinalg/Reduction.cpp",
|
|
"lib/Conversion/TorchToLinalg/TensorConstructors.cpp",
|
|
"lib/Conversion/TorchToLinalg/TensorScalarInterop.cpp",
|
|
"lib/Conversion/TorchToLinalg/TorchToLinalg.cpp",
|
|
"lib/Conversion/TorchToLinalg/Uncategorized.cpp",
|
|
"lib/Conversion/TorchToLinalg/Utils.cpp",
|
|
"lib/Conversion/TorchToLinalg/Utils.h",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/TorchToLinalg/TorchToLinalg.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRConversionPassesIncGen",
|
|
":TorchMLIRConversionUtils",
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
":TorchMLIRTorchDialect",
|
|
"@llvm-project//mlir:ArithmeticDialect",
|
|
"@llvm-project//mlir:ControlFlowDialect",
|
|
"@llvm-project//mlir:Dialect",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
"@llvm-project//mlir:Pass",
|
|
"@llvm-project//mlir:TensorUtils",
|
|
"@llvm-project//mlir:TransformUtils",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchToSCF",
|
|
srcs = [
|
|
"lib/Conversion/PassDetail.h",
|
|
"lib/Conversion/TorchToSCF/TorchToSCF.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/TorchToSCF/TorchToSCF.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRConversionPassesIncGen",
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
"@llvm-project//mlir:ArithmeticDialect",
|
|
"@llvm-project//mlir:ControlFlowDialect",
|
|
"@llvm-project//mlir:Dialect",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
"@llvm-project//mlir:Pass",
|
|
"@llvm-project//mlir:TensorUtils",
|
|
"@llvm-project//mlir:TransformUtils",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchToArith",
|
|
srcs = [
|
|
"lib/Conversion/PassDetail.h",
|
|
"lib/Conversion/TorchToArith/TorchToArith.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/TorchToArith/TorchToArith.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRConversionPassesIncGen",
|
|
":TorchMLIRConversionUtils",
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
"@llvm-project//mlir:Dialect",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchToTMTensor",
|
|
srcs = [
|
|
"lib/Conversion/PassDetail.h",
|
|
"lib/Conversion/TorchToTMTensor/TorchToTMTensor.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/TorchToTMTensor/TorchToTMTensor.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRConversionPassesIncGen",
|
|
":TorchMLIRConversionUtils",
|
|
":TorchMLIRTMTensorDialect",
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchToMhlo",
|
|
srcs = [
|
|
"lib/Conversion/PassDetail.h",
|
|
"lib/Conversion/TorchToMhlo/Basic.cpp",
|
|
"lib/Conversion/TorchToMhlo/Gather.cpp",
|
|
"lib/Conversion/TorchToMhlo/Linear.cpp",
|
|
"lib/Conversion/TorchToMhlo/MhloLegalizeUtils.cpp",
|
|
"lib/Conversion/TorchToMhlo/MhloLegalizeUtils.h",
|
|
"lib/Conversion/TorchToMhlo/Pooling.cpp",
|
|
"lib/Conversion/TorchToMhlo/PopulatePatterns.h",
|
|
"lib/Conversion/TorchToMhlo/Reduction.cpp",
|
|
"lib/Conversion/TorchToMhlo/TorchToMhlo.cpp",
|
|
"lib/Conversion/TorchToMhlo/ViewLike.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/TorchToMhlo/TorchToMhlo.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRConversionPassesIncGen",
|
|
":TorchMLIRConversionUtils",
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
"@llvm-project//mlir:Dialect",
|
|
"@mlir-hlo//:mlir_hlo",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRConversionPasses",
|
|
srcs = [
|
|
"lib/Conversion/Passes.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/Passes.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRTorchToArith",
|
|
":TorchMLIRTorchToLinalg",
|
|
":TorchMLIRTorchToMhlo",
|
|
":TorchMLIRTorchToSCF",
|
|
":TorchMLIRTorchToTMTensor",
|
|
":TorchMLIRTorchToTosa",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchConversionPasses",
|
|
srcs = [
|
|
"lib/Dialect/TorchConversion/Transforms/BackendTypeConversionPasses.cpp",
|
|
"lib/Dialect/TorchConversion/Transforms/PassDetail.h",
|
|
"lib/Dialect/TorchConversion/Transforms/Passes.cpp",
|
|
"lib/Dialect/TorchConversion/Transforms/VerifyInvariantsBeforeBackendLowering.cpp",
|
|
"lib/Dialect/TorchConversion/Transforms/VerifyLinalgOnTensorsBackendContract.cpp",
|
|
"lib/Dialect/TorchConversion/Transforms/VerifyTosaBackendContract.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Dialect/TorchConversion/Transforms/Passes.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
":TorchMLIRTorchConversionPassesIncGen",
|
|
":TorchMLIRTorchDialect",
|
|
":TorchMLIRTorchPasses",
|
|
":TorchMLIRTorchToArith",
|
|
":TorchMLIRTorchToLinalg",
|
|
":TorchMLIRTorchToMhlo",
|
|
":TorchMLIRTorchToSCF",
|
|
":TorchMLIRTorchToTMTensor",
|
|
":TorchMLIRTorchToTosa",
|
|
"@llvm-project//mlir:ConversionPasses",
|
|
"@llvm-project//mlir:FuncDialect",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
"@llvm-project//mlir:LinalgTransforms",
|
|
"@llvm-project//mlir:MemRefDialect",
|
|
"@llvm-project//mlir:MemRefTransforms",
|
|
"@llvm-project//mlir:Pass",
|
|
"@llvm-project//mlir:TosaDialect",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTorchToTosa",
|
|
srcs = [
|
|
"lib/Conversion/PassDetail.h",
|
|
"lib/Conversion/TorchToTosa/TorchToTosa.cpp",
|
|
"lib/Conversion/TorchToTosa/TosaLegalizeCommon.cpp",
|
|
"lib/Conversion/TorchToTosa/TosaLegalizeUtils.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Conversion/TorchToTosa/TorchToTosa.h",
|
|
"include/torch-mlir/Conversion/TorchToTosa/TosaLegalizeCommon.h",
|
|
"include/torch-mlir/Conversion/TorchToTosa/TosaLegalizeUtils.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRConversionPassesIncGen",
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
"@llvm-project//mlir:Dialect",
|
|
"@llvm-project//mlir:QuantOps",
|
|
"@llvm-project//mlir:TosaDialect",
|
|
],
|
|
)
|
|
|
|
# Dialects.TorchConversion
|
|
cc_library(
|
|
name = "TorchMLIRTorchBackendTypeConversion",
|
|
srcs = [
|
|
"lib/Dialect/TorchConversion/Transforms/BackendTypeConversion.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/Dialect/TorchConversion/Transforms/BackendTypeConversion.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRTorchConversionDialect",
|
|
"@llvm-project//mlir:FuncTransforms",
|
|
],
|
|
)
|
|
|
|
# External dialects
|
|
td_library(
|
|
name = "TorchMLIRTMTensorOpsTdFiles",
|
|
srcs = [
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorBase.td",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td",
|
|
],
|
|
includes = ["externals/llvm-external-projects/torch-mlir-dialects/include"],
|
|
deps = [
|
|
"@llvm-project//mlir:ControlFlowInterfacesTdFiles",
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
"@llvm-project//mlir:SideEffectInterfacesTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRTMTensorInterfacesIncGen",
|
|
strip_include_prefix = "externals/llvm-external-projects/torch-mlir-dialects/include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-op-interface-decls"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterfaces.h.inc",
|
|
),
|
|
(
|
|
["-gen-op-interface-defs"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOpInterfaces.cpp.inc",
|
|
),
|
|
(
|
|
["-gen-type-interface-decls"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorTypeInterfaces.h.inc",
|
|
),
|
|
(
|
|
["-gen-type-interface-defs"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorTypeInterfaces.cpp.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.td",
|
|
deps = [
|
|
":TorchMLIRTMTensorOpsTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRTMTensorScalarLoopOpInterfaceIncGen",
|
|
strip_include_prefix = "externals/llvm-external-projects/torch-mlir-dialects/include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-op-interface-decls"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h.inc",
|
|
),
|
|
(
|
|
["-gen-op-interface-defs"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.td",
|
|
deps = [
|
|
":TorchMLIRTMTensorOpsTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRTMTensorOpsIncGen",
|
|
strip_include_prefix = "externals/llvm-external-projects/torch-mlir-dialects/include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-op-decls"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h.inc",
|
|
),
|
|
(
|
|
["-gen-op-defs"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.cpp.inc",
|
|
),
|
|
(
|
|
["-gen-typedef-decls"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorTypes.h.inc",
|
|
),
|
|
(
|
|
[
|
|
"-gen-dialect-decls",
|
|
"-dialect=tm_tensor",
|
|
],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h.inc",
|
|
),
|
|
(
|
|
[
|
|
"-gen-dialect-defs",
|
|
"-dialect=tm_tensor",
|
|
],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.cpp.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.td",
|
|
deps = [
|
|
":TorchMLIRTMTensorOpsTdFiles",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTMTensorDialect",
|
|
srcs = [
|
|
"externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/ScalarLoopOpInterface.cpp",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorDialect.cpp",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorInterfaces.cpp",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/IR/TMTensorOps.cpp",
|
|
],
|
|
hdrs = [
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/ScalarLoopOpInterface.h",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorInterfaces.h",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorOps.h",
|
|
],
|
|
strip_include_prefix = "externals/llvm-external-projects/torch-mlir-dialects/include",
|
|
deps = [
|
|
":TorchMLIRTMTensorInterfacesIncGen",
|
|
":TorchMLIRTMTensorOpsIncGen",
|
|
":TorchMLIRTMTensorScalarLoopOpInterfaceIncGen",
|
|
"@llvm-project//mlir:AffineDialect",
|
|
"@llvm-project//mlir:ControlFlowInterfaces",
|
|
"@llvm-project//mlir:Dialect",
|
|
"@llvm-project//mlir:DialectUtils",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
"@llvm-project//mlir:ViewLikeInterface",
|
|
],
|
|
)
|
|
|
|
td_library(
|
|
name = "TorchMLIRTMTensorTransformsPassesTdFiles",
|
|
srcs = [
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td",
|
|
],
|
|
deps = [
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRTMTensorTransformsPassesIncGen",
|
|
strip_include_prefix = "externals/llvm-external-projects/torch-mlir-dialects/include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-pass-decls"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h.inc",
|
|
),
|
|
(
|
|
["-gen-pass-capi-header"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h.cpi.inc",
|
|
),
|
|
(
|
|
["-gen-pass-capi-impl"],
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.cpi.cpp.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.td",
|
|
deps = [
|
|
":TorchMLIRTMTensorTransformsPassesTdFiles",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRTMTensorPasses",
|
|
srcs = [
|
|
"externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/Bufferize.cpp",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/ConvertToLoops.cpp",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/lib/Dialect/TMTensor/Transforms/Passes.cpp",
|
|
],
|
|
hdrs = [
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/PassDetail.h",
|
|
"externals/llvm-external-projects/torch-mlir-dialects/include/torch-mlir-dialects/Dialect/TMTensor/Transforms/Passes.h",
|
|
],
|
|
strip_include_prefix = "externals/llvm-external-projects/torch-mlir-dialects/include",
|
|
deps = [
|
|
":TorchMLIRTMTensorDialect",
|
|
":TorchMLIRTMTensorTransformsPassesIncGen",
|
|
"@llvm-project//mlir:BufferizationTransforms",
|
|
"@llvm-project//mlir:FuncTransforms",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
"@llvm-project//mlir:LinalgTransforms",
|
|
"@llvm-project//mlir:Pass",
|
|
"@llvm-project//mlir:Transforms",
|
|
],
|
|
)
|
|
|
|
# RefBackend
|
|
filegroup(
|
|
name = "TorchMLIRRefBackendPassesDetails",
|
|
srcs = [
|
|
"lib/RefBackend/PassDetail.h",
|
|
],
|
|
)
|
|
|
|
td_library(
|
|
name = "TorchMLIRRefBackendPassTdFiles",
|
|
srcs = [
|
|
"include/torch-mlir/RefBackend/Passes.td",
|
|
],
|
|
deps = [
|
|
"@llvm-project//mlir:OpBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
gentbl_cc_library(
|
|
name = "TorchMLIRRefBackendPassIncGen",
|
|
strip_include_prefix = "include",
|
|
tbl_outs = [
|
|
(
|
|
["-gen-pass-decls"],
|
|
"include/torch-mlir/RefBackend/Passes.h.inc",
|
|
),
|
|
],
|
|
tblgen = "@llvm-project//mlir:mlir-tblgen",
|
|
td_file = "include/torch-mlir/RefBackend/Passes.td",
|
|
deps = [
|
|
":TorchMLIRRefBackendPassTdFiles",
|
|
"@llvm-project//mlir:PassBaseTdFiles",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRRefBackendPass",
|
|
srcs = [
|
|
"lib/RefBackend/RefBackend.cpp",
|
|
] + [":TorchMLIRRefBackendPassesDetails"],
|
|
hdrs = [
|
|
"include/torch-mlir/RefBackend/Passes.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRRefBackendPassIncGen",
|
|
":TorchMLIRTorchBackendTypeConversion",
|
|
":TorchMLIRTorchConversionDialect",
|
|
"@llvm-project//mlir:ArithmeticTransforms",
|
|
"@llvm-project//mlir:LinalgDialect",
|
|
"@llvm-project//mlir:LinalgTransforms",
|
|
"@llvm-project//mlir:MathTransforms",
|
|
"@llvm-project//mlir:MemRefDialect",
|
|
"@llvm-project//mlir:Pass",
|
|
],
|
|
)
|
|
|
|
cc_library(
|
|
name = "TorchMLIRInitAll",
|
|
srcs = [
|
|
"lib/InitAll.cpp",
|
|
],
|
|
hdrs = [
|
|
"include/torch-mlir/InitAll.h",
|
|
],
|
|
strip_include_prefix = "include",
|
|
deps = [
|
|
":TorchMLIRConversionPasses",
|
|
":TorchMLIRRefBackendPass",
|
|
":TorchMLIRTMTensorDialect",
|
|
":TorchMLIRTMTensorPasses",
|
|
":TorchMLIRTorchConversionDialect",
|
|
":TorchMLIRTorchConversionPasses",
|
|
":TorchMLIRTorchDialect",
|
|
":TorchMLIRTorchPasses",
|
|
"@llvm-project//mlir:Dialect",
|
|
"@llvm-project//mlir:DialectUtils",
|
|
"@llvm-project//mlir:IR",
|
|
],
|
|
)
|
|
|
|
# tools
|
|
cc_binary(
|
|
name = "torch-mlir-opt",
|
|
srcs = [
|
|
"tools/torch-mlir-opt/torch-mlir-opt.cpp",
|
|
],
|
|
deps = [
|
|
":TorchMLIRInitAll",
|
|
":TorchMLIRTorchDialect",
|
|
":TorchMLIRTorchPasses",
|
|
"@llvm-project//mlir:AllPassesAndDialects",
|
|
"@llvm-project//mlir:MlirOptLib",
|
|
],
|
|
)
|