Skip to content

Commit d6c8622

Browse files
committed
Update on "[Executorch] optimized sigmoid"
basically use exp approximation using sleef instead of std::exp Differential Revision: [D64156864](https://our.internmc.facebook.com/intern/diff/D64156864/) [ghstack-poisoned]
2 parents 7b1ac4b + 71b3eeb commit d6c8622

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

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

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,46 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
1616
# functions in order to declare the required compiler flags needed in order to
1717
# access CPU vector intrinsics.
1818

19-
def get_vec_android_preprocessor_flags():
20-
preprocessor_flags = [
21-
(
22-
"^android-arm64.*$",
23-
[
19+
# This oopy from kernels/optimized/lib_defs.bzl is not necessary.
20+
# This file really needs to be removed
21+
def get_vec_preprocessor_flags():
22+
if not runtime.is_oss:
23+
# various ovr_configs are not available in oss
24+
preprocessor_flags = select({
25+
"ovr_config//os:iphoneos": [
2426
"-DET_BUILD_ARM_VEC256_WITH_SLEEF",
25-
],
26-
),
27-
]
28-
return preprocessor_flags
27+
] if not runtime.is_oss else [],
28+
"ovr_config//os:macos-arm64": [
29+
"-DET_BUILD_ARM_VEC256_WITH_SLEEF",
30+
] if not runtime.is_oss else [],
31+
"ovr_config//os:android-arm64": [
32+
"-DET_BUILD_ARM_VEC256_WITH_SLEEF",
33+
] if not runtime.is_oss else [],
34+
"DEFAULT": [],
35+
})
36+
return preprocessor_flags
37+
return []
38+
39+
def get_vec_deps():
40+
if not runtime.is_oss:
41+
# various ovr_configs are not available in oss
42+
deps = select({
43+
"ovr_config//os:linux-x86_64": [
44+
"fbsource//third-party/sleef:sleef",
45+
] if not runtime.is_oss else [],
46+
"ovr_config//os:iphoneos": [
47+
"fbsource//third-party/sleef:sleef_arm",
48+
] if not runtime.is_oss else [],
49+
"ovr_config//os:macos-arm64": [
50+
"fbsource//third-party/sleef:sleef_arm",
51+
] if not runtime.is_oss else [],
52+
"ovr_config//os:android-arm64": [
53+
"fbsource//third-party/sleef:sleef_arm",
54+
] if not runtime.is_oss else [],
55+
"DEFAULT": [],
56+
})
57+
return deps
58+
return []
2959

3060
def get_vec_cxx_preprocessor_flags():
3161
preprocessor_flags = [

0 commit comments

Comments
 (0)