Skip to content

Commit

Permalink
Add mhlo to bazel build (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
asaadaldien authored Jul 29, 2022
1 parent c681c34 commit b389053
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
9 changes: 9 additions & 0 deletions utils/bazel/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@ llvm_configure(
repo_mapping = {
"@python_runtime": "@local_config_python",
},
targets = [
"X86",
]
)
llvm_disable_optional_support_deps()


local_repository(
name = "mlir-hlo",
path = "../../externals/mlir-hlo/"
)

new_local_repository(
name = "torch-mlir-raw",
build_file_content = "# empty",
Expand Down
32 changes: 30 additions & 2 deletions utils/bazel/torch-mlir-overlay/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ gentbl_cc_library(
strip_include_prefix = "include",
tbl_outs = [
(
["-gen-pass-decls"],
["-gen-pass-decls", "-DTORCH_MLIR_ENABLE_MHLO"],
"include/torch-mlir/Conversion/Passes.h.inc",
)
],
Expand Down Expand Up @@ -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(
name = "TorchMLIRConversionPasses",
srcs = [
Expand All @@ -457,7 +483,8 @@ cc_library(
":TorchMLIRTorchToSCF",
":TorchMLIRTorchToStd",
":TorchMLIRTorchToTosa",
":TorchMLIRTorchToTMTensor"
":TorchMLIRTorchToTMTensor",
":TorchMLIRTorchToMhlo"
]
)

Expand Down Expand Up @@ -487,6 +514,7 @@ cc_library(
":TorchMLIRTorchToStd",
":TorchMLIRTorchToTosa",
":TorchMLIRTorchToTMTensor",
":TorchMLIRTorchToMhlo",
"@llvm-project//mlir:FuncDialect",
"@llvm-project//mlir:Pass",
"@llvm-project//mlir:LinalgDialect",
Expand Down

0 comments on commit b389053

Please sign in to comment.