Skip to content

Commit e606f1a

Browse files
committed
Update on "[Executorch] Make apple take accelerate path for blas"
For some reason fbobjc_exported_preprocessor_flags does not seems to work. Thus taking 'select' route which seems to work. Differential Revision: [D64499608](https://our.internmc.facebook.com/intern/diff/D64499608/) [ghstack-poisoned]
2 parents 7aa5330 + 95349e3 commit e606f1a

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

kernels/optimized/lib_defs.bzl

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,36 @@ def get_vec_fbcode_preprocessor_flags():
4343
]
4444
return preprocessor_flags
4545

46+
def get_preprocessor_flags():
47+
# various ovr_configs are not available in oss
48+
preprocessor_flags = select({
49+
":linux-x86_64": [
50+
"-DET_BUILD_WITH_BLAS",
51+
] if not runtime.is_oss else [],
52+
"DEFAULT": [],
53+
})
54+
55+
if not runtime.is_oss:
56+
# various ovr_configs are not available in oss
57+
additional_preprocessor_flags = select({
58+
"ovr_config//os:iphoneos": [
59+
"-DET_BUILD_WITH_BLAS",
60+
"-DET_BUILD_FOR_APPLE",
61+
] if not runtime.is_oss else [],
62+
"ovr_config//os:macos-arm64": [
63+
"-DET_BUILD_WITH_BLAS",
64+
"-DET_BUILD_FOR_APPLE",
65+
] if not runtime.is_oss else [],
66+
"ovr_config//os:macos-x86_64": [
67+
"-DET_BUILD_WITH_BLAS",
68+
"-DET_BUILD_FOR_APPLE",
69+
] if not runtime.is_oss else [],
70+
"DEFAULT": [],
71+
})
72+
preprocessor_flags = preprocessor_flags + additional_preprocessor_flags
73+
return preprocessor_flags
74+
75+
4676
# Currently, having a dependency on fbsource//third-party/sleef:sleef may cause
4777
# duplicate symbol errors when linking fbcode targets in opt mode that also
4878
# depend on ATen. This is because ATen accesses sleef via the third-party folder
@@ -131,24 +161,7 @@ def define_libs():
131161
"//executorch/...",
132162
"@EXECUTORCH_CLIENTS",
133163
],
134-
preprocessor_flags = select({
135-
":linux-x86_64": [
136-
"-DET_BUILD_WITH_BLAS",
137-
] if not runtime.is_oss else [],
138-
"ovr_config//os:iphoneos": [
139-
"-DET_BUILD_WITH_BLAS",
140-
"-DET_BUILD_FOR_APPLE",
141-
] if not runtime.is_oss else [],
142-
"ovr_config//os:macos-arm64": [
143-
"-DET_BUILD_WITH_BLAS",
144-
"-DET_BUILD_FOR_APPLE",
145-
] if not runtime.is_oss else [],
146-
"ovr_config//os:macos-x86_64": [
147-
"-DET_BUILD_WITH_BLAS",
148-
"-DET_BUILD_FOR_APPLE",
149-
] if not runtime.is_oss else [],
150-
"DEFAULT": [],
151-
}),
164+
preprocessor_flags = get_preprocessor_flags(),
152165
fbandroid_platform_preprocessor_flags = [
153166
(
154167
"^android-arm64.*$",

0 commit comments

Comments
 (0)