Skip to content

Commit 4e2f6df

Browse files
jaejunkufacebook-github-bot
authored andcommitted
Rm platform args in executorch (#16140)
Summary: Get rid of platform args around the repo to unblock modernization with platforms. Platform args were only needed in buck1 Reviewed By: rexzhang123 Differential Revision: D88612868
1 parent 9156fff commit 4e2f6df

File tree

3 files changed

+51
-61
lines changed

3 files changed

+51
-61
lines changed

kernels/optimized/lib_defs.bzl

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("@fbsource//tools/build_defs:default_platform_defs.bzl", "DEVSERVER_PLATFORM_REGEX")
21
load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
32
load("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl", "third_party_dep")
43
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
@@ -51,14 +50,12 @@ def get_vec_deps():
5150
return []
5251

5352
def get_vec_cxx_preprocessor_flags():
54-
preprocessor_flags = [
55-
(
56-
DEVSERVER_PLATFORM_REGEX,
57-
[
58-
"-DCPU_CAPABILITY_AVX2",
59-
],
60-
),
61-
]
53+
preprocessor_flags = select({
54+
"DEFAULT": [],
55+
"ovr_config//os:linux": [
56+
"-DCPU_CAPABILITY_AVX2",
57+
],
58+
})
6259
return preprocessor_flags
6360

6461
def get_vec_fbcode_preprocessor_flags():
@@ -127,32 +124,20 @@ def define_libs(is_fbcode=False):
127124
exported_deps = [
128125
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
129126
],
130-
cxx_platform_deps = select({
131-
"DEFAULT": [
132-
(
133-
DEVSERVER_PLATFORM_REGEX,
134-
[
135-
"fbsource//third-party/sleef:sleef",
136-
],
137-
),
138-
],
139-
"ovr_config//cpu:arm64": [
140-
(
141-
DEVSERVER_PLATFORM_REGEX,
142-
[
143-
"fbsource//third-party/sleef:sleef",
144-
],
145-
),
146-
],
147-
}),
148-
fbandroid_platform_deps = [
149-
(
150-
"^android-arm64.*$",
151-
[
127+
deps = select({
128+
"DEFAULT": [],
129+
"ovr_config//os:linux": [
130+
"fbsource//third-party/sleef:sleef",
131+
] if not runtime.is_oss else [],
132+
}) + select({
133+
"DEFAULT": [],
134+
"ovr_config//os:android": select({
135+
"DEFAULT": [],
136+
"ovr_config//cpu:arm64": [
152137
"fbsource//third-party/sleef:sleef",
153-
],
154-
),
155-
],
138+
] if not runtime.is_oss else [],
139+
}),
140+
}),
156141
)
157142

158143
runtime.cxx_library(
@@ -187,6 +172,30 @@ def define_libs(is_fbcode=False):
187172
]
188173

189174
for libblas_name, mkl_dep in [("libblas", "fbsource//third-party/mkl:mkl_lp64_omp"), ("libblas_mkl_noomp", "fbsource//third-party/mkl:mkl")]:
175+
# Merge platform-specific kwargs
176+
platform_kwargs = get_apple_framework_deps_kwargs(is_fbcode)
177+
if not is_fbcode:
178+
platform_kwargs.update({
179+
"fbandroid_preprocessor_flags": select({
180+
"DEFAULT": [],
181+
"ovr_config//os:android": select({
182+
"DEFAULT": [],
183+
"ovr_config//cpu:arm64": [
184+
"-DET_BUILD_WITH_BLAS",
185+
],
186+
}),
187+
}),
188+
"fbandroid_deps": select({
189+
"DEFAULT": [],
190+
"ovr_config//os:android": select({
191+
"DEFAULT": [],
192+
"ovr_config//cpu:arm64": [
193+
"fbsource//arvr/third-party/eigen:eigen3_blas",
194+
],
195+
}),
196+
}),
197+
})
198+
190199
runtime.cxx_library(
191200
name = libblas_name,
192201
srcs = native.glob([
@@ -207,22 +216,6 @@ def define_libs(is_fbcode=False):
207216
"@EXECUTORCH_CLIENTS",
208217
],
209218
preprocessor_flags = get_preprocessor_flags(),
210-
fbandroid_platform_preprocessor_flags = [
211-
(
212-
"^android-arm64.*$",
213-
[
214-
"-DET_BUILD_WITH_BLAS",
215-
],
216-
),
217-
],
218-
fbandroid_platform_deps = [
219-
(
220-
"^android-arm64.*$",
221-
[
222-
"fbsource//arvr/third-party/eigen:eigen3_blas",
223-
],
224-
),
225-
],
226219
fbobjc_exported_preprocessor_flags = [
227220
"-DET_BUILD_WITH_BLAS",
228221
"-DET_BUILD_FOR_APPLE",
@@ -237,5 +230,5 @@ def define_libs(is_fbcode=False):
237230
"//executorch/runtime/core/exec_aten:lib",
238231
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
239232
],
240-
**get_apple_framework_deps_kwargs(is_fbcode),
233+
**platform_kwargs,
241234
)

kernels/optimized/test/targets.bzl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def _lib_test_bin(name, extra_deps = [], in_cpu = False):
2626
"//executorch/test/utils:utils",
2727
"//executorch/kernels/optimized{}:{}".format(cpu_path, lib_root),
2828
] + extra_deps,
29-
cxx_platform_preprocessor_flags = get_vec_cxx_preprocessor_flags(),
30-
preprocessor_flags = get_vec_preprocessor_flags(),
29+
preprocessor_flags = get_vec_preprocessor_flags() + get_vec_cxx_preprocessor_flags(),
3130
)
3231

3332
def define_common_targets():

shim_et/xplat/executorch/kernels/optimized/lib_defs.bzl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,12 @@ def get_vec_deps():
5858
return []
5959

6060
def get_vec_cxx_preprocessor_flags():
61-
preprocessor_flags = [
62-
(
63-
DEVSERVER_PLATFORM_REGEX,
64-
[
65-
"-DCPU_CAPABILITY_AVX2",
66-
],
67-
),
68-
]
61+
preprocessor_flags = select({
62+
"DEFAULT": [],
63+
"ovr_config//os:linux": [
64+
"-DCPU_CAPABILITY_AVX2",
65+
],
66+
})
6967
return preprocessor_flags
7068

7169
def get_vec_fbcode_preprocessor_flags():

0 commit comments

Comments
 (0)