Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 44 additions & 51 deletions kernels/optimized/lib_defs.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@fbsource//tools/build_defs:default_platform_defs.bzl", "DEVSERVER_PLATFORM_REGEX")
load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
load("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl", "third_party_dep")
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
Expand Down Expand Up @@ -51,14 +50,12 @@ def get_vec_deps():
return []

def get_vec_cxx_preprocessor_flags():
preprocessor_flags = [
(
DEVSERVER_PLATFORM_REGEX,
[
"-DCPU_CAPABILITY_AVX2",
],
),
]
preprocessor_flags = select({
"DEFAULT": [],
"ovr_config//os:linux": [
"-DCPU_CAPABILITY_AVX2",
],
})
return preprocessor_flags

def get_vec_fbcode_preprocessor_flags():
Expand Down Expand Up @@ -127,32 +124,20 @@ def define_libs(is_fbcode=False):
exported_deps = [
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
cxx_platform_deps = select({
"DEFAULT": [
(
DEVSERVER_PLATFORM_REGEX,
[
"fbsource//third-party/sleef:sleef",
],
),
],
"ovr_config//cpu:arm64": [
(
DEVSERVER_PLATFORM_REGEX,
[
"fbsource//third-party/sleef:sleef",
],
),
],
}),
fbandroid_platform_deps = [
(
"^android-arm64.*$",
[
deps = select({
"DEFAULT": [],
"ovr_config//os:linux": [
"fbsource//third-party/sleef:sleef",
] if not runtime.is_oss else [],
}) + select({
"DEFAULT": [],
"ovr_config//os:android": select({
"DEFAULT": [],
"ovr_config//cpu:arm64": [
"fbsource//third-party/sleef:sleef",
],
),
],
] if not runtime.is_oss else [],
}),
}),
)

runtime.cxx_library(
Expand Down Expand Up @@ -187,6 +172,30 @@ def define_libs(is_fbcode=False):
]

for libblas_name, mkl_dep in [("libblas", "fbsource//third-party/mkl:mkl_lp64_omp"), ("libblas_mkl_noomp", "fbsource//third-party/mkl:mkl")]:
# Merge platform-specific kwargs
platform_kwargs = get_apple_framework_deps_kwargs(is_fbcode)
if not is_fbcode:
platform_kwargs.update({
"fbandroid_preprocessor_flags": select({
"DEFAULT": [],
"ovr_config//os:android": select({
"DEFAULT": [],
"ovr_config//cpu:arm64": [
"-DET_BUILD_WITH_BLAS",
],
}),
}),
"fbandroid_deps": select({
"DEFAULT": [],
"ovr_config//os:android": select({
"DEFAULT": [],
"ovr_config//cpu:arm64": [
"fbsource//arvr/third-party/eigen:eigen3_blas",
],
}),
}),
})

runtime.cxx_library(
name = libblas_name,
srcs = native.glob([
Expand All @@ -207,22 +216,6 @@ def define_libs(is_fbcode=False):
"@EXECUTORCH_CLIENTS",
],
preprocessor_flags = get_preprocessor_flags(),
fbandroid_platform_preprocessor_flags = [
(
"^android-arm64.*$",
[
"-DET_BUILD_WITH_BLAS",
],
),
],
fbandroid_platform_deps = [
(
"^android-arm64.*$",
[
"fbsource//arvr/third-party/eigen:eigen3_blas",
],
),
],
fbobjc_exported_preprocessor_flags = [
"-DET_BUILD_WITH_BLAS",
"-DET_BUILD_FOR_APPLE",
Expand All @@ -237,5 +230,5 @@ def define_libs(is_fbcode=False):
"//executorch/runtime/core/exec_aten:lib",
"//executorch/runtime/core/portable_type/c10/c10:aten_headers_for_executorch",
],
**get_apple_framework_deps_kwargs(is_fbcode),
**platform_kwargs,
)
3 changes: 1 addition & 2 deletions kernels/optimized/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def _lib_test_bin(name, extra_deps = [], in_cpu = False):
"//executorch/test/utils:utils",
"//executorch/kernels/optimized{}:{}".format(cpu_path, lib_root),
] + extra_deps,
cxx_platform_preprocessor_flags = get_vec_cxx_preprocessor_flags(),
preprocessor_flags = get_vec_preprocessor_flags(),
preprocessor_flags = get_vec_preprocessor_flags() + get_vec_cxx_preprocessor_flags(),
)

def define_common_targets():
Expand Down
14 changes: 6 additions & 8 deletions shim_et/xplat/executorch/kernels/optimized/lib_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ def get_vec_deps():
return []

def get_vec_cxx_preprocessor_flags():
preprocessor_flags = [
(
DEVSERVER_PLATFORM_REGEX,
[
"-DCPU_CAPABILITY_AVX2",
],
),
]
preprocessor_flags = select({
"DEFAULT": [],
"ovr_config//os:linux": [
"-DCPU_CAPABILITY_AVX2",
],
})
return preprocessor_flags

def get_vec_fbcode_preprocessor_flags():
Expand Down
Loading