From 04689088f20dc33281af70d2e7f7cf5649720092 Mon Sep 17 00:00:00 2001 From: TARGETS Exterminator Date: Thu, 29 Jan 2026 20:34:18 -0800 Subject: [PATCH] Rename build files from TARGETS to BUCK (group ID: -8431515600540859256) (#17053) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/17053 Reviewed By: bigfootjon Differential Revision: D91837713 --- backends/apple/coreml/BUCK | 144 ++++++++++++++++++++++++- backends/apple/coreml/TARGETS | 135 ----------------------- backends/apple/mps/BUCK | 105 +++++++++++++++++- backends/apple/mps/TARGETS | 98 ----------------- backends/arm/{TARGETS => BUCK} | 19 ++-- backends/arm/_passes/{TARGETS => BUCK} | 3 +- 6 files changed, 256 insertions(+), 248 deletions(-) delete mode 100644 backends/apple/coreml/TARGETS delete mode 100644 backends/apple/mps/TARGETS rename backends/arm/{TARGETS => BUCK} (84%) rename backends/arm/_passes/{TARGETS => BUCK} (83%) diff --git a/backends/apple/coreml/BUCK b/backends/apple/coreml/BUCK index e97d63e9998..d88197b294f 100644 --- a/backends/apple/coreml/BUCK +++ b/backends/apple/coreml/BUCK @@ -1,3 +1,5 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # Any targets that should be shared between fbcode and xplat must be defined in # targets.bzl. This file can contain xplat-only targets. @@ -8,9 +10,8 @@ load( load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load("@fbsource//xplat/executorch/runtime/core:targets.bzl", "build_sdk") -oncall("executorch") -runtime.cxx_library( +non_fbcode_target(_kind = runtime.cxx_library, name = "coreml", srcs = [ "runtime/delegate/ETCoreMLAsset.mm", @@ -133,7 +134,7 @@ _PROTOS = [ "WordTagger", ] -runtime.cxx_library( +non_fbcode_target(_kind = runtime.cxx_library, name = "proto", srcs = [ "fbsource//third-party/pypi/coremltools:exported-cpp-protoc[{}.pb.cc]".format(name) @@ -153,3 +154,140 @@ runtime.cxx_library( "//third-party/protobuf:fb-protobuf-lite", ], ) + +# !!!! fbcode/executorch/backends/apple/coreml/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. This file can contain fbcode-only targets. + +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + + +# TODO: this is a placeholder to support internal fbcode build. We should add the coreml backend target properly. +fbcode_target(_kind = runtime.python_library, + name = "coreml", + visibility = ["PUBLIC"], +) + +fbcode_target(_kind = runtime.python_library, + name = "backend", + srcs = glob([ + "compiler/*.py", + "logging.py", + ]), + visibility = ["PUBLIC"], + deps = [ + "fbsource//third-party/pypi/coremltools:coremltools", + ":executorchcoreml", + "//executorch/exir/backend:backend_details", + "//executorch/exir/backend:compile_spec_schema", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "partitioner", + srcs = glob([ + "partition/*.py", + "logging.py", + ]), + visibility = ["PUBLIC"], + deps = [ + "fbsource//third-party/pypi/coremltools:coremltools", + ":backend", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/backend:compile_spec_schema", + "//executorch/exir/backend:partitioner", + "//executorch/exir/backend:utils", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "quantizer", + srcs = glob([ + "quantizer/*.py", + ]), + visibility = ["PUBLIC"], +) + +fbcode_target(_kind = runtime.python_library, + name = "coreml_recipes", + srcs = [ + "recipes/__init__.py", + "recipes/coreml_recipe_provider.py" + ], + visibility = ["PUBLIC"], + deps = [ + "fbsource//third-party/pypi/coremltools:coremltools", + ":coreml_recipe_types", + ":backend", + ":partitioner", + ":quantizer", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/backend:compile_spec_schema", + "//executorch/exir/backend:partitioner", + "//executorch/exir/backend:utils", + "//executorch/export:lib", + "//executorch/runtime:runtime", # @manual + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "coreml_recipe_types", + srcs = [ + "recipes/coreml_recipe_types.py", + ], + visibility = ["PUBLIC"], + deps = [ + "//executorch/export:recipe", + ], +) + +fbcode_target(_kind = runtime.cxx_python_extension, + name = "executorchcoreml", + srcs = [ + "runtime/inmemoryfs/inmemory_filesystem.cpp", + "runtime/inmemoryfs/inmemory_filesystem_py.cpp", + "runtime/inmemoryfs/inmemory_filesystem_utils.cpp", + "runtime/inmemoryfs/memory_buffer.cpp", + "runtime/inmemoryfs/memory_stream.cpp", + "runtime/inmemoryfs/reversed_memory_stream.cpp", + "runtime/util/json_util.cpp", + ], + headers = glob([ + "runtime/inmemoryfs/**/*.hpp", + ]), + base_module = "executorch.backends.apple.coreml", + compiler_flags = [ + "-std=c++17", + ], + preprocessor_flags = [ + "-Iexecutorch/backends/apple/coreml/runtime/util", + ], + types = [ + "executorchcoreml.pyi", + ], + visibility = ["PUBLIC"], + deps = [ + "fbsource//third-party/nlohmann-json:nlohmann-json", + "fbsource//third-party/pybind11:pybind11", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test", + srcs = glob([ + "test/*.py", + ]), + deps = [ + "fbsource//third-party/pypi/coremltools:coremltools", + "fbsource//third-party/pypi/pytest:pytest", + ":partitioner", + ":quantizer", + ":coreml_recipes", + "//caffe2:torch", + "//pytorch/vision:torchvision", + "fbsource//third-party/pypi/scikit-learn:scikit-learn", + ], +) diff --git a/backends/apple/coreml/TARGETS b/backends/apple/coreml/TARGETS deleted file mode 100644 index 5d50c344a83..00000000000 --- a/backends/apple/coreml/TARGETS +++ /dev/null @@ -1,135 +0,0 @@ -# Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain fbcode-only targets. - -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -# TODO: this is a placeholder to support internal fbcode build. We should add the coreml backend target properly. -runtime.python_library( - name = "coreml", - visibility = ["PUBLIC"], -) - -runtime.python_library( - name = "backend", - srcs = glob([ - "compiler/*.py", - "logging.py", - ]), - visibility = ["PUBLIC"], - deps = [ - "fbsource//third-party/pypi/coremltools:coremltools", - ":executorchcoreml", - "//executorch/exir/backend:backend_details", - "//executorch/exir/backend:compile_spec_schema", - ], -) - -runtime.python_library( - name = "partitioner", - srcs = glob([ - "partition/*.py", - "logging.py", - ]), - visibility = ["PUBLIC"], - deps = [ - "fbsource//third-party/pypi/coremltools:coremltools", - ":backend", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/backend:compile_spec_schema", - "//executorch/exir/backend:partitioner", - "//executorch/exir/backend:utils", - ], -) - -runtime.python_library( - name = "quantizer", - srcs = glob([ - "quantizer/*.py", - ]), - visibility = ["PUBLIC"], -) - -runtime.python_library( - name = "coreml_recipes", - srcs = [ - "recipes/__init__.py", - "recipes/coreml_recipe_provider.py" - ], - visibility = ["PUBLIC"], - deps = [ - "fbsource//third-party/pypi/coremltools:coremltools", - ":coreml_recipe_types", - ":backend", - ":partitioner", - ":quantizer", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/backend:compile_spec_schema", - "//executorch/exir/backend:partitioner", - "//executorch/exir/backend:utils", - "//executorch/export:lib", - "//executorch/runtime:runtime", # @manual - ], -) - -runtime.python_library( - name = "coreml_recipe_types", - srcs = [ - "recipes/coreml_recipe_types.py", - ], - visibility = ["PUBLIC"], - deps = [ - "//executorch/export:recipe", - ], -) - -runtime.cxx_python_extension( - name = "executorchcoreml", - srcs = [ - "runtime/inmemoryfs/inmemory_filesystem.cpp", - "runtime/inmemoryfs/inmemory_filesystem_py.cpp", - "runtime/inmemoryfs/inmemory_filesystem_utils.cpp", - "runtime/inmemoryfs/memory_buffer.cpp", - "runtime/inmemoryfs/memory_stream.cpp", - "runtime/inmemoryfs/reversed_memory_stream.cpp", - "runtime/util/json_util.cpp", - ], - headers = glob([ - "runtime/inmemoryfs/**/*.hpp", - ]), - base_module = "executorch.backends.apple.coreml", - compiler_flags = [ - "-std=c++17", - ], - preprocessor_flags = [ - "-Iexecutorch/backends/apple/coreml/runtime/util", - ], - types = [ - "executorchcoreml.pyi", - ], - visibility = ["PUBLIC"], - deps = [ - "fbsource//third-party/nlohmann-json:nlohmann-json", - "fbsource//third-party/pybind11:pybind11", - ], -) - -runtime.python_test( - name = "test", - srcs = glob([ - "test/*.py", - ]), - deps = [ - "fbsource//third-party/pypi/coremltools:coremltools", - "fbsource//third-party/pypi/pytest:pytest", - ":partitioner", - ":quantizer", - ":coreml_recipes", - "//caffe2:torch", - "//pytorch/vision:torchvision", - "fbsource//third-party/pypi/scikit-learn:scikit-learn", - ], -) diff --git a/backends/apple/mps/BUCK b/backends/apple/mps/BUCK index 00fc5dd178c..5c20aac557b 100644 --- a/backends/apple/mps/BUCK +++ b/backends/apple/mps/BUCK @@ -1,3 +1,5 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # # Copyright (c) 2023 Apple Inc. All rights reserved. # Provided subject to the LICENSE file in the top level directory. @@ -9,9 +11,108 @@ load("@fbsource//tools/build_defs:default_platform_defs.bzl", "APPLE") load(":targets.bzl", "define_common_targets") -oncall("executorch") -define_common_targets( +non_fbcode_target(_kind = define_common_targets, is_xplat = True, platforms = [APPLE], ) + +# !!!! fbcode/executorch/backends/apple/mps/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +# +# Copyright (c) 2023 Apple Inc. All rights reserved. +# Provided subject to the LICENSE file in the top level directory. +# + +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. This file can contain fbcode-only targets. + +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load(":targets.bzl", "define_common_targets") + + +fbcode_target(_kind = define_common_targets,) + +fbcode_target(_kind = runtime.python_library, + name = "backend", + srcs = [ + "__init__.py", + "mps_preprocess.py", + ], + visibility = ["PUBLIC"], + deps = [ + ":operators", + ":serialization", + ":utils", + "//caffe2:torch", + "//executorch/exir/backend:backend_details", + "//executorch/exir/backend:compile_spec_schema", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "operators", + srcs = glob([ + "operators/*.py", + ]), + deps = [ + ":serialization", + ":utils", + "//executorch/backends/transforms:lib", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "partitioner", + srcs = glob([ + "partition/*.py", + ]), + visibility = ["PUBLIC"], + deps = [ + ":backend", + "//caffe2:torch", + "//executorch/exir/backend:compile_spec_schema", + "//executorch/exir/backend:partitioner", + "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "serialization", + srcs = glob([ + "serialization/*.py", + ]), + resources = [ + "serialization/schema.fbs", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "utils", + srcs = glob([ + "utils/*.py", + ]), + deps = [ + ":serialization", + "//caffe2:torch", + "//executorch/exir:lib", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test", + srcs = glob([ + "test/*.py", + ]), + deps = [ + ":backend", + ":partitioner", + "//caffe2:torch", + "//executorch/examples/models:models", + "//executorch/exir/tests:models", + "//executorch/extension/export_util:export_util", + "//executorch/devtools:lib", + "//executorch/devtools/bundled_program/serialize:lib", + "fbsource//third-party/pypi/pytest:pytest", + ], +) diff --git a/backends/apple/mps/TARGETS b/backends/apple/mps/TARGETS deleted file mode 100644 index d138b02e991..00000000000 --- a/backends/apple/mps/TARGETS +++ /dev/null @@ -1,98 +0,0 @@ -# -# Copyright (c) 2023 Apple Inc. All rights reserved. -# Provided subject to the LICENSE file in the top level directory. -# - -# Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain fbcode-only targets. - -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.python_library( - name = "backend", - srcs = [ - "__init__.py", - "mps_preprocess.py", - ], - visibility = ["PUBLIC"], - deps = [ - ":operators", - ":serialization", - ":utils", - "//caffe2:torch", - "//executorch/exir/backend:backend_details", - "//executorch/exir/backend:compile_spec_schema", - ], -) - -runtime.python_library( - name = "operators", - srcs = glob([ - "operators/*.py", - ]), - deps = [ - ":serialization", - ":utils", - "//executorch/backends/transforms:lib", - ], -) - -runtime.python_library( - name = "partitioner", - srcs = glob([ - "partition/*.py", - ]), - visibility = ["PUBLIC"], - deps = [ - ":backend", - "//caffe2:torch", - "//executorch/exir/backend:compile_spec_schema", - "//executorch/exir/backend:partitioner", - "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", - ], -) - -runtime.python_library( - name = "serialization", - srcs = glob([ - "serialization/*.py", - ]), - resources = [ - "serialization/schema.fbs", - ], -) - -runtime.python_library( - name = "utils", - srcs = glob([ - "utils/*.py", - ]), - deps = [ - ":serialization", - "//caffe2:torch", - "//executorch/exir:lib", - ], -) - -runtime.python_test( - name = "test", - srcs = glob([ - "test/*.py", - ]), - deps = [ - ":backend", - ":partitioner", - "//caffe2:torch", - "//executorch/examples/models:models", - "//executorch/exir/tests:models", - "//executorch/extension/export_util:export_util", - "//executorch/devtools:lib", - "//executorch/devtools/bundled_program/serialize:lib", - "fbsource//third-party/pypi/pytest:pytest", - ], -) diff --git a/backends/arm/TARGETS b/backends/arm/BUCK similarity index 84% rename from backends/arm/TARGETS rename to backends/arm/BUCK index 6e81adfed6f..4bd0dda38ac 100644 --- a/backends/arm/TARGETS +++ b/backends/arm/BUCK @@ -1,3 +1,4 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") # Copyright 2025 Arm Limited and/or its affiliates. # # This source code is licensed under the BSD-style license found in the @@ -6,7 +7,7 @@ # @noautodeps load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "constants", srcs = [ "constants.py", @@ -15,7 +16,7 @@ runtime.python_library( "//executorch/exir/dialects:lib", ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "common", srcs = glob(["common/*.py"]), deps = [ @@ -25,7 +26,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "arm_compile_spec", srcs = [ "common/arm_compile_spec.py", @@ -42,7 +43,7 @@ runtime.python_library( "//executorch/backends/arm/_passes:passes", ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "ethosu", srcs = [ "ethosu/__init__.py", @@ -58,7 +59,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "vgf", srcs = [ "vgf/__init__.py", @@ -74,7 +75,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "process_node", srcs = ["process_node.py"], deps = [ @@ -85,7 +86,7 @@ runtime.python_library( "//executorch/exir:lib", ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "arm_vela", srcs = [ "arm_vela.py", @@ -94,7 +95,7 @@ runtime.python_library( "fbsource//third-party/pypi/ethos-u-vela:ethos-u-vela", ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "arm_model_evaluator", srcs = [ "util/arm_model_evaluator.py", @@ -103,7 +104,7 @@ runtime.python_library( "//caffe2:torch", ] ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "_factory", srcs = [ "util/_factory.py" diff --git a/backends/arm/_passes/TARGETS b/backends/arm/_passes/BUCK similarity index 83% rename from backends/arm/_passes/TARGETS rename to backends/arm/_passes/BUCK index a75c63fb86e..e708fb05982 100644 --- a/backends/arm/_passes/TARGETS +++ b/backends/arm/_passes/BUCK @@ -1,6 +1,7 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "passes", srcs = glob(["*.py"]), deps = [