Skip to content

Commit f3d2e33

Browse files
malfetfacebook-github-bot
authored andcommittedMay 14, 2020
[PyTorch] Remove duplicate jit core sources filelists (pytorch#38430)
Summary: Pull Request resolved: pytorch#38430 Add `jit_core_[sources|headers]` to `build_variables.bzl`, use them from BUILD.bazel as wel as from internal build systems Test Plan: CI Reviewed By: suo Differential Revision: D21555649 fbshipit-source-id: e78572465f36560806d646f147b2ef5a53ba1efe
1 parent 061ed73 commit f3d2e33

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed
 

‎BUILD.bazel

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@rules_proto//proto:defs.bzl", "proto_library")
22
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test")
33
load("//third_party:substitution.bzl", "template_rule")
4-
load("//:tools/build_variables.bzl", "torch_cpp_srcs", "libtorch_core_sources", "libtorch_distributed_sources", "libtorch_extra_sources")
4+
load("//:tools/build_variables.bzl", "torch_cpp_srcs", "libtorch_core_sources", "libtorch_distributed_sources", "libtorch_extra_sources", "jit_core_sources")
55
load("//tools/rules:cu.bzl", "cu_library")
66
load("//tools/config:defs.bzl", "if_cuda")
77
load("//:aten.bzl", "intern_build_aten_ops")
@@ -1979,13 +1979,7 @@ cc_library(
19791979
"torch/csrc/cuda/python_nccl.cpp",
19801980
"torch/csrc/cuda/nccl.cpp",
19811981
],
1982-
)) + libtorch_core_sources + libtorch_distributed_sources + torch_cpp_srcs + libtorch_extra_sources + [
1983-
"torch/csrc/jit/frontend/error_report.cpp",
1984-
"torch/csrc/jit/frontend/lexer.cpp",
1985-
"torch/csrc/jit/frontend/function_schema_parser.cpp",
1986-
"torch/csrc/jit/frontend/strtod.cpp",
1987-
"torch/csrc/jit/frontend/source_range.cpp",
1988-
"torch/csrc/jit/frontend/schema_type_parser.cpp",
1982+
)) + libtorch_core_sources + libtorch_distributed_sources + torch_cpp_srcs + libtorch_extra_sources + jit_core_sources + [
19891983
":generated_code",
19901984
],
19911985
copts = TORCH_COPTS + if_cuda(["-DUSE_CUDA=1"]),

‎tools/build_variables.bzl

+28-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,34 @@ libtorch_generated_sources = [
3939
"torch/csrc/autograd/VariableTypeManual.cpp",
4040
]
4141

42+
# copied from https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/core/CMakeLists.txt
43+
jit_core_headers = [
44+
"torch/csrc/utils/memory.h",
45+
"torch/csrc/WindowsTorchApiMacro.h",
46+
"torch/csrc/jit/frontend/source_range.h",
47+
"torch/csrc/jit/serialization/source_range_serialization.h",
48+
"torch/csrc/jit/frontend/lexer.h",
49+
"torch/csrc/jit/frontend/strtod.h",
50+
"torch/csrc/jit/frontend/parser_constants.h",
51+
"torch/csrc/jit/frontend/function_schema_parser.h",
52+
"torch/csrc/jit/frontend/parse_string_literal.h",
53+
"torch/csrc/jit/frontend/schema_type_parser.h",
54+
"torch/csrc/jit/frontend/error_report.h",
55+
"torch/csrc/jit/frontend/tree.h",
56+
"torch/custom_class.h",
57+
"torch/custom_class_detail.h",
58+
"torch/library.h",
59+
]
60+
61+
jit_core_sources = [
62+
"torch/csrc/jit/frontend/error_report.cpp",
63+
"torch/csrc/jit/frontend/function_schema_parser.cpp",
64+
"torch/csrc/jit/frontend/lexer.cpp",
65+
"torch/csrc/jit/frontend/schema_type_parser.cpp",
66+
"torch/csrc/jit/frontend/strtod.cpp",
67+
"torch/csrc/jit/frontend/source_range.cpp",
68+
]
69+
4270
# copied from https://github.com/pytorch/pytorch/blob/master/tools/cpp_build/torch/CMakeLists.txt
4371
libtorch_core_sources = [
4472
"torch/csrc/autograd/anomaly_mode.cpp",
@@ -238,7 +266,6 @@ libtorch_core_jit_sources = [
238266

239267
libtorch_cmake_sources = libtorch_core_sources + libtorch_core_jit_sources
240268

241-
242269
libtorch_extra_sources = libtorch_core_jit_sources + [
243270
"torch/csrc/autograd/VariableTypeManual.cpp",
244271
"torch/csrc/jit/api/module_save.cpp",

0 commit comments

Comments
 (0)
Please sign in to comment.