Skip to content

Commit 5d7dba2

Browse files
stepanhrudafacebook-github-bot
authored andcommitted
Expose symbols on macos in the xplat pytorch stack (pytorch#150487)
Summary: X-link: pytorch/executorch#9819 Had to revert D71321310 because it affected way too many targets and build sizes. These changes should expose just enough symbols to be buildable in arvr mode on macOS. Could potentially make narrow it down even more by avoiding eg `get_pt_compiler_flags` Differential Revision: D72255474
1 parent c6d79c1 commit 5d7dba2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

buckbuild.bzl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ def get_pt_compiler_flags():
194194
return select({
195195
"DEFAULT": _PT_COMPILER_FLAGS,
196196
"ovr_config//compiler:cl": windows_convert_gcc_clang_flags(_PT_COMPILER_FLAGS),
197+
}) + select({
198+
"DEFAULT": [],
199+
"ovr_config//os:macos": ["-fvisibility=default"],
197200
})
198201

199202
_PT_COMPILER_FLAGS = [
@@ -228,6 +231,9 @@ ATEN_COMPILER_FLAGS = [
228231
# Not supported by clang on Windows
229232
"DEFAULT": ["-fPIC"],
230233
"ovr_config//compiler:clang-windows": [],
234+
}) + select({
235+
"DEFAULT": [],
236+
"ovr_config//os:macos": ["-fvisibility=default"],
231237
})
232238

233239
def get_aten_compiler_flags():
@@ -982,6 +988,10 @@ def define_buck_targets(
982988
fb_xplat_cxx_library(
983989
name = "torch_mobile_headers",
984990
header_namespace = "",
991+
compiler_flags = select({
992+
"DEFAULT": [],
993+
"ovr_config//os:macos": ["-fvisibility=default"],
994+
}),
985995
exported_headers = subdir_glob(
986996
[
987997
("", "torch/csrc/jit/mobile/*.h"),
@@ -1185,7 +1195,10 @@ def define_buck_targets(
11851195
srcs = [
11861196
"torch/csrc/jit/mobile/observer.cpp",
11871197
] + ([] if IS_OSS else ["torch/fb/observers/MobileObserverUtil.cpp"]),
1188-
compiler_flags = ["-fexceptions"],
1198+
compiler_flags = ["-fexceptions"] + select({
1199+
"DEFAULT": [],
1200+
"ovr_config//os:macos": ["-fvisibility=default"],
1201+
}),
11891202
header_namespace = "",
11901203
exported_headers = subdir_glob(
11911204
[
@@ -2035,7 +2048,7 @@ def define_buck_targets(
20352048
"ovr_config//os:xtensa-xos": [
20362049
"-fdata-sections",
20372050
"-ffunction-sections",
2038-
],
2051+
]
20392052
}),
20402053
exported_preprocessor_flags = get_pt_preprocessor_flags() + [
20412054
"-DMIN_EDGE_RUNTIME",

third_party/xnnpack.buck.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,6 +2249,10 @@ def define_xnnpack(third_party, labels = [], XNNPACK_WINDOWS_AVX512F_ENABLED = F
22492249
exported_deps = [
22502250
":subgraph",
22512251
],
2252+
compiler_flags = select({
2253+
"DEFAULT": [],
2254+
"ovr_config//os:macos": ["-fvisibility=default"],
2255+
}),
22522256
platforms = (APPLE, ANDROID, CXX, WINDOWS),
22532257
preprocessor_flags = XNN_COMMON_PREPROCESSOR_FLAGS + [
22542258
"-DXNN_NO_Q8_OPERATORS",

0 commit comments

Comments
 (0)