@@ -16,37 +16,43 @@ load(
1616# access CPU vector intrinsics.
1717
1818def get_vec_preprocessor_flags ():
19- preprocessor_flags = select ({
20- "ovr_config//os:iphoneos" : [
21- "-DET_BUILD_ARM_VEC256_WITH_SLEEF" ,
22- ] if not runtime .is_oss else [],
23- "ovr_config//os:macos-arm64" : [
24- "-DET_BUILD_ARM_VEC256_WITH_SLEEF" ,
25- ] if not runtime .is_oss else [],
26- "ovr_config//os:android-arm64" : [
27- "-DET_BUILD_ARM_VEC256_WITH_SLEEF" ,
28- ] if not runtime .is_oss else [],
29- "DEFAULT" : [],
30- })
31- return preprocessor_flags
19+ if not runtime .is_oss :
20+ # various ovr_configs are not available in oss
21+ preprocessor_flags = select ({
22+ "ovr_config//os:iphoneos" : [
23+ "-DET_BUILD_ARM_VEC256_WITH_SLEEF" ,
24+ ] if not runtime .is_oss else [],
25+ "ovr_config//os:macos-arm64" : [
26+ "-DET_BUILD_ARM_VEC256_WITH_SLEEF" ,
27+ ] if not runtime .is_oss else [],
28+ "ovr_config//os:android-arm64" : [
29+ "-DET_BUILD_ARM_VEC256_WITH_SLEEF" ,
30+ ] if not runtime .is_oss else [],
31+ "DEFAULT" : [],
32+ })
33+ return preprocessor_flags
34+ return []
3235
3336def get_vec_deps ():
34- preprocessor_flags = select ({
35- "ovr_config//os:linux-x86_64" : [
36- "fbsource//third-party/sleef:sleef" ,
37- ] if not runtime .is_oss else [],
38- "ovr_config//os:iphoneos" : [
39- "fbsource//third-party/sleef:sleef_arm" ,
40- ] if not runtime .is_oss else [],
41- "ovr_config//os:macos-arm64" : [
42- "fbsource//third-party/sleef:sleef_arm" ,
43- ] if not runtime .is_oss else [],
44- "ovr_config//os:android-arm64" : [
45- "fbsource//third-party/sleef:sleef_arm" ,
46- ] if not runtime .is_oss else [],
47- "DEFAULT" : [],
48- })
49- return preprocessor_flags
37+ if not runtime .is_oss :
38+ # various ovr_configs are not available in oss
39+ deps = select ({
40+ "ovr_config//os:linux-x86_64" : [
41+ "fbsource//third-party/sleef:sleef" ,
42+ ] if not runtime .is_oss else [],
43+ "ovr_config//os:iphoneos" : [
44+ "fbsource//third-party/sleef:sleef_arm" ,
45+ ] if not runtime .is_oss else [],
46+ "ovr_config//os:macos-arm64" : [
47+ "fbsource//third-party/sleef:sleef_arm" ,
48+ ] if not runtime .is_oss else [],
49+ "ovr_config//os:android-arm64" : [
50+ "fbsource//third-party/sleef:sleef_arm" ,
51+ ] if not runtime .is_oss else [],
52+ "DEFAULT" : [],
53+ })
54+ return deps
55+ return []
5056
5157def get_vec_cxx_preprocessor_flags ():
5258 preprocessor_flags = [
@@ -65,6 +71,36 @@ def get_vec_fbcode_preprocessor_flags():
6571 ]
6672 return preprocessor_flags
6773
74+ def get_preprocessor_flags ():
75+ # various ovr_configs are not available in oss
76+ preprocessor_flags = select ({
77+ ":linux-x86_64" : [
78+ "-DET_BUILD_WITH_BLAS" ,
79+ ] if not runtime .is_oss else [],
80+ "DEFAULT" : [],
81+ })
82+
83+ if not runtime .is_oss :
84+ # various ovr_configs are not available in oss
85+ additional_preprocessor_flags = select ({
86+ "ovr_config//os:iphoneos" : [
87+ "-DET_BUILD_WITH_BLAS" ,
88+ "-DET_BUILD_FOR_APPLE" ,
89+ ] if not runtime .is_oss else [],
90+ "ovr_config//os:macos-arm64" : [
91+ "-DET_BUILD_WITH_BLAS" ,
92+ "-DET_BUILD_FOR_APPLE" ,
93+ ] if not runtime .is_oss else [],
94+ "ovr_config//os:macos-x86_64" : [
95+ "-DET_BUILD_WITH_BLAS" ,
96+ "-DET_BUILD_FOR_APPLE" ,
97+ ] if not runtime .is_oss else [],
98+ "DEFAULT" : [],
99+ })
100+ preprocessor_flags = preprocessor_flags + additional_preprocessor_flags
101+ return preprocessor_flags
102+
103+
68104# Currently, having a dependency on fbsource//third-party/sleef:sleef may cause
69105# duplicate symbol errors when linking fbcode targets in opt mode that also
70106# depend on ATen. This is because ATen accesses sleef via the third-party folder
@@ -128,24 +164,7 @@ def define_libs():
128164 "//executorch/..." ,
129165 "@EXECUTORCH_CLIENTS" ,
130166 ],
131- preprocessor_flags = select ({
132- ":linux-x86_64" : [
133- "-DET_BUILD_WITH_BLAS" ,
134- ] if not runtime .is_oss else [],
135- "ovr_config//os:iphoneos" : [
136- "-DET_BUILD_WITH_BLAS" ,
137- "-DET_BUILD_FOR_APPLE" ,
138- ] if not runtime .is_oss else [],
139- "ovr_config//os:macos-arm64" : [
140- "-DET_BUILD_WITH_BLAS" ,
141- "-DET_BUILD_FOR_APPLE" ,
142- ] if not runtime .is_oss else [],
143- "ovr_config//os:macos-x86_64" : [
144- "-DET_BUILD_WITH_BLAS" ,
145- "-DET_BUILD_FOR_APPLE" ,
146- ] if not runtime .is_oss else [],
147- "DEFAULT" : [],
148- }),
167+ preprocessor_flags = get_preprocessor_flags (),
149168 fbandroid_platform_preprocessor_flags = [
150169 (
151170 "^android-arm64.*$" ,
0 commit comments