Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
37c079c
[Executorch] Make apple take accelerate path for blas
kimishpatel Oct 28, 2024
6af342c
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 28, 2024
de08ff7
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 28, 2024
27d9a6d
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 29, 2024
8d12f97
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 29, 2024
ff2084b
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 29, 2024
66f5c75
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
6ec25a6
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
7aa5330
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
e606f1a
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
44327b0
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
ad70f69
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
e9ffbf0
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
1d2cf83
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 30, 2024
dc81679
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 31, 2024
4c3d41a
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 31, 2024
7440bec
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 31, 2024
0fc1a2e
Update on "[Executorch] Make apple take accelerate path for blas"
kimishpatel Oct 31, 2024
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
2 changes: 1 addition & 1 deletion kernels/optimized/TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ load(":targets.bzl", "define_common_targets")

oncall("executorch")

define_common_targets()
define_common_targets(True)
57 changes: 47 additions & 10 deletions kernels/optimized/lib_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,56 @@ def get_vec_fbcode_preprocessor_flags():
]
return preprocessor_flags

def get_apple_framework_deps_kwargs(is_fbcode):
# various ovr_configs are not available in oss
if not runtime.is_oss and not is_fbcode:
# Jump through few hoops since 'frameworks' is not a valid kwarg
# for some buck rules
frameworks = {'frameworks': select({
"DEFAULT": [],
"ovr_config//os:iphoneos": ["$SDKROOT/System/Library/Frameworks/Accelerate.framework"],
"ovr_config//os:macos-arm64": ["$SDKROOT/System/Library/Frameworks/Accelerate.framework"],
"ovr_config//os:macos-x86_64": ["$SDKROOT/System/Library/Frameworks/Accelerate.framework"],
})}
return frameworks
return {'fbobjc_frameworks': ["Accelerate"]}

def get_preprocessor_flags():
# various ovr_configs are not available in oss
preprocessor_flags = select({
":linux-x86_64": [
"-DET_BUILD_WITH_BLAS",
] if not runtime.is_oss else [],
"DEFAULT": [],
})

if not runtime.is_oss:
# various ovr_configs are not available in oss
additional_preprocessor_flags = select({
"ovr_config//os:iphoneos": [
"-DET_BUILD_WITH_BLAS",
"-DET_BUILD_FOR_APPLE",
] if not runtime.is_oss else [],
"ovr_config//os:macos-arm64": [
"-DET_BUILD_WITH_BLAS",
"-DET_BUILD_FOR_APPLE",
] if not runtime.is_oss else [],
"ovr_config//os:macos-x86_64": [
"-DET_BUILD_WITH_BLAS",
"-DET_BUILD_FOR_APPLE",
] if not runtime.is_oss else [],
"DEFAULT": [],
})
preprocessor_flags = preprocessor_flags + additional_preprocessor_flags
return preprocessor_flags


# Currently, having a dependency on fbsource//third-party/sleef:sleef may cause
# duplicate symbol errors when linking fbcode targets in opt mode that also
# depend on ATen. This is because ATen accesses sleef via the third-party folder
# in caffe2 (caffe2/third-party//sleef:sleef).
# TODO(ssjia): Enable -DCPU_CAPABILITY_AVX2 in fbcode, which requires sleef.
def define_libs():
def define_libs(is_fbcode=False):
runtime.cxx_library(
name = "libvec",
srcs = [],
Expand Down Expand Up @@ -131,12 +175,7 @@ def define_libs():
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
preprocessor_flags = select({
":linux-x86_64": [
"-DET_BUILD_WITH_BLAS",
] if not runtime.is_oss else [],
"DEFAULT": [],
}),
preprocessor_flags = get_preprocessor_flags(),
fbandroid_platform_preprocessor_flags = [
(
"^android-arm64.*$",
Expand All @@ -157,9 +196,6 @@ def define_libs():
"-DET_BUILD_WITH_BLAS",
"-DET_BUILD_FOR_APPLE",
],
fbobjc_frameworks = [
"Accelerate",
],
deps = select({
":linux-x86_64": [mkl_dep] if not runtime.is_oss else [],
"DEFAULT": [],
Expand All @@ -169,4 +205,5 @@ def define_libs():
"//executorch/kernels/optimized:libutils",
"//executorch/runtime/core/exec_aten:lib",
],
**get_apple_framework_deps_kwargs(is_fbcode),
)
4 changes: 2 additions & 2 deletions kernels/optimized/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib")
load(":lib_defs.bzl", "define_libs")

def define_common_targets():
def define_common_targets(is_fbcode=False):
"""Defines targets that should be shared between fbcode and xplat.

The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""

define_libs()
define_libs(is_fbcode)

runtime.export_file(
name = "optimized.yaml",
Expand Down
Loading