mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Use @pytorch// in bazel build files (#89660)
This change aims to make bazel build more embeeding-friendly.
Namely, when PyTorch is included as an external repo in another project, it is usually included like this
```
native.local_repository(
name = "pytorch",
path = ...,
repo_mapping = repo_mapping,
)
```
Or
```
http_archive(
name = "pytorch",
urls = ...
repo_mapping = repo_mapping,
)
```
In this case, references to `@//` would resolve to the top-level WORKSPACE that includes PyTorch.
That makes upgrades harder because we need to carry around this patch.
Note that under some edge-case circumstances even `//` resolves to the top-level `WORKSPACE`.
This change makes the embedding of the bazel build easier without compromising anything for the main repo, since the `@pytorch//` still refers to the same thing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89660
Approved by: https://github.com/kit1980
This commit is contained in:
parent
6cea4f3d57
commit
39306c1dfb
7 changed files with 15 additions and 15 deletions
10
BUILD.bazel
10
BUILD.bazel
|
|
@ -2,11 +2,11 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
|
|||
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
|
||||
load("@rules_proto//proto:defs.bzl", "proto_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test")
|
||||
load("//third_party:substitution.bzl", "header_template_rule")
|
||||
load("//:tools/bazel.bzl", "rules")
|
||||
load("//tools/rules:cu.bzl", "cu_library")
|
||||
load("//tools/config:defs.bzl", "if_cuda")
|
||||
load("//:aten.bzl", "intern_build_aten_ops", "generate_aten")
|
||||
load("@pytorch//third_party:substitution.bzl", "header_template_rule")
|
||||
load("@pytorch//:tools/bazel.bzl", "rules")
|
||||
load("@pytorch//tools/rules:cu.bzl", "cu_library")
|
||||
load("@pytorch//tools/config:defs.bzl", "if_cuda")
|
||||
load("@pytorch//:aten.bzl", "intern_build_aten_ops", "generate_aten")
|
||||
load(":build.bzl", "define_targets", "GENERATED_AUTOGRAD_CPP", "GENERATED_AUTOGRAD_PYTHON")
|
||||
load(":build_variables.bzl", "jit_core_sources", "libtorch_core_sources", "libtorch_cuda_sources", "libtorch_distributed_sources", "libtorch_extra_sources", "libtorch_nvfuser_generated_headers", "libtorch_nvfuser_runtime_sources", "libtorch_python_core_sources", "torch_cpp_srcs", "lazy_tensor_ts_sources")
|
||||
load(":ufunc_defs.bzl", "aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cuda_sources")
|
||||
|
|
|
|||
6
third_party/gloo.BUILD
vendored
6
third_party/gloo.BUILD
vendored
|
|
@ -1,7 +1,7 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@//tools/rules:cu.bzl", "cu_library")
|
||||
load("@//third_party:substitution.bzl", "template_rule")
|
||||
load("@//tools/config:defs.bzl", "if_cuda")
|
||||
load("@pytorch//tools/rules:cu.bzl", "cu_library")
|
||||
load("@pytorch//third_party:substitution.bzl", "template_rule")
|
||||
load("@pytorch//tools/config:defs.bzl", "if_cuda")
|
||||
|
||||
template_rule(
|
||||
name = "gloo_config_cmake_macros",
|
||||
|
|
|
|||
6
third_party/mkl-dnn.BUILD
vendored
6
third_party/mkl-dnn.BUILD
vendored
|
|
@ -1,5 +1,5 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@//third_party:substitution.bzl", "template_rule")
|
||||
load("@pytorch//third_party:substitution.bzl", "template_rule")
|
||||
|
||||
_DNNL_RUNTIME_OMP = {
|
||||
"#cmakedefine DNNL_CPU_THREADING_RUNTIME DNNL_RUNTIME_${DNNL_CPU_THREADING_RUNTIME}": "#define DNNL_CPU_THREADING_RUNTIME DNNL_RUNTIME_OMP",
|
||||
|
|
@ -100,7 +100,7 @@ cc_library(
|
|||
"-fno-strict-overflow",
|
||||
"-fopenmp",
|
||||
] + select({
|
||||
"@//tools/config:thread_sanitizer": ["-DDNNL_CPU_RUNTIME=0"],
|
||||
"@pytorch//tools/config:thread_sanitizer": ["-DDNNL_CPU_RUNTIME=0"],
|
||||
"//conditions:default": ["-DDNNL_CPU_RUNTIME=2"],
|
||||
}),
|
||||
includes = [
|
||||
|
|
@ -119,7 +119,7 @@ cc_library(
|
|||
deps = [
|
||||
"@mkl",
|
||||
] + select({
|
||||
"@//tools/config:thread_sanitizer": [],
|
||||
"@pytorch//tools/config:thread_sanitizer": [],
|
||||
"//conditions:default": ["@tbb"],
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
2
third_party/mkl.BUILD
vendored
2
third_party/mkl.BUILD
vendored
|
|
@ -13,7 +13,7 @@ cc_library(
|
|||
"libmkl_vml_avx512.so",
|
||||
"libmkl_vml_def.so",
|
||||
] + select({
|
||||
"@//tools/config:thread_sanitizer": [],
|
||||
"@pytorch//tools/config:thread_sanitizer": [],
|
||||
"//conditions:default": ["libmkl_tbb_thread.so"],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
|
|
|
|||
2
third_party/sleef.BUILD
vendored
2
third_party/sleef.BUILD
vendored
|
|
@ -1,5 +1,5 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@//third_party:sleef.bzl", "sleef_cc_library")
|
||||
load("@pytorch//third_party:sleef.bzl", "sleef_cc_library")
|
||||
|
||||
SLEEF_COPTS = [
|
||||
"-DHAVE_MALLOC_USABLE_SIZE=1",
|
||||
|
|
|
|||
2
third_party/tbb.BUILD
vendored
2
third_party/tbb.BUILD
vendored
|
|
@ -1,5 +1,5 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@//third_party:substitution.bzl", "template_rule")
|
||||
load("@pytorch//third_party:substitution.bzl", "template_rule")
|
||||
|
||||
licenses(["notice"]) # Apache 2.0
|
||||
|
||||
|
|
|
|||
2
third_party/tensorpipe.BUILD
vendored
2
third_party/tensorpipe.BUILD
vendored
|
|
@ -1,5 +1,5 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@//third_party:substitution.bzl", "header_template_rule")
|
||||
load("@pytorch//third_party:substitution.bzl", "header_template_rule")
|
||||
|
||||
LIBUV_COMMON_SRCS = [
|
||||
"third_party/libuv/src/fs-poll.c",
|
||||
|
|
|
|||
Loading…
Reference in a new issue