mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
move generate-code into shared build structure (#75699)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/75699 ghstack-source-id: 155255334 Test Plan: Rely on CI. Reviewed By: dreiss Differential Revision: D35587412 fbshipit-source-id: 5ab79c07029de279a1fae36519654a73bb61d430 (cherry picked from commit 4896b72a6c0cc087e36889d21d2d885009d94a6d)
This commit is contained in:
committed by
PyTorch MergeBot
parent
28dfed962a
commit
eb27c85160
14
BUILD.bazel
14
BUILD.bazel
@ -1919,3 +1919,17 @@ test_suite(
|
||||
"//c10/test:tests",
|
||||
],
|
||||
)
|
||||
|
||||
# An internal genrule that we are converging with refers to these file
|
||||
# as if they are from this package, so we alias them for
|
||||
# compatibility.
|
||||
|
||||
alias(
|
||||
name = "native_functions.yaml",
|
||||
actual = "aten/src/ATen/native/native_functions.yaml",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "tags.yaml",
|
||||
actual = "aten/src/ATen/native/tags.yaml",
|
||||
)
|
||||
|
84
build.bzl
84
build.bzl
@ -22,6 +22,28 @@ def define_targets(rules):
|
||||
],
|
||||
)
|
||||
|
||||
rules.genrule(
|
||||
name = "generate-code",
|
||||
srcs = [
|
||||
"aten/src/ATen/native/ts_native_functions.yaml",
|
||||
"aten/src/ATen/templates/DispatchKeyNativeFunctions.cpp",
|
||||
"aten/src/ATen/templates/DispatchKeyNativeFunctions.h",
|
||||
"aten/src/ATen/templates/LazyIr.h",
|
||||
"aten/src/ATen/templates/RegisterDispatchKey.cpp",
|
||||
"torch/csrc/lazy/core/shape_inference.h",
|
||||
"torch/csrc/lazy/ts_backend/ts_native_functions.cpp",
|
||||
":native_functions.yaml",
|
||||
":tags.yaml",
|
||||
],
|
||||
tools = ["//tools/setup_helpers:generate_code"],
|
||||
outs = _GENERATED_CPP + GENERATED_AUTOGRAD_H + GENERATED_LAZY_H + GENERATED_TESTING_PY,
|
||||
cmd = "$(location //tools/setup_helpers:generate_code) " +
|
||||
"--install_dir $(RULEDIR) " +
|
||||
"--native-functions-path $(location :native_functions.yaml) " +
|
||||
"--tags-path=$(location :tags.yaml) " +
|
||||
"--gen_lazy_ts_backend",
|
||||
)
|
||||
|
||||
rules.genrule(
|
||||
name = "version_h",
|
||||
srcs = [
|
||||
@ -34,3 +56,65 @@ def define_targets(rules):
|
||||
"--version-path $(location :version.txt) --output-path $@ ",
|
||||
tools = ["//tools/setup_helpers:gen_version_header"],
|
||||
)
|
||||
|
||||
# These lists are temporarily living in and exported from the shared
|
||||
# structure so that an internal build that lives under a different
|
||||
# root can access them. These could technically live in a separate
|
||||
# file in the same directory but that would require extra work to
|
||||
# ensure that file is synced to both Meta internal repositories and
|
||||
# GitHub. This problem will go away when the targets downstream of
|
||||
# generate-code that use these lists are moved into the shared
|
||||
# structure as well.
|
||||
|
||||
# In the open-source build, these are generated into
|
||||
# torch/csrc/autograd/generated
|
||||
GENERATED_AUTOGRAD_H = [
|
||||
"autograd/generated/Functions.h",
|
||||
"autograd/generated/VariableType.h",
|
||||
"autograd/generated/python_functions.h",
|
||||
"autograd/generated/variable_factories.h",
|
||||
]
|
||||
|
||||
# In the open-source build, these are generated into
|
||||
# torch/testing/_internal/generated
|
||||
GENERATED_TESTING_PY = [
|
||||
"annotated_fn_args.py",
|
||||
]
|
||||
|
||||
GENERATED_LAZY_H = [
|
||||
"lazy/generated/LazyIr.h",
|
||||
"lazy/generated/LazyNativeFunctions.h",
|
||||
]
|
||||
|
||||
# In both open-source and fbcode builds, these are generated into
|
||||
# torch/csrc/{autograd,jit}/generated.i
|
||||
_GENERATED_CPP = [
|
||||
"autograd/generated/Functions.cpp",
|
||||
"autograd/generated/VariableType_0.cpp",
|
||||
"autograd/generated/VariableType_1.cpp",
|
||||
"autograd/generated/VariableType_2.cpp",
|
||||
"autograd/generated/VariableType_3.cpp",
|
||||
"autograd/generated/VariableType_4.cpp",
|
||||
"autograd/generated/TraceType_0.cpp",
|
||||
"autograd/generated/TraceType_1.cpp",
|
||||
"autograd/generated/TraceType_2.cpp",
|
||||
"autograd/generated/TraceType_3.cpp",
|
||||
"autograd/generated/TraceType_4.cpp",
|
||||
"autograd/generated/ADInplaceOrViewType_0.cpp",
|
||||
"autograd/generated/ADInplaceOrViewType_1.cpp",
|
||||
"autograd/generated/python_functions_0.cpp",
|
||||
"autograd/generated/python_functions_1.cpp",
|
||||
"autograd/generated/python_functions_2.cpp",
|
||||
"autograd/generated/python_functions_3.cpp",
|
||||
"autograd/generated/python_functions_4.cpp",
|
||||
"autograd/generated/python_nn_functions.cpp",
|
||||
"autograd/generated/python_fft_functions.cpp",
|
||||
"autograd/generated/python_linalg_functions.cpp",
|
||||
"autograd/generated/python_return_types.cpp",
|
||||
"autograd/generated/python_sparse_functions.cpp",
|
||||
"autograd/generated/python_special_functions.cpp",
|
||||
"autograd/generated/python_torch_functions_0.cpp",
|
||||
"autograd/generated/python_torch_functions_1.cpp",
|
||||
"autograd/generated/python_torch_functions_2.cpp",
|
||||
"autograd/generated/python_variable_methods.cpp",
|
||||
]
|
||||
|
@ -9,39 +9,6 @@
|
||||
# bzl files are not exported via ShipIt by default, so you may also need to
|
||||
# update PyTorch's ShipIt config)
|
||||
|
||||
# In both open-source and fbcode builds, these are generated into
|
||||
# torch/csrc/{autograd,jit}/generated.i
|
||||
GENERATED_CPP = [
|
||||
"autograd/generated/Functions.cpp",
|
||||
"autograd/generated/VariableType_0.cpp",
|
||||
"autograd/generated/VariableType_1.cpp",
|
||||
"autograd/generated/VariableType_2.cpp",
|
||||
"autograd/generated/VariableType_3.cpp",
|
||||
"autograd/generated/VariableType_4.cpp",
|
||||
"autograd/generated/TraceType_0.cpp",
|
||||
"autograd/generated/TraceType_1.cpp",
|
||||
"autograd/generated/TraceType_2.cpp",
|
||||
"autograd/generated/TraceType_3.cpp",
|
||||
"autograd/generated/TraceType_4.cpp",
|
||||
"autograd/generated/ADInplaceOrViewType_0.cpp",
|
||||
"autograd/generated/ADInplaceOrViewType_1.cpp",
|
||||
"autograd/generated/python_functions_0.cpp",
|
||||
"autograd/generated/python_functions_1.cpp",
|
||||
"autograd/generated/python_functions_2.cpp",
|
||||
"autograd/generated/python_functions_3.cpp",
|
||||
"autograd/generated/python_functions_4.cpp",
|
||||
"autograd/generated/python_nn_functions.cpp",
|
||||
"autograd/generated/python_fft_functions.cpp",
|
||||
"autograd/generated/python_linalg_functions.cpp",
|
||||
"autograd/generated/python_return_types.cpp",
|
||||
"autograd/generated/python_sparse_functions.cpp",
|
||||
"autograd/generated/python_special_functions.cpp",
|
||||
"autograd/generated/python_torch_functions_0.cpp",
|
||||
"autograd/generated/python_torch_functions_1.cpp",
|
||||
"autograd/generated/python_torch_functions_2.cpp",
|
||||
"autograd/generated/python_variable_methods.cpp",
|
||||
]
|
||||
|
||||
# This is duplicated in caffe2/CMakeLists.txt for now and not yet used in buck
|
||||
GENERATED_LAZY_TS_CPP = [
|
||||
"lazy/generated/LazyNativeFunctions.cpp",
|
||||
|
Reference in New Issue
Block a user