diff --git a/backends/xnnpack/test/BUCK b/backends/xnnpack/test/BUCK index 1399eb0e8a7..4eab91acfea 100644 --- a/backends/xnnpack/test/BUCK +++ b/backends/xnnpack/test/BUCK @@ -1,3 +1,4 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary") load( "@fbsource//tools/build_defs:platform_defs.bzl", @@ -8,9 +9,10 @@ load( "get_pt_ops_deps", ) +oncall("executorch") # As fb_xplat_cxx_test (using target.bzl) fails to compile for # android-arm64. -fb_xplat_cxx_binary( +non_fbcode_target(_kind = fb_xplat_cxx_binary, name = "dynamic_quant_utils_test", srcs = ["runtime/test_runtime_utils.cpp"], platforms = (ANDROID,), @@ -31,3 +33,155 @@ fb_xplat_cxx_binary( ], ), ) + +# !!!! fbcode/executorch/backends/xnnpack/test/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +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_test, + name = "test_xnnpack_passes", + srcs = glob([ + "passes/*.py", + ]) + [ + "test_xnnpack_utils_classes.py", + ], + deps = [ + "//executorch/backends/transforms:remove_getitem_op", + "//executorch/backends/xnnpack/_passes:xnnpack_passes", + "//executorch/backends/xnnpack/test/tester:tester", + "//executorch/backends/xnnpack/utils:xnnpack_utils", + "//executorch/exir:lib", + "//executorch/exir:pass_base", + "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", + "//executorch/exir/dialects:lib", + ], + external_deps = [ + "libtorch", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test_xnnpack_fragments", + srcs = glob([ + "fragments/*.py", + ]) + [ + "test_xnnpack_utils.py", + ], + deps = [ + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + "//executorch/backends/xnnpack/test/tester:tester", + "//executorch/devtools:lib", + "//executorch/devtools/bundled_program:config", + "//executorch/devtools/bundled_program/serialize:lib", + "//executorch/exir/passes:constant_prop_pass", + "//pytorch/ao:torchao", # @manual + ], + external_deps = [ + "libtorch", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test_xnnpack_ops", + srcs = glob([ + "ops/*.py", + ]) + [ + "test_xnnpack_utils.py", + ], + deps = [ + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + "//executorch/backends/xnnpack/test/tester:tester", + "//executorch/devtools:lib", + "//executorch/devtools/bundled_program:config", + "//executorch/devtools/bundled_program/serialize:lib", + "//executorch/exir/passes:constant_prop_pass", + "//pytorch/ao:torchao", # @manual + ], + external_deps = [ + "libtorch", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test_xnnpack_models", + srcs = glob([ + "models/*.py", + ]), + labels = ["long_running"], + deps = [ + "fbsource//third-party/pypi/timm:timm", + "fbsource//third-party/pypi/torchsr:torchsr", # @manual + "fbsource//third-party/pypi/transformers:transformers", # @manual + "//executorch/backends/xnnpack/test/tester:tester", + "//executorch/examples/models/llama:llama2_model", + "//pytorch/audio/src:torchaudio_core", + "//pytorch/vision:torchvision", # @manual + ], + external_deps = [ + "libtorch", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test_xnnpack_serialization", + srcs = glob([ + "serialization/*.py", + ]), + deps = [ + "//executorch/backends/xnnpack:xnnpack_preprocess", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test_xnnpack_quantizer", + srcs = glob([ + "quantizer/*.py", + ]), + deps = [ + "//executorch/backends/xnnpack:xnnpack_preprocess", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + "//pytorch/ao:torchao", # @manual + "//pytorch/vision:torchvision", # @manual + "//caffe2:torch", + ], + external_deps = [ + "libtorch", + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test_xnnpack_recipes", + srcs = glob([ + "recipes/*.py", + ]), + env = { + "HTTP_PROXY": "http://fwdproxy:8080", + "HTTPS_PROXY": "http://fwdproxy:8080", + }, + deps = [ + "//executorch/backends/xnnpack/recipes:xnnpack_recipes", + "//executorch/export:lib", + "//executorch/runtime:runtime", # @manual + "//pytorch/vision:torchvision", # @manual + "//executorch/backends/xnnpack/test/tester:tester", + "//executorch/examples/models:models", # @manual + "//executorch/examples/xnnpack:models", # @manual + ], +) + +fbcode_target(_kind = runtime.python_test, + name = "test_xnnpack_partitioner", + srcs = ["test_xnnpack_partitioner.py"], + deps = [ + "//caffe2:torch", + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/exir:lib", + "//executorch/extension/pybindings:portable_lib", + ], +) diff --git a/backends/xnnpack/test/TARGETS b/backends/xnnpack/test/TARGETS deleted file mode 100644 index f3cd81f3de6..00000000000 --- a/backends/xnnpack/test/TARGETS +++ /dev/null @@ -1,150 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.python_test( - name = "test_xnnpack_passes", - srcs = glob([ - "passes/*.py", - ]) + [ - "test_xnnpack_utils_classes.py", - ], - deps = [ - "//executorch/backends/transforms:remove_getitem_op", - "//executorch/backends/xnnpack/_passes:xnnpack_passes", - "//executorch/backends/xnnpack/test/tester:tester", - "//executorch/backends/xnnpack/utils:xnnpack_utils", - "//executorch/exir:lib", - "//executorch/exir:pass_base", - "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", - "//executorch/exir/dialects:lib", - ], - external_deps = [ - "libtorch", - ], -) - -runtime.python_test( - name = "test_xnnpack_fragments", - srcs = glob([ - "fragments/*.py", - ]) + [ - "test_xnnpack_utils.py", - ], - deps = [ - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - "//executorch/backends/xnnpack/test/tester:tester", - "//executorch/devtools:lib", - "//executorch/devtools/bundled_program:config", - "//executorch/devtools/bundled_program/serialize:lib", - "//executorch/exir/passes:constant_prop_pass", - "//pytorch/ao:torchao", # @manual - ], - external_deps = [ - "libtorch", - ], -) - -runtime.python_test( - name = "test_xnnpack_ops", - srcs = glob([ - "ops/*.py", - ]) + [ - "test_xnnpack_utils.py", - ], - deps = [ - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - "//executorch/backends/xnnpack/test/tester:tester", - "//executorch/devtools:lib", - "//executorch/devtools/bundled_program:config", - "//executorch/devtools/bundled_program/serialize:lib", - "//executorch/exir/passes:constant_prop_pass", - "//pytorch/ao:torchao", # @manual - ], - external_deps = [ - "libtorch", - ], -) - -runtime.python_test( - name = "test_xnnpack_models", - srcs = glob([ - "models/*.py", - ]), - labels = ["long_running"], - deps = [ - "fbsource//third-party/pypi/timm:timm", - "fbsource//third-party/pypi/torchsr:torchsr", # @manual - "fbsource//third-party/pypi/transformers:transformers", # @manual - "//executorch/backends/xnnpack/test/tester:tester", - "//executorch/examples/models/llama:llama2_model", - "//pytorch/audio/src:torchaudio_core", - "//pytorch/vision:torchvision", # @manual - ], - external_deps = [ - "libtorch", - ], -) - -runtime.python_test( - name = "test_xnnpack_serialization", - srcs = glob([ - "serialization/*.py", - ]), - deps = [ - "//executorch/backends/xnnpack:xnnpack_preprocess", - ], -) - -runtime.python_test( - name = "test_xnnpack_quantizer", - srcs = glob([ - "quantizer/*.py", - ]), - deps = [ - "//executorch/backends/xnnpack:xnnpack_preprocess", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - "//pytorch/ao:torchao", # @manual - "//pytorch/vision:torchvision", # @manual - "//caffe2:torch", - ], - external_deps = [ - "libtorch", - ], -) - -runtime.python_test( - name = "test_xnnpack_recipes", - srcs = glob([ - "recipes/*.py", - ]), - env = { - "HTTP_PROXY": "http://fwdproxy:8080", - "HTTPS_PROXY": "http://fwdproxy:8080", - }, - deps = [ - "//executorch/backends/xnnpack/recipes:xnnpack_recipes", - "//executorch/export:lib", - "//executorch/runtime:runtime", # @manual - "//pytorch/vision:torchvision", # @manual - "//executorch/backends/xnnpack/test/tester:tester", - "//executorch/examples/models:models", # @manual - "//executorch/examples/xnnpack:models", # @manual - ], -) - -runtime.python_test( - name = "test_xnnpack_partitioner", - srcs = ["test_xnnpack_partitioner.py"], - deps = [ - "//caffe2:torch", - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/exir:lib", - "//executorch/extension/pybindings:portable_lib", - ], -) diff --git a/backends/xnnpack/test/tester/TARGETS b/backends/xnnpack/test/tester/BUCK similarity index 88% rename from backends/xnnpack/test/tester/TARGETS rename to backends/xnnpack/test/tester/BUCK index 00662e4a934..c9b0239de02 100644 --- a/backends/xnnpack/test/tester/TARGETS +++ b/backends/xnnpack/test/tester/BUCK @@ -1,8 +1,9 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") oncall("executorch") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "tester", srcs = [ "__init__.py", diff --git a/backends/xnnpack/utils/TARGETS b/backends/xnnpack/utils/BUCK similarity index 75% rename from backends/xnnpack/utils/TARGETS rename to backends/xnnpack/utils/BUCK index d018f294c17..0c64e1103db 100644 --- a/backends/xnnpack/utils/TARGETS +++ b/backends/xnnpack/utils/BUCK @@ -1,8 +1,9 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") oncall("executorch") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "xnnpack_utils", srcs = glob(["*.py"]), deps = [ diff --git a/codegen/BUCK b/codegen/BUCK index 1e8cc179228..9e3bda48ed1 100644 --- a/codegen/BUCK +++ b/codegen/BUCK @@ -1,8 +1,16 @@ +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. load(":targets.bzl", "define_common_targets") -oncall("executorch") -define_common_targets() +non_fbcode_target(_kind = define_common_targets,) + +# !!!! fbcode/executorch/codegen/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load(":targets.bzl", "define_common_targets") + + +fbcode_target(_kind = define_common_targets,) diff --git a/codegen/TARGETS b/codegen/TARGETS deleted file mode 100644 index 0a42614a385..00000000000 --- a/codegen/TARGETS +++ /dev/null @@ -1,5 +0,0 @@ -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets()