Skip to content

Reapply "Depend on extension/threadpool, not thread_parallel_interface, in buck (#9511)" #9890

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 2 commits into from
Apr 4, 2025
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
2 changes: 1 addition & 1 deletion extension/parallel/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def define_common_targets():
"@EXECUTORCH_CLIENTS",
],
deps = [
"//executorch/runtime/kernel:thread_parallel_interface",
"//executorch/extension/threadpool:threadpool",
],
)
34 changes: 33 additions & 1 deletion extension/threadpool/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def define_common_targets():
] + (["fb/threadpool_use_n_threads.h"] if not runtime.is_oss else [])

runtime.cxx_library(
name = "threadpool",
name = "threadpool_lib",
srcs = _THREADPOOL_SRCS,
deps = [
"//executorch/runtime/core:core",
Expand All @@ -45,6 +45,38 @@ def define_common_targets():
],
)

runtime.cxx_library(
name = "threadpool",
# TODO: OSS doesn't have os:iphoneos. Sync buck2 prelude
# update to add it and remove duplication.
exported_deps = (select({
# Major operating systems should be able to use threadpool.
"ovr_config//os:linux": [":threadpool_lib"],
"ovr_config//os:macos": [":threadpool_lib"],
"ovr_config//os:windows": [":threadpool_lib"],
"ovr_config//os:android": [":threadpool_lib"],
"ovr_config//os:iphoneos": [":threadpool_lib"],
# Machines without an operating system shouldn't.
"ovr_config//os:none": ["//executorch/runtime/kernel:thread_parallel_interface"],
# If we don't know what it is, disable threadpool out of caution.
"DEFAULT": ["//executorch/runtime/kernel:thread_parallel_interface"],
}) if not runtime.is_oss else select({
# Major operating systems should be able to use threadpool.
"ovr_config//os:linux": [":threadpool_lib"],
"ovr_config//os:macos": [":threadpool_lib"],
"ovr_config//os:windows": [":threadpool_lib"],
"ovr_config//os:android": [":threadpool_lib"],
# Machines without an operating system shouldn't.
"ovr_config//os:none": ["//executorch/runtime/kernel:thread_parallel_interface"],
# If we don't know what it is, disable threadpool out of caution.
"DEFAULT": ["//executorch/runtime/kernel:thread_parallel_interface"],
})),
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
],
)

runtime.cxx_library(
name = "cpuinfo_utils",
srcs = [
Expand Down
2 changes: 1 addition & 1 deletion kernels/optimized/cpu/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ _OPTIMIZED_ATEN_OPS = (
op_target(
name = "op_where",
deps = [
"//executorch/extension/threadpool:threadpool",
"//executorch/kernels/portable/cpu/util:elementwise_util",
"//executorch/runtime/kernel:thread_parallel_interface",
],
),
)
Expand Down
2 changes: 1 addition & 1 deletion kernels/optimized/lib_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ def define_libs(is_fbcode=False):
"DEFAULT": [],
}) + LIBBLAS_DEPS,
exported_deps = [
"//executorch/extension/threadpool:threadpool",
"//executorch/kernels/optimized:libutils",
"//executorch/runtime/core/exec_aten:lib",
"//executorch/runtime/kernel:thread_parallel_interface",
],
**get_apple_framework_deps_kwargs(is_fbcode),
)
8 changes: 4 additions & 4 deletions kernels/portable/cpu/util/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def define_common_targets():
runtime.cxx_library(
name = "all_deps",
deps = [
"//executorch/extension/threadpool:threadpool",
"//executorch/kernels/portable/cpu/util:functional_util",
"//executorch/kernels/portable/cpu/util:broadcast_util",
"//executorch/kernels/portable/cpu/util:kernel_ops_util",
Expand All @@ -32,7 +33,6 @@ def define_common_targets():
"//executorch/kernels/portable/cpu/util:slice_util",
"//executorch/kernels/portable/cpu/util:elementwise_util",
"//executorch/kernels/portable/cpu/util:upsample_util",
"//executorch/runtime/kernel:thread_parallel_interface",
],
visibility = ["//executorch/...", "@EXECUTORCH_CLIENTS"],
)
Expand Down Expand Up @@ -111,7 +111,7 @@ def define_common_targets():
":broadcast_util",
":dtype_util",
"//executorch/runtime/kernel:kernel_runtime_context",
"//executorch/runtime/kernel:thread_parallel_interface",
"//executorch/extension/threadpool:threadpool",
],
deps = [
"//executorch/kernels/portable/cpu:scalar_utils",
Expand Down Expand Up @@ -245,7 +245,7 @@ def define_common_targets():
srcs = [],
exported_headers = ["functional_util.h"],
exported_deps = [
"//executorch/runtime/kernel:thread_parallel_interface",
"//executorch/extension/threadpool:threadpool",
],
deps = [
"//executorch/runtime/kernel:kernel_includes",
Expand Down Expand Up @@ -319,7 +319,7 @@ def define_common_targets():
"//executorch/runtime/core/exec_aten/util:tensor_util{}".format(suffix),
],
exported_deps = [
"//executorch/runtime/kernel:thread_parallel_interface",
"//executorch/extension/threadpool:threadpool",
],
exported_preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [],
visibility = [
Expand Down
4 changes: 2 additions & 2 deletions runtime/kernel/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def define_common_targets():
"//executorch/runtime/core/portable_type/c10/c10:c10",
"//executorch/runtime/platform:platform",
],
# Don't depend on this target, depend on //executorch/extension/threadpool:threadpool.
visibility = [
"//executorch/...",
"@EXECUTORCH_CLIENTS",
"//executorch/extension/threadpool/...",
],
)

Expand Down
Loading