diff --git a/extension/threadpool/targets.bzl b/extension/threadpool/targets.bzl index 5e7cf2c7dae..6ef55c42434 100644 --- a/extension/threadpool/targets.bzl +++ b/extension/threadpool/targets.bzl @@ -1,4 +1,5 @@ load("@fbsource//xplat/executorch/backends/xnnpack/third-party:third_party_libs.bzl", "third_party_dep") +load("@fbsource//xplat/executorch/build:build_variables.bzl", "THREADPOOL_SRCS") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") def define_common_targets(): @@ -8,11 +9,9 @@ def define_common_targets(): TARGETS and BUCK files that call this function. """ - _THREADPOOL_SRCS = [ - "thread_parallel.cpp", - "threadpool.cpp", - "threadpool_guard.cpp", - ] + (["fb/threadpool_use_n_threads.cpp"] if not runtime.is_oss else []) + _THREADPOOL_SRCS = THREADPOOL_SRCS + ( + ["fb/threadpool_use_n_threads.cpp"] if not runtime.is_oss else [] + ) _THREADPOOL_HEADERS = [ "threadpool.h", diff --git a/kernels/portable/cpu/pattern/targets.bzl b/kernels/portable/cpu/pattern/targets.bzl index 9d6f1a6885d..636c5d2127b 100644 --- a/kernels/portable/cpu/pattern/targets.bzl +++ b/kernels/portable/cpu/pattern/targets.bzl @@ -1,3 +1,4 @@ +load("@fbsource//xplat/executorch/build:build_variables.bzl", "PATTERN_SRCS") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") def define_common_targets(): @@ -49,11 +50,7 @@ def define_common_targets(): runtime.cxx_library( name = "pattern", - srcs = [ - "unary_ufunc_realhbbf16_to_bool.cpp", - "unary_ufunc_realhbbf16_to_floathbf16.cpp", - "unary_ufunc_realhbf16.cpp", - ], + srcs = PATTERN_SRCS, exported_headers = [ "pattern.h", ], diff --git a/runtime/executor/targets.bzl b/runtime/executor/targets.bzl index ec0fb19ff96..103ea299c34 100644 --- a/runtime/executor/targets.bzl +++ b/runtime/executor/targets.bzl @@ -1,3 +1,4 @@ +load("@fbsource//xplat/executorch/build:build_variables.bzl", "PROGRAM_NO_PRIM_OPS_SRCS") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime") def _program_preprocessor_flags(): @@ -93,11 +94,7 @@ def define_common_targets(): runtime.cxx_library( name = "program_no_prim_ops" + aten_suffix, - srcs = [ - "method.cpp", - "method_meta.cpp", - "program.cpp", - "tensor_parser_exec_aten.cpp", + srcs = PROGRAM_NO_PRIM_OPS_SRCS + [ "tensor_parser{}.cpp".format(aten_suffix if aten_mode else "_portable"), ], headers = [ diff --git a/runtime/platform/targets.bzl b/runtime/platform/targets.bzl index eecac8ae5db..457deed531e 100644 --- a/runtime/platform/targets.bzl +++ b/runtime/platform/targets.bzl @@ -1,3 +1,4 @@ +load("@fbsource//xplat/executorch/build:build_variables.bzl", "PLATFORM_SRCS") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":log.bzl", "get_et_logging_flags") @@ -73,13 +74,7 @@ def define_common_targets(): "runtime.h", "compat_unistd.h", ], - srcs = [ - "abort.cpp", - "log.cpp", - "platform.cpp", - "profiler.cpp", - "runtime.cpp", - ], + srcs = PLATFORM_SRCS, exported_preprocessor_flags = get_profiling_flags() + get_et_logging_flags(), exported_deps = [ "//executorch/runtime/platform:pal_interface", diff --git a/shim_et/xplat/executorch/build/build_variables.bzl b/shim_et/xplat/executorch/build/build_variables.bzl index e78cc08ef27..1838c14742f 100644 --- a/shim_et/xplat/executorch/build/build_variables.bzl +++ b/shim_et/xplat/executorch/build/build_variables.bzl @@ -32,7 +32,22 @@ EXECUTORCH_SRCS = [ "kernels/prim_ops/register_prim_ops.cpp", ] -EXECUTORCH_CORE_SRCS = [ +PROGRAM_NO_PRIM_OPS_SRCS = [ + "method.cpp", + "method_meta.cpp", + "program.cpp", + "tensor_parser_exec_aten.cpp", +] + +PLATFORM_SRCS = [ + "abort.cpp", + "log.cpp", + "platform.cpp", + "profiler.cpp", + "runtime.cpp", +] + +EXECUTORCH_CORE_SRCS = sorted([ "runtime/backend/interface.cpp", "runtime/core/evalue.cpp", "runtime/core/exec_aten/util/tensor_shape_to_c_string.cpp", @@ -40,19 +55,16 @@ EXECUTORCH_CORE_SRCS = [ "runtime/core/portable_type/tensor_impl.cpp", "runtime/core/tag.cpp", "runtime/core/tensor_layout.cpp", - "runtime/executor/method.cpp", - "runtime/executor/method_meta.cpp", - "runtime/executor/program.cpp", - "runtime/executor/pte_data_map.cpp", - "runtime/executor/tensor_parser_exec_aten.cpp", "runtime/executor/tensor_parser_portable.cpp", + "runtime/executor/pte_data_map.cpp", "runtime/kernel/operator_registry.cpp", - "runtime/platform/abort.cpp", - "runtime/platform/log.cpp", - "runtime/platform/platform.cpp", - "runtime/platform/profiler.cpp", - "runtime/platform/runtime.cpp", "schema/extended_header.cpp", +] + ["runtime/executor/" + x for x in PROGRAM_NO_PRIM_OPS_SRCS] + ["runtime/platform/" + x for x in PLATFORM_SRCS]) + +PATTERN_SRCS = [ + "unary_ufunc_realhbbf16_to_bool.cpp", + "unary_ufunc_realhbbf16_to_floathbf16.cpp", + "unary_ufunc_realhbf16.cpp", ] PORTABLE_KERNELS_SRCS = [ @@ -221,10 +233,7 @@ PORTABLE_KERNELS_SRCS = [ "kernels/portable/cpu/op_view_copy.cpp", "kernels/portable/cpu/op_where.cpp", "kernels/portable/cpu/op_zeros.cpp", - "kernels/portable/cpu/pattern/unary_ufunc_realhbbf16_to_bool.cpp", - "kernels/portable/cpu/pattern/unary_ufunc_realhbbf16_to_floathbf16.cpp", - "kernels/portable/cpu/pattern/unary_ufunc_realhbf16.cpp", -] +] + ["kernels/portable/cpu/pattern/" + x for x in PATTERN_SRCS] KERNELS_UTIL_ALL_DEPS_SRCS = [ "kernels/portable/cpu/util/activation_ops_util.cpp", @@ -354,12 +363,14 @@ EXTENSION_TENSOR_SRCS = [ "extension/tensor/tensor_ptr_maker.cpp", ] -EXTENSION_THREADPOOL_SRCS = [ - "extension/threadpool/thread_parallel.cpp", - "extension/threadpool/threadpool.cpp", - "extension/threadpool/threadpool_guard.cpp", +THREADPOOL_SRCS = [ + "thread_parallel.cpp", + "threadpool.cpp", + "threadpool_guard.cpp", ] +EXTENSION_THREADPOOL_SRCS = ["extension/threadpool/" + x for x in THREADPOOL_SRCS] + EXTENSION_TRAINING_SRCS = [ "extension/data_loader/file_data_loader.cpp", "extension/data_loader/mmap_data_loader.cpp",