Skip to content

Commit 1a80e27

Browse files
author
Michael Andreas Dagitses
committed
switch Bazel to the shared generate-code genrule
Pull Request resolved: #75790 We were building it before, but now we use it in downstream rules. This enables us to eliminate the handwritten genrule. ghstack-source-id: 153891038 Differential Revision: [D35645390](https://our.internmc.facebook.com/intern/diff/D35645390/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D35645390/)!
1 parent caec383 commit 1a80e27

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

BUILD.bazel

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,15 @@ libtorch_python_generated_sources = [
146146
"torch/csrc/autograd/generated/python_return_types.cpp",
147147
]
148148

149-
genrule(
150-
name = "all_generated_code",
151-
srcs = [
152-
"aten/src/ATen/native/native_functions.yaml",
153-
"aten/src/ATen/native/ts_native_functions.yaml",
154-
"torch/csrc/lazy/core/shape_inference.h",
155-
"torch/csrc/lazy/ts_backend/ts_native_functions.cpp",
156-
"aten/src/ATen/templates/DispatchKeyNativeFunctions.cpp",
157-
"aten/src/ATen/templates/DispatchKeyNativeFunctions.h",
158-
"aten/src/ATen/templates/RegisterDispatchKey.cpp",
159-
"aten/src/ATen/templates/LazyIr.h",
160-
],
161-
outs = libtorch_cpp_generated_sources + libtorch_python_generated_sources,
162-
cmd = "$(location //tools/setup_helpers:generate_code) --install_dir `dirname $(location torch/csrc/autograd/generated/variable_factories.h)`/../.. --native-functions-path $(location aten/src/ATen/native/native_functions.yaml) --gen_lazy_ts_backend",
163-
tools = ["//tools/setup_helpers:generate_code"],
164-
)
165-
166149
filegroup(
167150
name = "cpp_generated_code",
168-
data = [":all_generated_code"],
151+
data = [":generate-code"],
169152
srcs = libtorch_cpp_generated_sources,
170153
)
171154

172155
filegroup(
173156
name = "python_generated_code",
174-
data = [":all_generated_code"],
157+
data = [":generate-code"],
175158
srcs = libtorch_python_generated_sources,
176159
)
177160

build.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,7 @@ _GENERATED_CPP = [
9292
"torch/csrc/autograd/generated/python_torch_functions_1.cpp",
9393
"torch/csrc/autograd/generated/python_torch_functions_2.cpp",
9494
"torch/csrc/autograd/generated/python_variable_methods.cpp",
95+
"torch/csrc/lazy/generated/LazyNativeFunctions.cpp",
96+
"torch/csrc/lazy/generated/RegisterAutogradLazy.cpp",
97+
"torch/csrc/lazy/generated/RegisterLazy.cpp",
9598
]

0 commit comments

Comments
 (0)