diff --git a/backends/cortex_m/TARGETS b/backends/cortex_m/BUCK similarity index 80% rename from backends/cortex_m/TARGETS rename to backends/cortex_m/BUCK index 1b73bb03bfc..4e35bd0ef00 100644 --- a/backends/cortex_m/TARGETS +++ b/backends/cortex_m/BUCK @@ -4,11 +4,13 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") load("@fbcode_macros//build_defs:python_library.bzl", "python_library") oncall("executorch") -python_library( +fbcode_target( + _kind = python_library, name = "quantizer_reporter", srcs = [ "quantizer_reporter.py", @@ -20,7 +22,8 @@ python_library( ], ) -python_library( +fbcode_target( + _kind = python_library, name = "cmsis_nn", srcs = [ "library/__init__.py", @@ -31,7 +34,8 @@ python_library( ], ) -python_library( +fbcode_target( + _kind = python_library, name = "target_config", srcs = [ "target_config.py", diff --git a/backends/cortex_m/quantizer/BUCK b/backends/cortex_m/quantizer/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/backends/cortex_m/quantizer/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/backends/cortex_m/quantizer/TARGETS b/backends/cortex_m/quantizer/TARGETS deleted file mode 100644 index 90d57e81734..00000000000 --- a/backends/cortex_m/quantizer/TARGETS +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the BSD-style license found in the -# LICENSE file in the root directory of this source tree. - -load("@fbcode_macros//build_defs:python_library.bzl", "python_library") - -oncall("executorch") - -python_library( - name = "quantizer", - srcs = [ - "__init__.py", - "node_finders.py", - "pattern_checkers.py", - "pattern_matcher.py", - "quantization_configs.py", - "quantizer.py", - "quantizer_support.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/arm:common", - "//executorch/backends/arm:constants", - "//executorch/backends/arm/quantizer:arm_quantizer_utils", - "//executorch/backends/arm/quantizer:quantization_annotator", - "//executorch/backends/arm/quantizer:quantization_config", - "//executorch/backends/cortex_m:quantizer_reporter", - "//executorch/backends/cortex_m/passes:cortex_passes", - "//pytorch/ao:torchao", - "fbsource//third-party/pypi/tabulate:tabulate", - ], -) - - -python_library( - name = "quantization_configs", - srcs = [ - "quantization_configs.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/arm/quantizer:arm_quantizer_utils", - "//executorch/backends/arm/quantizer:quantization_config", - "//executorch/backends/cortex_m:quantizer_reporter", - "//pytorch/ao:torchao", - ], -) diff --git a/backends/cortex_m/quantizer/targets.bzl b/backends/cortex_m/quantizer/targets.bzl new file mode 100644 index 00000000000..73832e400fc --- /dev/null +++ b/backends/cortex_m/quantizer/targets.bzl @@ -0,0 +1,53 @@ +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + # Copyright (c) Meta Platforms, Inc. and affiliates. + # All rights reserved. + # + # This source code is licensed under the BSD-style license found in the + # LICENSE file in the root directory of this source tree. + + + + python_library( + name = "quantizer", + srcs = [ + "__init__.py", + "node_finders.py", + "pattern_checkers.py", + "pattern_matcher.py", + "quantization_configs.py", + "quantizer.py", + "quantizer_support.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/arm:common", + "//executorch/backends/arm:constants", + "//executorch/backends/arm/quantizer:arm_quantizer_utils", + "//executorch/backends/arm/quantizer:quantization_annotator", + "//executorch/backends/arm/quantizer:quantization_config", + "//executorch/backends/cortex_m:quantizer_reporter", + "//executorch/backends/cortex_m/passes:cortex_passes", + "//pytorch/ao:torchao", + "fbsource//third-party/pypi/tabulate:tabulate", + ], + ) + + + python_library( + name = "quantization_configs", + srcs = [ + "quantization_configs.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/arm/quantizer:arm_quantizer_utils", + "//executorch/backends/arm/quantizer:quantization_config", + "//executorch/backends/cortex_m:quantizer_reporter", + "//pytorch/ao:torchao", + ], + ) diff --git a/backends/cortex_m/targets.bzl b/backends/cortex_m/targets.bzl new file mode 100644 index 00000000000..b60804444aa --- /dev/null +++ b/backends/cortex_m/targets.bzl @@ -0,0 +1,35 @@ +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + # Copyright 2026 Arm Limited and/or its affiliates. + # All rights reserved. + # + # This source code is licensed under the BSD-style license found in the + # LICENSE file in the root directory of this source tree. + + + + python_library( + name = "quantizer_reporter", + srcs = [ + "quantizer_reporter.py", + ], + deps = [ + "//caffe2:torch", + "//pytorch/ao:torchao", + "fbsource//third-party/pypi/tabulate:tabulate", + ], + ) + + python_library( + name = "target_config", + srcs = [ + "target_config.py", + ], + deps = [ + "fbsource//third-party/cmsis-nn:cmsis_nn_py", + ], + ) diff --git a/backends/example/BUCK b/backends/example/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/backends/example/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/backends/example/TARGETS b/backends/example/TARGETS deleted file mode 100644 index 48fb971428b..00000000000 --- a/backends/example/TARGETS +++ /dev/null @@ -1,60 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -runtime.python_library( - name = "example_quantizer", - srcs = [ - "example_quantizer.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/example/example_operators:example_operators_lib", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - ], -) - -runtime.python_library( - name = "example_backend", - srcs = [ - "example_backend.py", - ], - deps = [ - "//executorch/backends/example/example_backend_delegate_passes:lib", - "//executorch/exir/backend:backend_details", - "//executorch/exir/backend:compile_spec_schema", - ], -) - -runtime.python_library( - name = "example_partitioner", - srcs = [ - "example_partitioner.py", - ], - deps = [ - ":example_backend", - "//caffe2:torch", - "//executorch/backends/example/example_operators:example_operators_lib", - "//executorch/exir:graph_module", - "//executorch/exir/backend:partitioner", - "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", - "//executorch/exir/dialects:lib", - ], -) - -python_unittest( - name = "test_example_delegate", - srcs = [ - "test_example_delegate.py", - ], - deps = [ - ":example_partitioner", - ":example_quantizer", - "//caffe2:torch", - "//executorch/exir:delegate", - "//executorch/exir:lib", - "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", - "//pytorch/vision:torchvision", - ], -) diff --git a/backends/example/targets.bzl b/backends/example/targets.bzl new file mode 100644 index 00000000000..aa0ff738e9e --- /dev/null +++ b/backends/example/targets.bzl @@ -0,0 +1,62 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "example_quantizer", + srcs = [ + "example_quantizer.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/example/example_operators:example_operators_lib", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + ], + ) + + runtime.python_library( + name = "example_backend", + srcs = [ + "example_backend.py", + ], + deps = [ + "//executorch/backends/example/example_backend_delegate_passes:lib", + "//executorch/exir/backend:backend_details", + "//executorch/exir/backend:compile_spec_schema", + ], + ) + + runtime.python_library( + name = "example_partitioner", + srcs = [ + "example_partitioner.py", + ], + deps = [ + ":example_backend", + "//caffe2:torch", + "//executorch/backends/example/example_operators:example_operators_lib", + "//executorch/exir:graph_module", + "//executorch/exir/backend:partitioner", + "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", + "//executorch/exir/dialects:lib", + ], + ) + + python_unittest( + name = "test_example_delegate", + srcs = [ + "test_example_delegate.py", + ], + deps = [ + ":example_partitioner", + ":example_quantizer", + "//caffe2:torch", + "//executorch/exir:delegate", + "//executorch/exir:lib", + "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", + "//pytorch/vision:torchvision", + ], + ) diff --git a/backends/vulkan/_passes/BUCK b/backends/vulkan/_passes/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/backends/vulkan/_passes/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/backends/vulkan/_passes/TARGETS b/backends/vulkan/_passes/TARGETS deleted file mode 100644 index 46717a52014..00000000000 --- a/backends/vulkan/_passes/TARGETS +++ /dev/null @@ -1,156 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "fuse_quantized_ops", - srcs = ["fuse_quantized_ops.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/transforms:utils", - "//executorch/backends/vulkan:custom_ops_lib", - "//executorch/backends/vulkan:utils_lib", - "//executorch/exir:pass_base", - "//executorch/exir:sym_util", - "//executorch/exir/dialects:lib", - ], -) - -runtime.python_library( - name = "insert_prepack_nodes", - srcs = ["insert_prepack_nodes.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:pass_base", - "//executorch/backends/vulkan:utils_lib", - "//executorch/backends/vulkan:op_registry", - ], -) - -runtime.python_library( - name = "squeeze_unsqueeze_inputs", - srcs = [ - "squeeze_unsqueeze_inputs.py", - ], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/vulkan:custom_ops_lib", - "//executorch/exir:pass_base", - "//executorch/exir/dialects:lib", - ] -) - -runtime.python_library( - name = "remove_asserts", - srcs = ["remove_asserts.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:pass_base", - "//executorch/exir/dialects:lib", - ], -) - -runtime.python_library( - name = "remove_redundant_ops", - srcs = ["remove_redundant_ops.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:pass_base", - "//executorch/exir/dialects:lib", - ], -) - -runtime.python_library( - name = "tag_memory_meta_pass", - srcs = ["tag_memory_meta_pass.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:pass_base", - "//executorch/exir/dialects:lib", - "//executorch/backends/vulkan:utils_lib", - "//executorch/backends/vulkan/serialization:lib", - ], -) - -runtime.python_library( - name = "fold_qdq", - srcs = ["fold_qdq.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/vulkan:utils_lib", - "//executorch/exir:pass_base", - ], -) - -runtime.python_library( - name = "insert_dtype_promotion", - srcs = ["insert_dtype_promotion.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:pass_base", - "//executorch/exir/dialects:lib", - ], -) - -runtime.python_library( - name = "fuse_patterns", - srcs = ["fuse_patterns.py"], - visibility = [ - "//executorch/backends/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/vulkan/patterns:vulkan_patterns", - "//executorch/exir:lib", - "//executorch/exir:pass_base", - "//executorch/exir/dialects:lib", - ], - typing = True, -) - -runtime.python_library( - name = "vulkan_passes", - srcs = [ - "__init__.py", - ], - visibility = [ - "//executorch/backends/...", - "//executorch/examples/...", - ], - deps = [ - ":fold_qdq", - ":fuse_patterns", - ":fuse_quantized_ops", - ":insert_dtype_promotion", - ":insert_prepack_nodes", - ":remove_asserts", - ":remove_redundant_ops", - ":squeeze_unsqueeze_inputs", - ":tag_memory_meta_pass", - ] -) diff --git a/backends/vulkan/_passes/targets.bzl b/backends/vulkan/_passes/targets.bzl new file mode 100644 index 00000000000..19b6c6c2afd --- /dev/null +++ b/backends/vulkan/_passes/targets.bzl @@ -0,0 +1,158 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "fuse_quantized_ops", + srcs = ["fuse_quantized_ops.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/transforms:utils", + "//executorch/backends/vulkan:custom_ops_lib", + "//executorch/backends/vulkan:utils_lib", + "//executorch/exir:pass_base", + "//executorch/exir:sym_util", + "//executorch/exir/dialects:lib", + ], + ) + + runtime.python_library( + name = "insert_prepack_nodes", + srcs = ["insert_prepack_nodes.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:pass_base", + "//executorch/backends/vulkan:utils_lib", + "//executorch/backends/vulkan:op_registry", + ], + ) + + runtime.python_library( + name = "squeeze_unsqueeze_inputs", + srcs = [ + "squeeze_unsqueeze_inputs.py", + ], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/vulkan:custom_ops_lib", + "//executorch/exir:pass_base", + "//executorch/exir/dialects:lib", + ] + ) + + runtime.python_library( + name = "remove_asserts", + srcs = ["remove_asserts.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:pass_base", + "//executorch/exir/dialects:lib", + ], + ) + + runtime.python_library( + name = "remove_redundant_ops", + srcs = ["remove_redundant_ops.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:pass_base", + "//executorch/exir/dialects:lib", + ], + ) + + runtime.python_library( + name = "tag_memory_meta_pass", + srcs = ["tag_memory_meta_pass.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:pass_base", + "//executorch/exir/dialects:lib", + "//executorch/backends/vulkan:utils_lib", + "//executorch/backends/vulkan/serialization:lib", + ], + ) + + runtime.python_library( + name = "fold_qdq", + srcs = ["fold_qdq.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/vulkan:utils_lib", + "//executorch/exir:pass_base", + ], + ) + + runtime.python_library( + name = "insert_dtype_promotion", + srcs = ["insert_dtype_promotion.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:pass_base", + "//executorch/exir/dialects:lib", + ], + ) + + runtime.python_library( + name = "fuse_patterns", + srcs = ["fuse_patterns.py"], + visibility = [ + "//executorch/backends/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/vulkan/patterns:vulkan_patterns", + "//executorch/exir:lib", + "//executorch/exir:pass_base", + "//executorch/exir/dialects:lib", + ], + typing = True, + ) + + runtime.python_library( + name = "vulkan_passes", + srcs = [ + "__init__.py", + ], + visibility = [ + "//executorch/backends/...", + "//executorch/examples/...", + ], + deps = [ + ":fold_qdq", + ":fuse_patterns", + ":fuse_quantized_ops", + ":insert_dtype_promotion", + ":insert_prepack_nodes", + ":remove_asserts", + ":remove_redundant_ops", + ":squeeze_unsqueeze_inputs", + ":tag_memory_meta_pass", + ] + ) diff --git a/backends/webgpu/test/TARGETS b/backends/webgpu/test/BUCK similarity index 82% rename from backends/webgpu/test/TARGETS rename to backends/webgpu/test/BUCK index d4f7046f0bd..49f54f27d3a 100644 --- a/backends/webgpu/test/TARGETS +++ b/backends/webgpu/test/BUCK @@ -1,10 +1,12 @@ load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") oncall("executorch") # AOT export coverage only (lowers via VulkanPartitioner, asserts a VulkanBackend delegate); no GPU runtime. -python_unittest( +fbcode_target( + _kind = python_unittest, name = "test_add", srcs = [ "ops/test_add.py", @@ -17,7 +19,8 @@ python_unittest( ], ) -python_unittest( +fbcode_target( + _kind = python_unittest, name = "test_index", srcs = [ "ops/index/test_index.py", @@ -30,7 +33,8 @@ python_unittest( ], ) -runtime.python_library( +fbcode_target( + _kind = runtime.python_library, name = "tester", srcs = ["tester.py"], deps = [ diff --git a/backends/webgpu/test/targets.bzl b/backends/webgpu/test/targets.bzl new file mode 100644 index 00000000000..1f014dfa670 --- /dev/null +++ b/backends/webgpu/test/targets.bzl @@ -0,0 +1,29 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + # AOT export coverage only (lowers via VulkanPartitioner, asserts a VulkanBackend delegate); no GPU runtime. + python_unittest( + name = "test_add", + srcs = [ + "ops/add/test_add.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/vulkan/partitioner:vulkan_partitioner", + "//executorch/backends/vulkan:vulkan_preprocess", + "//executorch/exir:lib", + ], + ) + + runtime.python_library( + name = "tester", + srcs = ["tester.py"], + deps = [ + "//executorch/backends/vulkan/partitioner:vulkan_partitioner", + "//executorch/backends/vulkan:vulkan_preprocess", + ], + ) diff --git a/devtools/backend_debug/tests/BUCK b/devtools/backend_debug/tests/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/devtools/backend_debug/tests/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/devtools/backend_debug/tests/TARGETS b/devtools/backend_debug/tests/TARGETS deleted file mode 100644 index ae234df8ce4..00000000000 --- a/devtools/backend_debug/tests/TARGETS +++ /dev/null @@ -1,17 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -python_unittest( - name = "test_delegation_info", - srcs = [ - "test_delegation_info.py", - ], - deps = [ - "fbsource//third-party/pypi/pandas:pandas", - "//caffe2:torch", - "//executorch/devtools/backend_debug:delegation_info", - "//executorch/exir:lib", - "//executorch/exir/backend/test:op_partitioner_demo", - ], -) diff --git a/devtools/backend_debug/tests/targets.bzl b/devtools/backend_debug/tests/targets.bzl new file mode 100644 index 00000000000..adc08f264a2 --- /dev/null +++ b/devtools/backend_debug/tests/targets.bzl @@ -0,0 +1,19 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + python_unittest( + name = "test_delegation_info", + srcs = [ + "test_delegation_info.py", + ], + deps = [ + "fbsource//third-party/pypi/pandas:pandas", + "//caffe2:torch", + "//executorch/devtools/backend_debug:delegation_info", + "//executorch/exir:lib", + "//executorch/exir/backend/test:op_partitioner_demo", + ], + ) diff --git a/devtools/inspector/tests/BUCK b/devtools/inspector/tests/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/devtools/inspector/tests/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/devtools/inspector/tests/TARGETS b/devtools/inspector/tests/TARGETS deleted file mode 100644 index b50bd79d4d0..00000000000 --- a/devtools/inspector/tests/TARGETS +++ /dev/null @@ -1,96 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load("@fbsource//tools/target_determinator/macros:ci.bzl", "ci") - -oncall("executorch") - -python_unittest( - name = "inspector_test", - srcs = ["inspector_test.py"], - labels = ci.labels( - ci.buckconfig("executorch.event_tracer_enabled", "true"), - ), - deps = [ - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/backends/xnnpack/utils:xnnpack_utils", - "//executorch/devtools:lib", - "//executorch/devtools/debug_format:et_schema", - "//executorch/devtools/etdump:schema_flatcc", - "//executorch/devtools/etrecord/tests:etrecord_test_library", - "//executorch/devtools/inspector:inspector", - "//executorch/devtools/inspector:lib", - "//executorch/devtools/inspector/tests:inspector_test_utils", - "//executorch/exir:lib", - "//executorch/runtime:runtime", - ], -) - -python_unittest( - name = "event_blocks_test", - srcs = ["event_blocks_test.py"], - deps = [ - "//executorch/devtools/etdump:schema_flatcc", - "//executorch/devtools/inspector:inspector", - "//executorch/devtools/inspector:lib", - ], -) - -python_unittest( - name = "inspector_utils_test", - srcs = ["inspector_utils_test.py"], - deps = [ - "//caffe2:torch", - "//executorch/devtools:lib", - "//executorch/devtools/debug_format:base_schema", - "//executorch/devtools/debug_format:et_schema", - "//executorch/devtools/etdump:schema_flatcc", - "//executorch/devtools/etrecord/tests:etrecord_test_library", - "//executorch/devtools/inspector:inspector_utils", - ], -) - -python_unittest( - name = "intermediate_output_capturer_test", - srcs = ["intermediate_output_capturer_test.py"], - deps = [ - "//executorch/devtools/inspector:inspector", - "//executorch/devtools/inspector:lib", - "//executorch/devtools/inspector:intermediate_output_capturer", - "//executorch/exir:lib", - "//executorch/devtools/inspector/tests:inspector_test_utils", - ], -) - -python_unittest( - name = "l1_comparator_test", - srcs = ["l1_comparator_test.py"], - deps = [ - "//executorch/devtools/inspector/numerical_comparator:lib", - ], -) - -python_unittest( - name = "mse_comparator_test", - srcs = ["mse_comparator_test.py"], - deps = [ - "//executorch/devtools/inspector/numerical_comparator:lib", - ], -) - -python_unittest( - name = "snr_comparator_test", - srcs = ["snr_comparator_test.py"], - deps = [ - "//executorch/devtools/inspector/numerical_comparator:lib", - ], -) - -runtime.python_library( - name = "inspector_test_utils", - srcs = [ - "inspector_test_utils.py", - ], - deps = [ - "//caffe2:torch", - ], -) diff --git a/devtools/inspector/tests/targets.bzl b/devtools/inspector/tests/targets.bzl new file mode 100644 index 00000000000..3fe445db391 --- /dev/null +++ b/devtools/inspector/tests/targets.bzl @@ -0,0 +1,98 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbsource//tools/target_determinator/macros:ci.bzl", "ci") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + python_unittest( + name = "inspector_test", + srcs = ["inspector_test.py"], + labels = ci.labels( + ci.buckconfig("executorch.event_tracer_enabled", "true"), + ), + deps = [ + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/backends/xnnpack/utils:xnnpack_utils", + "//executorch/devtools:lib", + "//executorch/devtools/debug_format:et_schema", + "//executorch/devtools/etdump:schema_flatcc", + "//executorch/devtools/etrecord/tests:etrecord_test_library", + "//executorch/devtools/inspector:inspector", + "//executorch/devtools/inspector:lib", + "//executorch/devtools/inspector/tests:inspector_test_utils", + "//executorch/exir:lib", + "//executorch/runtime:runtime", + ], + ) + + python_unittest( + name = "event_blocks_test", + srcs = ["event_blocks_test.py"], + deps = [ + "//executorch/devtools/etdump:schema_flatcc", + "//executorch/devtools/inspector:inspector", + "//executorch/devtools/inspector:lib", + ], + ) + + python_unittest( + name = "inspector_utils_test", + srcs = ["inspector_utils_test.py"], + deps = [ + "//caffe2:torch", + "//executorch/devtools:lib", + "//executorch/devtools/debug_format:base_schema", + "//executorch/devtools/debug_format:et_schema", + "//executorch/devtools/etdump:schema_flatcc", + "//executorch/devtools/etrecord/tests:etrecord_test_library", + "//executorch/devtools/inspector:inspector_utils", + ], + ) + + python_unittest( + name = "intermediate_output_capturer_test", + srcs = ["intermediate_output_capturer_test.py"], + deps = [ + "//executorch/devtools/inspector:inspector", + "//executorch/devtools/inspector:lib", + "//executorch/devtools/inspector:intermediate_output_capturer", + "//executorch/exir:lib", + "//executorch/devtools/inspector/tests:inspector_test_utils", + ], + ) + + python_unittest( + name = "l1_comparator_test", + srcs = ["l1_comparator_test.py"], + deps = [ + "//executorch/devtools/inspector/numerical_comparator:lib", + ], + ) + + python_unittest( + name = "mse_comparator_test", + srcs = ["mse_comparator_test.py"], + deps = [ + "//executorch/devtools/inspector/numerical_comparator:lib", + ], + ) + + python_unittest( + name = "snr_comparator_test", + srcs = ["snr_comparator_test.py"], + deps = [ + "//executorch/devtools/inspector/numerical_comparator:lib", + ], + ) + + runtime.python_library( + name = "inspector_test_utils", + srcs = [ + "inspector_test_utils.py", + ], + deps = [ + "//caffe2:torch", + ], + ) diff --git a/devtools/intermediate_output_tap/tests/BUCK b/devtools/intermediate_output_tap/tests/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/devtools/intermediate_output_tap/tests/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/devtools/intermediate_output_tap/tests/TARGETS b/devtools/intermediate_output_tap/tests/TARGETS deleted file mode 100644 index d8a4a8f08b8..00000000000 --- a/devtools/intermediate_output_tap/tests/TARGETS +++ /dev/null @@ -1,60 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -python_unittest( - name = "test_selectors", - srcs = ["test_selectors.py"], - deps = [ - "//caffe2:torch", - "//executorch/devtools/intermediate_output_tap:selectors", - ], -) - -python_unittest( - name = "test_reducers", - srcs = ["test_reducers.py"], - deps = [ - "//caffe2:torch", - "//executorch/devtools/intermediate_output_tap:reducers", - ], -) - -python_unittest( - name = "test_tap_pass", - srcs = ["test_tap_pass.py"], - deps = [ - "//caffe2:torch", - "//executorch/devtools/intermediate_output_tap:reducers", - "//executorch/devtools/intermediate_output_tap:selectors", - "//executorch/devtools/intermediate_output_tap:tap_pass", - ], -) - -python_unittest( - name = "test_strip_pass", - srcs = ["test_strip_pass.py"], - deps = [ - "//caffe2:torch", - "//executorch/devtools/intermediate_output_tap:reducers", - "//executorch/devtools/intermediate_output_tap:selectors", - "//executorch/devtools/intermediate_output_tap:strip_pass", - "//executorch/devtools/intermediate_output_tap:tap_pass", - "//executorch/exir:lib", - ], -) - -python_unittest( - name = "test_xnnpack_e2e", - srcs = ["test_xnnpack_e2e.py"], - deps = [ - "//caffe2:torch", - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - "//executorch/devtools/backend_debug:delegation_info", - "//executorch/devtools/intermediate_output_tap:lib", - "//executorch/exir:lib", - "//executorch/runtime:runtime", - "//pytorch/ao:torchao", - ], -) diff --git a/devtools/intermediate_output_tap/tests/targets.bzl b/devtools/intermediate_output_tap/tests/targets.bzl new file mode 100644 index 00000000000..75b9c6c8236 --- /dev/null +++ b/devtools/intermediate_output_tap/tests/targets.bzl @@ -0,0 +1,62 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + python_unittest( + name = "test_selectors", + srcs = ["test_selectors.py"], + deps = [ + "//caffe2:torch", + "//executorch/devtools/intermediate_output_tap:selectors", + ], + ) + + python_unittest( + name = "test_reducers", + srcs = ["test_reducers.py"], + deps = [ + "//caffe2:torch", + "//executorch/devtools/intermediate_output_tap:reducers", + ], + ) + + python_unittest( + name = "test_tap_pass", + srcs = ["test_tap_pass.py"], + deps = [ + "//caffe2:torch", + "//executorch/devtools/intermediate_output_tap:reducers", + "//executorch/devtools/intermediate_output_tap:selectors", + "//executorch/devtools/intermediate_output_tap:tap_pass", + ], + ) + + python_unittest( + name = "test_strip_pass", + srcs = ["test_strip_pass.py"], + deps = [ + "//caffe2:torch", + "//executorch/devtools/intermediate_output_tap:reducers", + "//executorch/devtools/intermediate_output_tap:selectors", + "//executorch/devtools/intermediate_output_tap:strip_pass", + "//executorch/devtools/intermediate_output_tap:tap_pass", + "//executorch/exir:lib", + ], + ) + + python_unittest( + name = "test_xnnpack_e2e", + srcs = ["test_xnnpack_e2e.py"], + deps = [ + "//caffe2:torch", + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + "//executorch/devtools/backend_debug:delegation_info", + "//executorch/devtools/intermediate_output_tap:lib", + "//executorch/exir:lib", + "//executorch/runtime:runtime", + "//pytorch/ao:torchao", + ], + ) diff --git a/devtools/pte_tool/tests/BUCK b/devtools/pte_tool/tests/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/devtools/pte_tool/tests/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/devtools/pte_tool/tests/TARGETS b/devtools/pte_tool/tests/TARGETS deleted file mode 100644 index f19feb1bacf..00000000000 --- a/devtools/pte_tool/tests/TARGETS +++ /dev/null @@ -1,15 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -python_unittest( - name = "test_diff_pte", - srcs = [ - "test_diff_pte.py", - ], - deps = [ - "//executorch/devtools/pte_tool:diff_pte_lib", - "//executorch/exir:schema", - "//executorch/exir/_serialize:lib", - ], -) diff --git a/devtools/pte_tool/tests/targets.bzl b/devtools/pte_tool/tests/targets.bzl new file mode 100644 index 00000000000..8a58d2f62ce --- /dev/null +++ b/devtools/pte_tool/tests/targets.bzl @@ -0,0 +1,17 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + python_unittest( + name = "test_diff_pte", + srcs = [ + "test_diff_pte.py", + ], + deps = [ + "//executorch/devtools/pte_tool:diff_pte_lib", + "//executorch/exir:schema", + "//executorch/exir/_serialize:lib", + ], + ) diff --git a/devtools/size_analysis_tool/BUCK b/devtools/size_analysis_tool/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/devtools/size_analysis_tool/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/devtools/size_analysis_tool/TARGETS b/devtools/size_analysis_tool/TARGETS deleted file mode 100644 index b37eee6a389..00000000000 --- a/devtools/size_analysis_tool/TARGETS +++ /dev/null @@ -1,51 +0,0 @@ -load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -runtime.python_library( - name = "size_analysis_tool_lib", - srcs = [ - "size_analysis_tool.py", - ], - visibility = ["PUBLIC"], - deps = [ - "//caffe2:torch", - "//executorch/devtools:lib", - "//executorch/exir:lib", - "//executorch/exir/backend:backend_api", - ], -) - -python_binary( - name = "size_analysis_tool", - srcs = [ - "size_analysis_tool.py", - ], - main_function = "executorch.devtools.size_analysis_tool.size_analysis_tool.main", - visibility = ["PUBLIC"], - deps = [ - "//caffe2:torch", - "//executorch/devtools:lib", - "//executorch/exir:lib", - "//executorch/exir/backend:backend_api", - ], -) - -python_unittest( - name = "size_analysis_tool_test", - srcs = [ - "size_analysis_tool.py", - "size_analysis_tool_test.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/backends/xnnpack/utils:xnnpack_utils", - "//executorch/devtools:lib", - "//executorch/exir:lib", - "//executorch/exir/backend:backend_api", - "//executorch/exir/passes:spec_prop_pass", - ], -) diff --git a/devtools/size_analysis_tool/targets.bzl b/devtools/size_analysis_tool/targets.bzl new file mode 100644 index 00000000000..b7499918e53 --- /dev/null +++ b/devtools/size_analysis_tool/targets.bzl @@ -0,0 +1,53 @@ +load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "size_analysis_tool_lib", + srcs = [ + "size_analysis_tool.py", + ], + visibility = ["PUBLIC"], + deps = [ + "//caffe2:torch", + "//executorch/devtools:lib", + "//executorch/exir:lib", + "//executorch/exir/backend:backend_api", + ], + ) + + python_binary( + name = "size_analysis_tool", + srcs = [ + "size_analysis_tool.py", + ], + main_function = "executorch.devtools.size_analysis_tool.size_analysis_tool.main", + visibility = ["PUBLIC"], + deps = [ + "//caffe2:torch", + "//executorch/devtools:lib", + "//executorch/exir:lib", + "//executorch/exir/backend:backend_api", + ], + ) + + python_unittest( + name = "size_analysis_tool_test", + srcs = [ + "size_analysis_tool.py", + "size_analysis_tool_test.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/backends/xnnpack/utils:xnnpack_utils", + "//executorch/devtools:lib", + "//executorch/exir:lib", + "//executorch/exir/backend:backend_api", + "//executorch/exir/passes:spec_prop_pass", + ], + ) diff --git a/examples/llm_pte_finetuning/BUCK b/examples/llm_pte_finetuning/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/examples/llm_pte_finetuning/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/examples/llm_pte_finetuning/TARGETS b/examples/llm_pte_finetuning/TARGETS deleted file mode 100644 index 1acb7adee49..00000000000 --- a/examples/llm_pte_finetuning/TARGETS +++ /dev/null @@ -1,71 +0,0 @@ -load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("papaya_oncall") - -runtime.python_library( - name = "model_loading_lib", - srcs = [ - "model_loading_lib.py", - ], - deps = [ - "fbcode//caffe2:torch", - "fbcode//executorch/examples/llm_pte_finetuning:training_lib", - "fbcode//executorch/exir:lib", - "fbcode//executorch/extension/pybindings:portable_lib", # @manual For PTE loader - "fbcode//pytorch/torchtune:lib", - "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer - "fbsource//third-party/pypi/omegaconf:omegaconf", - "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer - ], -) - -runtime.python_library( - name = "training_lib", - srcs = [ - "training_lib.py", - ], - deps = [ - "fbcode//caffe2:torch", - "fbcode//executorch/extension/pybindings:portable_lib", # @manual For PTE loader - "fbcode//pytorch/torchtune:lib", - "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer - "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer - "fbsource//third-party/pypi/tqdm:tqdm", - "fbcode//executorch/backends/xnnpack/partition:xnnpack_partitioner", - ], -) - -python_binary( - name = "runner", - srcs = [ - "runner.py", - ], - main_function = "executorch.examples.llm_pte_finetuning.runner.main", - deps = [ - "fbcode//caffe2:torch", - "fbcode//executorch/examples/llm_pte_finetuning:training_lib", - "fbcode//pytorch/torchtune:lib", - "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer - "fbsource//third-party/pypi/omegaconf:omegaconf", - "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer - "fbsource//third-party/pypi/tqdm:tqdm", - ], -) - -python_binary( - name = "model_exporter", - srcs = [ - "model_exporter.py", - ], - main_function = "executorch.examples.llm_pte_finetuning.model_exporter.main", - deps = [ - "fbcode//caffe2:torch", - "fbcode//executorch/examples/llm_pte_finetuning:model_loading_lib", # @manual for model loading - "fbcode//executorch/examples/llm_pte_finetuning:training_lib", # @manual for model exporting - "fbcode//pytorch/torchtune:lib", - "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer - "fbsource//third-party/pypi/omegaconf:omegaconf", - "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer - ], -) diff --git a/examples/llm_pte_finetuning/targets.bzl b/examples/llm_pte_finetuning/targets.bzl new file mode 100644 index 00000000000..b48b189cf8f --- /dev/null +++ b/examples/llm_pte_finetuning/targets.bzl @@ -0,0 +1,73 @@ +load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "model_loading_lib", + srcs = [ + "model_loading_lib.py", + ], + deps = [ + "fbcode//caffe2:torch", + "fbcode//executorch/examples/llm_pte_finetuning:training_lib", + "fbcode//executorch/exir:lib", + "fbcode//executorch/extension/pybindings:portable_lib", # @manual For PTE loader + "fbcode//pytorch/torchtune:lib", + "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer + "fbsource//third-party/pypi/omegaconf:omegaconf", + "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer + ], + ) + + runtime.python_library( + name = "training_lib", + srcs = [ + "training_lib.py", + ], + deps = [ + "fbcode//caffe2:torch", + "fbcode//executorch/extension/pybindings:portable_lib", # @manual For PTE loader + "fbcode//pytorch/torchtune:lib", + "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer + "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer + "fbsource//third-party/pypi/tqdm:tqdm", + "fbcode//executorch/backends/xnnpack/partition:xnnpack_partitioner", + ], + ) + + python_binary( + name = "runner", + srcs = [ + "runner.py", + ], + main_function = "executorch.examples.llm_pte_finetuning.runner.main", + deps = [ + "fbcode//caffe2:torch", + "fbcode//executorch/examples/llm_pte_finetuning:training_lib", + "fbcode//pytorch/torchtune:lib", + "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer + "fbsource//third-party/pypi/omegaconf:omegaconf", + "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer + "fbsource//third-party/pypi/tqdm:tqdm", + ], + ) + + python_binary( + name = "model_exporter", + srcs = [ + "model_exporter.py", + ], + main_function = "executorch.examples.llm_pte_finetuning.model_exporter.main", + deps = [ + "fbcode//caffe2:torch", + "fbcode//executorch/examples/llm_pte_finetuning:model_loading_lib", # @manual for model loading + "fbcode//executorch/examples/llm_pte_finetuning:training_lib", # @manual for model exporting + "fbcode//pytorch/torchtune:lib", + "fbsource//third-party/pypi/blobfile:blobfile", # @manual For tokenizer + "fbsource//third-party/pypi/omegaconf:omegaconf", + "fbsource//third-party/pypi/tiktoken:tiktoken", # @manual For tokenizer + ], + ) diff --git a/examples/models/gemma4/tests/BUCK b/examples/models/gemma4/tests/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/examples/models/gemma4/tests/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/examples/models/gemma4/tests/targets.bzl b/examples/models/gemma4/tests/targets.bzl new file mode 100644 index 00000000000..92ca1a51ab2 --- /dev/null +++ b/examples/models/gemma4/tests/targets.bzl @@ -0,0 +1,15 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + fbcode_target(_kind = runtime.python_test, + name = "test_speech_transform", + srcs = ["test_speech_transform.py"], + deps = [ + "//executorch/examples/models/gemma4:speech_transform", + "fbsource//third-party/pypi/transformers:transformers", + ], + ) diff --git a/examples/models/phi_4_mini/BUCK b/examples/models/phi_4_mini/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/examples/models/phi_4_mini/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/examples/models/phi_4_mini/targets.bzl b/examples/models/phi_4_mini/targets.bzl new file mode 100644 index 00000000000..b04e5f7b7c9 --- /dev/null +++ b/examples/models/phi_4_mini/targets.bzl @@ -0,0 +1,35 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "phi_4_mini", + srcs = [ + "__init__.py", + "convert_weights.py", + ], + _is_external_target = True, + base_module = "executorch.examples.models.phi_4_mini", + resources = { + "config/config.json": "config/config.json", + "config/phi_4_mini_xnnpack.yaml": "config/phi_4_mini_xnnpack.yaml", + }, + deps = [ + "//caffe2:torch", + "//executorch/examples/models:model_base", + "//executorch/examples/models/llama:llama2_model", + "fbcode//pytorch/torchtune:lib", + ], + visibility = ["PUBLIC"], + ) + + runtime.python_binary( + name = "convert_phi4_mini_weights", + main_function = "executorch.examples.models.phi_4_mini.convert_weights.main", + deps = [ + ":phi_4_mini", + ], + ) diff --git a/examples/models/qwen2_5/BUCK b/examples/models/qwen2_5/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/examples/models/qwen2_5/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/examples/models/qwen2_5/targets.bzl b/examples/models/qwen2_5/targets.bzl new file mode 100644 index 00000000000..2f19d53d7f9 --- /dev/null +++ b/examples/models/qwen2_5/targets.bzl @@ -0,0 +1,28 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "qwen2_5", + srcs = [ + "__init__.py", + "convert_weights.py", + ], + _is_external_target = True, + base_module = "executorch.examples.models.qwen2_5", + resources = { + "config/0_5b_config.json": "config/0_5b_config.json", + "config/1_5b_config.json": "config/1_5b_config.json", + "config/qwen2_5_xnnpack_q8da4w.yaml": "config/qwen2_5_xnnpack_q8da4w.yaml", + }, + deps = [ + "//caffe2:torch", + "//executorch/examples/models:model_base", + "//executorch/examples/models/llama:llama2_model", + "fbcode//pytorch/torchtune:lib", + ], + visibility = ["PUBLIC"], + ) diff --git a/examples/models/qwen3/BUCK b/examples/models/qwen3/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/examples/models/qwen3/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/examples/models/qwen3/targets.bzl b/examples/models/qwen3/targets.bzl new file mode 100644 index 00000000000..074fe77d101 --- /dev/null +++ b/examples/models/qwen3/targets.bzl @@ -0,0 +1,29 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "qwen3", + srcs = [ + "__init__.py", + "convert_weights.py", + ], + _is_external_target = True, + base_module = "executorch.examples.models.qwen3", + resources = { + "config/0_6b_config.json": "config/0_6b_config.json", + "config/1_7b_config.json": "config/1_7b_config.json", + "config/4b_config.json": "config/4b_config.json", + "config/qwen3_xnnpack_q8da4w.yaml": "config/qwen3_xnnpack_q8da4w.yaml", + }, + deps = [ + "//caffe2:torch", + "//executorch/examples/models:model_base", + "//executorch/examples/models/llama:llama2_model", + "fbcode//pytorch/torchtune:lib", + ], + visibility = ["PUBLIC"], + ) diff --git a/examples/models/resnet/BUCK b/examples/models/resnet/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/examples/models/resnet/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/examples/models/resnet/targets.bzl b/examples/models/resnet/targets.bzl new file mode 100644 index 00000000000..a7fe3ce9c8b --- /dev/null +++ b/examples/models/resnet/targets.bzl @@ -0,0 +1,18 @@ +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + python_library( + name = "resnet_model", + srcs = [ + "__init__.py", + "model.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/examples/models:model_base", + "//pytorch/vision:torchvision", # @manual + ], + ) diff --git a/examples/qualcomm/BUCK b/examples/qualcomm/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/examples/qualcomm/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/examples/qualcomm/TARGETS b/examples/qualcomm/TARGETS deleted file mode 100644 index dd27a675943..00000000000 --- a/examples/qualcomm/TARGETS +++ /dev/null @@ -1,43 +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") -load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version") - -oncall("executorch") - -python_binary( - name = "export_example", - srcs = ["scripts/export_example.py"], - main_function = ".scripts.export_example.main", - visibility = ["//executorch/examples/..."], - deps = [ - "//caffe2:torch", - "//executorch/extension/pybindings:aten_lib", - "//executorch/backends/qualcomm/partition:partition", - "//executorch/backends/qualcomm/quantizer:quantizer", - "//executorch/devtools:lib", - "//executorch/examples/models:models", - "//executorch/extension/export_util:export_util", - ], -) - -runtime.command_alias( - name = "export_example_qnn", - env = { - "LD_LIBRARY_PATH": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs)".format(get_qnn_library_version()), - "QNN_SDK_ROOT": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:__dir__)".format(get_qnn_library_version()), - }, - exe = ":export_example", -) - -runtime.python_library( - name = "utils", - srcs = ["utils.py"], - deps = [ - "//caffe2:torch", - "//executorch/backends/qualcomm:export_utils", - ], -) diff --git a/examples/qualcomm/targets.bzl b/examples/qualcomm/targets.bzl new file mode 100644 index 00000000000..3b1f25b4884 --- /dev/null +++ b/examples/qualcomm/targets.bzl @@ -0,0 +1,47 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + # Any targets that should be shared between fbcode and xplat must be defined in + # targets.bzl. This file can contain fbcode-only targets. + + + + python_binary( + name = "export_example", + srcs = ["scripts/export_example.py"], + main_function = ".scripts.export_example.main", + visibility = ["//executorch/examples/..."], + deps = [ + "//caffe2:torch", + "//executorch/extension/pybindings:aten_lib", + "//executorch/backends/qualcomm/partition:partition", + "//executorch/backends/qualcomm/quantizer:quantizer", + "//executorch/devtools:lib", + "//executorch/examples/models:models", + "//executorch/extension/export_util:export_util", + ], + ) + + runtime.command_alias( + name = "export_example_qnn", + env = { + "LD_LIBRARY_PATH": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs)".format(get_qnn_library_version()), + "QNN_SDK_ROOT": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:__dir__)".format(get_qnn_library_version()), + }, + exe = ":export_example", + ) + + runtime.python_library( + name = "utils", + srcs = ["utils.py"], + deps = [ + "//caffe2:torch", + "//executorch/backends/qualcomm:export_utils", + ], + ) diff --git a/exir/dialects/edge/spec/BUCK b/exir/dialects/edge/spec/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/exir/dialects/edge/spec/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/exir/dialects/edge/spec/TARGETS b/exir/dialects/edge/spec/TARGETS deleted file mode 100644 index ce5c5970e14..00000000000 --- a/exir/dialects/edge/spec/TARGETS +++ /dev/null @@ -1,29 +0,0 @@ -load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("ai_infra_mobile_platform") - -runtime.python_library( - name = "lib", - srcs = [ - "gen.py", - "utils.py", - ], - deps = [ - "fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml", - "//caffe2:torch", - "//executorch/exir/dialects/edge/arg:lib", - "//executorch/exir/dialects/edge/dtype:lib", - "//executorch/exir/dialects/edge/op:lib", - ], -) - -python_binary( - name = "gen", - srcs = [], - main_function = "executorch.exir.dialects.edge.spec.gen.main", - deps = [ - "fbsource//third-party/pypi/expecttest:expecttest", # @manual - ":lib", - ], -) diff --git a/exir/dialects/edge/spec/targets.bzl b/exir/dialects/edge/spec/targets.bzl new file mode 100644 index 00000000000..7654ae4c29d --- /dev/null +++ b/exir/dialects/edge/spec/targets.bzl @@ -0,0 +1,31 @@ +load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "lib", + srcs = [ + "gen.py", + "utils.py", + ], + deps = [ + "fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml", + "//caffe2:torch", + "//executorch/exir/dialects/edge/arg:lib", + "//executorch/exir/dialects/edge/dtype:lib", + "//executorch/exir/dialects/edge/op:lib", + ], + ) + + python_binary( + name = "gen", + srcs = [], + main_function = "executorch.exir.dialects.edge.spec.gen.main", + deps = [ + "fbsource//third-party/pypi/expecttest:expecttest", # @manual + ":lib", + ], + ) diff --git a/exir/dialects/test/BUCK b/exir/dialects/test/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/exir/dialects/test/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/exir/dialects/test/TARGETS b/exir/dialects/test/TARGETS deleted file mode 100644 index 4327d3041b9..00000000000 --- a/exir/dialects/test/TARGETS +++ /dev/null @@ -1,13 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -python_unittest( - name = "test_exir_dialect_ops", - srcs = [ - "test_exir_dialect_ops.py", - ], - deps = [ - "//executorch/exir/dialects:lib", - ], -) diff --git a/exir/dialects/test/targets.bzl b/exir/dialects/test/targets.bzl new file mode 100644 index 00000000000..44cf543bd9c --- /dev/null +++ b/exir/dialects/test/targets.bzl @@ -0,0 +1,15 @@ +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + python_unittest( + name = "test_exir_dialect_ops", + srcs = [ + "test_exir_dialect_ops.py", + ], + deps = [ + "//executorch/exir/dialects:lib", + ], + ) diff --git a/exir/verification/BUCK b/exir/verification/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/exir/verification/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/exir/verification/TARGETS b/exir/verification/TARGETS deleted file mode 100644 index 85251677b55..00000000000 --- a/exir/verification/TARGETS +++ /dev/null @@ -1,69 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -runtime.cxx_python_extension( - name = "bindings", - srcs = [ - "bindings.cpp", - ], - deps = [ - "fbsource//third-party/pybind11:pybind11", - "//caffe2:torch-cpp-cpu", - "//caffe2:torch_extension", - "//caffe2/c10:c10", - ], -) - -runtime.python_library( - name = "interpreter", - srcs = [ - "interpreter.py", - ], - deps = [ - ":bindings", # @manual - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:schema", - "//executorch/exir:tensor", - "//executorch/extension/pytree:pylib", - ], -) - -runtime.python_library( - name = "devhtml", - srcs = [ - "dev_html.py", - ], - deps = [ - ":interpreter", # @manual - ], -) - -runtime.python_library( - name = "verifier", - srcs = [ - "arg_validator.py", - "verifier.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:error", - "//executorch/exir:lowered_backend_module", - "//executorch/exir/capture:config", - "//executorch/exir/dialects/edge:lib", - "//executorch/exir/emit:emit", - ], -) - -python_unittest( - name = "test_verifier", - srcs = ["test/test_verifier.py"], - deps = [ - ":verifier", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/dialects:lib", - ], -) diff --git a/exir/verification/targets.bzl b/exir/verification/targets.bzl new file mode 100644 index 00000000000..169fe174ed5 --- /dev/null +++ b/exir/verification/targets.bzl @@ -0,0 +1,71 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.cxx_python_extension( + name = "bindings", + srcs = [ + "bindings.cpp", + ], + deps = [ + "fbsource//third-party/pybind11:pybind11", + "//caffe2:torch-cpp-cpu", + "//caffe2:torch_extension", + "//caffe2/c10:c10", + ], + ) + + runtime.python_library( + name = "interpreter", + srcs = [ + "interpreter.py", + ], + deps = [ + ":bindings", # @manual + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:schema", + "//executorch/exir:tensor", + "//executorch/extension/pytree:pylib", + ], + ) + + runtime.python_library( + name = "devhtml", + srcs = [ + "dev_html.py", + ], + deps = [ + ":interpreter", # @manual + ], + ) + + runtime.python_library( + name = "verifier", + srcs = [ + "arg_validator.py", + "verifier.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:error", + "//executorch/exir:lowered_backend_module", + "//executorch/exir/capture:config", + "//executorch/exir/dialects/edge:lib", + "//executorch/exir/emit:emit", + ], + ) + + python_unittest( + name = "test_verifier", + srcs = ["test/test_verifier.py"], + deps = [ + ":verifier", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/dialects:lib", + ], + ) diff --git a/extension/audio/BUCK b/extension/audio/BUCK new file mode 100644 index 00000000000..f559a6f1cfe --- /dev/null +++ b/extension/audio/BUCK @@ -0,0 +1,9 @@ +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. + +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") +load(":targets.bzl", "define_common_targets") + +oncall("executorch") + +define_common_targets(is_fbcode = is_fbcode()) diff --git a/extension/audio/TARGETS b/extension/audio/TARGETS deleted file mode 100644 index 53b0cc47625..00000000000 --- a/extension/audio/TARGETS +++ /dev/null @@ -1,28 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "mel_spectrogram_lib", - srcs = ["mel_spectrogram.py"], - deps = [ - "//caffe2:torch", - "//executorch/devtools/backend_debug:delegation_info", - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/runtime:runtime", - "fbsource//third-party/pypi/datasets:datasets", - "fbsource//third-party/pypi/transformers:transformers", - "fbsource//third-party/pypi/librosa:librosa", - "fbsource//third-party/pypi/soundfile:soundfile" - ] -) - -python_binary( - name = "mel_spectrogram", - main_module = "executorch.extension.audio.mel_spectrogram", - deps = [ - ":mel_spectrogram_lib", - ], -) diff --git a/extension/audio/targets.bzl b/extension/audio/targets.bzl new file mode 100644 index 00000000000..bc37322e4e9 --- /dev/null +++ b/extension/audio/targets.bzl @@ -0,0 +1,30 @@ +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + +def define_common_targets(is_fbcode = False): + if not is_fbcode: + return + + runtime.python_library( + name = "mel_spectrogram_lib", + srcs = ["mel_spectrogram.py"], + deps = [ + "//caffe2:torch", + "//executorch/devtools/backend_debug:delegation_info", + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/runtime:runtime", + "fbsource//third-party/pypi/datasets:datasets", + "fbsource//third-party/pypi/transformers:transformers", + "fbsource//third-party/pypi/librosa:librosa", + "fbsource//third-party/pypi/soundfile:soundfile" + ] + ) + + python_binary( + name = "mel_spectrogram", + main_module = "executorch.extension.audio.mel_spectrogram", + deps = [ + ":mel_spectrogram_lib", + ], + )