Add mhlo to bazel build (#1120)

pull/1113/head snapshot-20220729.548
Ahmed S. Taei 2022-07-28 23:24:42 -07:00 committed by GitHub
parent c681c3497a
commit b389053653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 2 deletions

View File

@ -30,9 +30,18 @@ llvm_configure(
repo_mapping = { repo_mapping = {
"@python_runtime": "@local_config_python", "@python_runtime": "@local_config_python",
}, },
targets = [
"X86",
]
) )
llvm_disable_optional_support_deps() llvm_disable_optional_support_deps()
local_repository(
name = "mlir-hlo",
path = "../../externals/mlir-hlo/"
)
new_local_repository( new_local_repository(
name = "torch-mlir-raw", name = "torch-mlir-raw",
build_file_content = "# empty", build_file_content = "# empty",

View File

@ -284,7 +284,7 @@ gentbl_cc_library(
strip_include_prefix = "include", strip_include_prefix = "include",
tbl_outs = [ tbl_outs = [
( (
["-gen-pass-decls"], ["-gen-pass-decls", "-DTORCH_MLIR_ENABLE_MHLO"],
"include/torch-mlir/Conversion/Passes.h.inc", "include/torch-mlir/Conversion/Passes.h.inc",
) )
], ],
@ -443,6 +443,32 @@ cc_library(
] ]
) )
cc_library(
name = "TorchMLIRTorchToMhlo",
srcs = [
"lib/Conversion/TorchToMhlo/TorchToMhlo.cpp",
"lib/Conversion/TorchToMhlo/MhloLegalizeUtils.cpp",
"lib/Conversion/TorchToMhlo/BasicOp.cpp",
"lib/Conversion/TorchToMhlo/GatherOp.cpp",
"lib/Conversion/TorchToMhlo/ViewLikeOps.cpp",
"lib/Conversion/TorchToMhlo/MhloLegalizeUtils.h",
"lib/Conversion/TorchToMhlo/PopulatePatterns.h",
"lib/Conversion/PassDetail.h",
],
hdrs = [
"include/torch-mlir/Conversion/TorchToMhlo/TorchToMhlo.h"
],
strip_include_prefix = "include",
deps = [
":TorchMLIRTorchBackendTypeConversion",
":TorchMLIRConversionPassesIncGen",
":TorchMLIRTorchConversionDialect",
":TorchMLIRConversionUtils",
"@mlir-hlo//:hlo",
"@llvm-project//mlir:Dialect"
]
)
cc_library( cc_library(
name = "TorchMLIRConversionPasses", name = "TorchMLIRConversionPasses",
srcs = [ srcs = [
@ -457,7 +483,8 @@ cc_library(
":TorchMLIRTorchToSCF", ":TorchMLIRTorchToSCF",
":TorchMLIRTorchToStd", ":TorchMLIRTorchToStd",
":TorchMLIRTorchToTosa", ":TorchMLIRTorchToTosa",
":TorchMLIRTorchToTMTensor" ":TorchMLIRTorchToTMTensor",
":TorchMLIRTorchToMhlo"
] ]
) )
@ -487,6 +514,7 @@ cc_library(
":TorchMLIRTorchToStd", ":TorchMLIRTorchToStd",
":TorchMLIRTorchToTosa", ":TorchMLIRTorchToTosa",
":TorchMLIRTorchToTMTensor", ":TorchMLIRTorchToTMTensor",
":TorchMLIRTorchToMhlo",
"@llvm-project//mlir:FuncDialect", "@llvm-project//mlir:FuncDialect",
"@llvm-project//mlir:Pass", "@llvm-project//mlir:Pass",
"@llvm-project//mlir:LinalgDialect", "@llvm-project//mlir:LinalgDialect",