Skip to content

Revert D61290864 #4906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2024
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
81 changes: 40 additions & 41 deletions extension/llm/custom_ops/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,47 @@ def define_common_targets():
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""
for mkl_dep in ["", "_mkl_lp64_omp"]:
runtime.cxx_library(
name = "custom_ops" + mkl_dep,
srcs = ["op_sdpa.cpp"],
exported_headers = ["op_sdpa.h"],
exported_deps = [
"//executorch/runtime/kernel:kernel_includes",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/optimized:libblas{}".format(mkl_dep),
"//executorch/kernels/optimized:libvec",
"//executorch/extension/kernel_util:kernel_util",
"//executorch/extension/parallel:thread_parallel",
"//executorch/backends/xnnpack/threadpool:threadpool",
],
compiler_flags = ["-Wno-missing-prototypes", "-Wno-global-constructors"],
visibility = [
"//executorch/...",
"//executorch/extension/llm/custom_ops/...",
"@EXECUTORCH_CLIENTS",
],
# @lint-ignore BUCKLINT link_whole
link_whole = True,
force_static = True,
)
runtime.cxx_library(
name = "custom_ops",
srcs = ["op_sdpa.cpp"],
exported_headers = ["op_sdpa.h"],
exported_deps = [
"//executorch/runtime/kernel:kernel_includes",
"//executorch/kernels/portable/cpu:scalar_utils",
"//executorch/kernels/optimized:libblas",
"//executorch/kernels/optimized:libvec",
"//executorch/extension/kernel_util:kernel_util",
"//executorch/extension/parallel:thread_parallel",
"//executorch/backends/xnnpack/threadpool:threadpool",
],
compiler_flags = ["-Wno-missing-prototypes", "-Wno-global-constructors"],
visibility = [
"//executorch/...",
"//executorch/extension/llm/custom_ops/...",
"@EXECUTORCH_CLIENTS",
],
# @lint-ignore BUCKLINT link_whole
link_whole = True,
force_static = True,
)

runtime.cxx_library(
name = "custom_ops_aot_lib" + mkl_dep,
srcs = [
"op_sdpa_aot.cpp",
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
external_deps = [
"libtorch",
],
deps = [
":custom_ops" + mkl_dep,
"//executorch/extension/aten_util:aten_bridge",
],
)
runtime.cxx_library(
name = "custom_ops_aot_lib",
srcs = [
"op_sdpa_aot.cpp",
],
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
external_deps = [
"libtorch",
],
deps = [
":custom_ops",
"//executorch/extension/aten_util:aten_bridge",
],
)

runtime.python_library(
name = "custom_ops_aot_py",
Expand Down
91 changes: 40 additions & 51 deletions kernels/optimized/lib_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,55 +99,44 @@ def define_libs():
],
)

for libblas_name, mkl_dep in [("libblas", "fbsource//third-party/mkl:mkl"), ("libblas_mkl_lp64_omp", "fbsource//third-party/mkl:mkl_lp64_omp")]:
runtime.cxx_library(
name = libblas_name,
srcs = native.glob([
"blas/**/*.cpp",
]),
exported_headers = native.glob([
"blas/**/*.h",
]),
header_namespace = "executorch/kernels/optimized",
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
preprocessor_flags = select({
"DEFAULT": [],
"ovr_config//os:linux-x86_64": [
runtime.cxx_library(
name = "libblas",
srcs = native.glob([
"blas/**/*.cpp",
]),
exported_headers = native.glob([
"blas/**/*.h",
]),
header_namespace = "executorch/kernels/optimized",
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
fbandroid_platform_preprocessor_flags = [
(
"^android-arm64.*$",
[
"-DET_BUILD_WITH_BLAS",
] if not runtime.is_oss else [],
}),
fbandroid_platform_preprocessor_flags = [
(
"^android-arm64.*$",
[
"-DET_BUILD_WITH_BLAS",
],
),
],
fbandroid_platform_deps = [
(
"^android-arm64.*$",
[
"fbsource//third-party/openblas:openblas",
],
),
],
fbobjc_exported_preprocessor_flags = [
"-DET_BUILD_WITH_BLAS",
"-DET_BUILD_FOR_APPLE",
],
fbobjc_frameworks = [
"Accelerate",
],
deps = select({
"DEFAULT": [],
"ovr_config//os:linux-x86_64": [mkl_dep] if not runtime.is_oss else [],
}),
exported_deps = [
"//executorch/kernels/optimized:libutils",
"//executorch/runtime/core/exec_aten:lib",
],
)
],
),
],
fbandroid_platform_deps = [
(
"^android-arm64.*$",
[
"fbsource//third-party/openblas:openblas",
],
),
],
fbobjc_exported_preprocessor_flags = [
"-DET_BUILD_WITH_BLAS",
"-DET_BUILD_FOR_APPLE",
],
fbobjc_frameworks = [
"Accelerate",
],
exported_deps = [
"//executorch/kernels/optimized:libutils",
"//executorch/runtime/core/exec_aten:lib",
],
)
Loading