Skip to content

Commit fd9379d

Browse files
committed
Pull c10 headers directly from PyTorch internally, not from the c10 mirror
Previously, both internal and external worlds got ExecuTorch's pinned version of PyTorch. Now external is the same, but internal gets its monorepo behavior. PyTorch guarantees backward compatibility (i.e., not breaking the builds of existing PyTorch users), so our ExecuTorch code that works with pinned PyTorch should also automatically work with internal PyTorch. (bc breaks will be difficult, but that's inherent to bc breaks.) Differential Revision: [D76832520](https://our.internmc.facebook.com/intern/diff/D76832520/) [ghstack-poisoned]
1 parent 5136175 commit fd9379d

File tree

1 file changed

+48
-37
lines changed

1 file changed

+48
-37
lines changed

runtime/core/portable_type/c10/c10/targets.bzl

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -49,43 +49,6 @@ def define_common_targets():
4949
The directory containing this targets.bzl file should also contain both
5050
TARGETS and BUCK files that call this function.
5151
"""
52-
runtime.cxx_library(
53-
name = "c10",
54-
header_namespace = "c10",
55-
exported_headers = [
56-
"macros/Export.h",
57-
"macros/Macros.h",
58-
"util/BFloat16.h",
59-
"util/BFloat16-inl.h",
60-
"util/BFloat16-math.h",
61-
"util/Half.h",
62-
"util/Half-inl.h",
63-
"util/TypeSafeSignMath.h",
64-
"util/bit_cast.h",
65-
"util/complex.h",
66-
"util/complex_math.h",
67-
"util/complex_utils.h",
68-
"util/floating_point_utils.h",
69-
"util/irange.h",
70-
],
71-
exported_preprocessor_flags = [
72-
"-DC10_USING_CUSTOM_GENERATED_MACROS",
73-
] + ([] if runtime.is_oss else [
74-
"-DC10_USE_GLOG",
75-
"-DC10_USE_MINIMAL_GLOG",
76-
]),
77-
visibility = [
78-
"//executorch/...",
79-
"@EXECUTORCH_CLIENTS",
80-
],
81-
deps = select({
82-
"DEFAULT": [],
83-
# Half-inl.h depends on vec_half.h from ATen, but only when building for x86.
84-
"ovr_config//cpu:x86_64": [
85-
":aten_headers_for_executorch",
86-
],
87-
}),
88-
)
8952

9053
runtime.cxx_library(
9154
name = "aten_headers_for_executorch",
@@ -118,3 +81,51 @@ def define_common_targets():
11881
fbcode_exported_preprocessor_flags = get_preprocessor_flags(is_fbcode=True)
11982
+ ([] if runtime.is_oss else ["-DET_USE_PYTORCH_HEADERS"]),
12083
)
84+
85+
if runtime.is_oss:
86+
runtime.cxx_library(
87+
name = "c10",
88+
header_namespace = "c10",
89+
exported_headers = [
90+
"macros/Export.h",
91+
"macros/Macros.h",
92+
"util/BFloat16.h",
93+
"util/BFloat16-inl.h",
94+
"util/BFloat16-math.h",
95+
"util/Half.h",
96+
"util/Half-inl.h",
97+
"util/TypeSafeSignMath.h",
98+
"util/bit_cast.h",
99+
"util/complex.h",
100+
"util/complex_math.h",
101+
"util/complex_utils.h",
102+
"util/floating_point_utils.h",
103+
"util/irange.h",
104+
],
105+
exported_preprocessor_flags = [
106+
"-DC10_USING_CUSTOM_GENERATED_MACROS",
107+
] + ([] if runtime.is_oss else [
108+
"-DC10_USE_GLOG",
109+
"-DC10_USE_MINIMAL_GLOG",
110+
]),
111+
visibility = [
112+
"//executorch/...",
113+
"@EXECUTORCH_CLIENTS",
114+
],
115+
deps = select({
116+
"DEFAULT": [],
117+
# Half-inl.h depends on vec_half.h from ATen, but only when building for x86.
118+
"ovr_config//cpu:x86_64": [
119+
":aten_headers_for_executorch",
120+
],
121+
}),
122+
)
123+
else:
124+
runtime.cxx_library(
125+
name = "c10",
126+
exported_deps = [":aten_headers_for_executorch"],
127+
visibility = [
128+
"//executorch/...",
129+
"@EXECUTORCH_CLIENTS",
130+
],
131+
)

0 commit comments

Comments
 (0)