8000 use ufunc_defs.bzl in BUILD.bazel (#77747) · pytorch/pytorch@fe4a0dc · GitHub
[go: up one dir, main page]

Skip to content

Commit fe4a0dc

Browse files
mikey dagitsesfacebook-github-bot
mikey dagitses
authored andcommitted
use ufunc_defs.bzl in BUILD.bazel (#77747)
Summary: Pull Request resolved: #77747 This allows us to remove some duplication in aten.bzl. ghstack-source-id: 159044901 Test Plan: Rely on CI. Reviewed By: seemethere Differential Revision: D36481025 fbshipit-source-id: e17aabd2e246382219b21a1408a03d577ac1fb4f
1 parent b8dcd6a commit fe4a0dc

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ load("//third_party:substitution.bzl", "header_template_rule")
66
load("//:tools/bazel.bzl", "rules")
77
load("//tools/rules:cu.bzl", "cu_library")
88
load("//tools/config:defs.bzl", "if_cuda")
9-
load("//:aten.bzl", "intern_build_aten_ops", "generate_aten", "aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cuda_sources")
9+
load("//:aten.bzl", "intern_build_aten_ops", "generate_aten")
1010
load(":build.bzl", "define_targets", "GENERATED_AUTOGRAD_CPP", "GENERATED_AUTOGRAD_PYTHON")
1111
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")
12+
load(":ufunc_defs.bzl", "aten_ufunc_generated_cpu_sources", "aten_ufunc_generated_cpu_kernel_sources", "aten_ufunc_generated_cuda_sources")
1213

1314
define_targets(rules = rules)
1415

aten.bzl

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
load("@bazel_skylib//lib:paths.bzl", "paths")
22
load("@rules_cc//cc:defs.bzl", "cc_library")
3-
load(":build_variables.bzl", "aten_ufunc_headers")
43

54
CPU_CAPABILITY_NAMES = ["DEFAULT", "AVX2"]
65
CAPABILITY_COMPILER_FLAGS = {
@@ -95,32 +94,3 @@ generate_aten = rule(
9594
"srcs": attr.label_list(allow_files = True),
9695
},
9796
)
98-
99-
# copy pasted from ufunc_defs.bzl, as ufuncs_defs.bzl cannot be included
100-
# from BUILD.bazel because it has a directory relative load, and Bazel
101-
# always load from workspace root. The "correct" fix would be to move
102-
# build_variables.bzl to the top level but I don't have time to do this at
103-
# the moment.
104-
105-
aten_ufunc_names = [
106-
paths.split_extension(paths.basename(h))[0]
107-
for h in aten_ufunc_headers
108-
]
109-
110-
def aten_ufunc_generated_cpu_sources(gencode_pattern = "{}"):
111-
return [gencode_pattern.format(name) for name in [
112-
"UfuncCPU_{}.cpp".format(n)
113-
for n in aten_ufunc_names
114-
]]
115-
116-
def aten_ufunc_generated_cpu_kernel_sources(gencode_pattern = "{}"):
117-
return [gencode_pattern.format(name) for name in [
118-
"UfuncCPUKernel_{}.cpp".format(n)
119-
for n in aten_ufunc_names
120-
]]
121-
122-
def aten_ufunc_generated_cuda_sources(gencode_pattern = "{}"):
123-
return [gencode_pattern.format(name) for name in [
124-
"UfuncCUDA_{}.cu".format(n)
125-
for n in aten_ufunc_names
126-
]]

0 commit comments

Comments
 (0)
0