From 6e702df744b4d9252891419f65814f75db1bcab6 Mon Sep 17 00:00:00 2001 From: TARGETS Exterminator Date: Wed, 14 Jan 2026 18:24:16 -0800 Subject: [PATCH] Rename build files from TARGETS to BUCK (group ID: -5585568956861884953) (#16599) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/16599 Reviewed By: bigfootjon Differential Revision: D90696141 --- exir/backend/test/demos/{TARGETS => BUCK} | 3 +- exir/backend/test/demos/rpc/BUCK | 75 ++- exir/backend/test/demos/rpc/TARGETS | 67 --- exir/capture/BUCK | 50 +- exir/capture/TARGETS | 45 -- exir/dialects/{TARGETS => BUCK} | 3 +- exir/dialects/backend/BUCK | 19 +- exir/dialects/backend/TARGETS | 14 - exir/dialects/backend/test/{TARGETS => BUCK} | 3 +- exir/dialects/edge/BUCK | 34 +- exir/dialects/edge/TARGETS | 29 -- exir/dialects/edge/arg/{TARGETS => BUCK} | 3 +- exir/dialects/edge/dtype/{TARGETS => BUCK} | 3 +- exir/dialects/edge/op/{TARGETS => BUCK} | 5 +- exir/dialects/edge/spec/{TARGETS => BUCK} | 5 +- exir/dialects/edge/test/BUCK | 37 +- exir/dialects/edge/test/TARGETS | 32 -- exir/dialects/test/{TARGETS => BUCK} | 3 +- exir/emit/BUCK | 43 +- exir/emit/TARGETS | 38 -- exir/emit/test/BUCK | 35 +- exir/emit/test/TARGETS | 30 -- exir/operator/{TARGETS => BUCK} | 9 +- exir/passes/{TARGETS => BUCK} | 65 +-- exir/program/{TARGETS => BUCK} | 7 +- exir/program/test/{TARGETS => BUCK} | 3 +- exir/serde/{TARGETS => BUCK} | 3 +- exir/tests/BUCK | 519 ++++++++++++++++++- exir/tests/TARGETS | 514 ------------------ exir/verification/{TARGETS => BUCK} | 11 +- export/{TARGETS => BUCK} | 19 +- 31 files changed, 883 insertions(+), 843 deletions(-) rename exir/backend/test/demos/{TARGETS => BUCK} (82%) delete mode 100644 exir/backend/test/demos/rpc/TARGETS delete mode 100644 exir/capture/TARGETS rename exir/dialects/{TARGETS => BUCK} (74%) delete mode 100644 exir/dialects/backend/TARGETS rename exir/dialects/backend/test/{TARGETS => BUCK} (72%) delete mode 100644 exir/dialects/edge/TARGETS rename exir/dialects/edge/arg/{TARGETS => BUCK} (62%) rename exir/dialects/edge/dtype/{TARGETS => BUCK} (71%) rename exir/dialects/edge/op/{TARGETS => BUCK} (77%) rename exir/dialects/edge/spec/{TARGETS => BUCK} (80%) delete mode 100644 exir/dialects/edge/test/TARGETS rename exir/dialects/test/{TARGETS => BUCK} (64%) delete mode 100644 exir/emit/TARGETS delete mode 100644 exir/emit/test/TARGETS rename exir/operator/{TARGETS => BUCK} (74%) rename exir/passes/{TARGETS => BUCK} (84%) rename exir/program/{TARGETS => BUCK} (89%) rename exir/program/test/{TARGETS => BUCK} (86%) rename exir/serde/{TARGETS => BUCK} (84%) delete mode 100644 exir/tests/TARGETS rename exir/verification/{TARGETS => BUCK} (81%) rename export/{TARGETS => BUCK} (80%) diff --git a/exir/backend/test/demos/TARGETS b/exir/backend/test/demos/BUCK similarity index 82% rename from exir/backend/test/demos/TARGETS rename to exir/backend/test/demos/BUCK index d3cc5d62710..8404c5982c6 100644 --- a/exir/backend/test/demos/TARGETS +++ b/exir/backend/test/demos/BUCK @@ -1,6 +1,7 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_delegate_aten_mode", srcs = [ "test_delegate_aten_mode.py", diff --git a/exir/backend/test/demos/rpc/BUCK b/exir/backend/test/demos/rpc/BUCK index 1e8cc179228..463e4d57758 100644 --- a/exir/backend/test/demos/rpc/BUCK +++ b/exir/backend/test/demos/rpc/BUCK @@ -1,8 +1,79 @@ +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/exir/backend/test/demos/rpc/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") +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 = "executor_backend_preprocess", + srcs = [ + "executor_backend_preprocess.py", + ], + visibility = [ + "//executorch/exir/backend/test/...", + "//executorch/test/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/backend:backend_details", + "//executorch/exir/backend:compile_spec_schema", + "//nodeapi/py:base", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "executor_backend_partitioner", + srcs = [ + "executor_backend_partitioner.py", + ], + visibility = [ + "//executorch/exir/backend/test/...", + "//executorch/exir/emit/test/...", + ], + deps = [ + ":executor_backend_preprocess", + "//caffe2:torch", + "//executorch/exir:graph_module", + "//executorch/exir:lib", + "//executorch/exir/backend:partitioner", + "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", + "//executorch/exir/backend/test:backend_with_compiler_demo", + ], +) + +fbcode_target(_kind = python_unittest, + name = "test_rpc", + srcs = [ + "test_rpc.py", + ], + preload_deps = [ + "//executorch/configurations:optimized_native_cpu_ops", + "//executorch/kernels/quantized:custom_ops_generated_lib", + # the executor backend is prebuilt and linked when building the unit test binary. When it's linked, it'll register the backend. + # It can also be loaded in PyThon runtime via torch.ops.load_library("//executorch/exir/backend/test/demos/rpc:executor_backend") + # However, it's a better practice to build/link everything at earlier stage, instead of during runtime + "//executorch/exir/backend/test/demos/rpc:executor_backend_register", + ], + deps = [ + ":executor_backend_partitioner", + ":executor_backend_preprocess", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/backend:backend_api", + "//executorch/exir/backend/test:op_partitioner_demo", + "//executorch/extension/pybindings:portable_lib", # @manual + ], +) diff --git a/exir/backend/test/demos/rpc/TARGETS b/exir/backend/test/demos/rpc/TARGETS deleted file mode 100644 index d8fb426ba6a..00000000000 --- a/exir/backend/test/demos/rpc/TARGETS +++ /dev/null @@ -1,67 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -define_common_targets() - -runtime.python_library( - name = "executor_backend_preprocess", - srcs = [ - "executor_backend_preprocess.py", - ], - visibility = [ - "//executorch/exir/backend/test/...", - "//executorch/test/...", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/backend:backend_details", - "//executorch/exir/backend:compile_spec_schema", - "//nodeapi/py:base", - ], -) - -runtime.python_library( - name = "executor_backend_partitioner", - srcs = [ - "executor_backend_partitioner.py", - ], - visibility = [ - "//executorch/exir/backend/test/...", - "//executorch/exir/emit/test/...", - ], - deps = [ - ":executor_backend_preprocess", - "//caffe2:torch", - "//executorch/exir:graph_module", - "//executorch/exir:lib", - "//executorch/exir/backend:partitioner", - "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", - "//executorch/exir/backend/test:backend_with_compiler_demo", - ], -) - -python_unittest( - name = "test_rpc", - srcs = [ - "test_rpc.py", - ], - preload_deps = [ - "//executorch/configurations:optimized_native_cpu_ops", - "//executorch/kernels/quantized:custom_ops_generated_lib", - # the executor backend is prebuilt and linked when building the unit test binary. When it's linked, it'll register the backend. - # It can also be loaded in PyThon runtime via torch.ops.load_library("//executorch/exir/backend/test/demos/rpc:executor_backend") - # However, it's a better practice to build/link everything at earlier stage, instead of during runtime - "//executorch/exir/backend/test/demos/rpc:executor_backend_register", - ], - deps = [ - ":executor_backend_partitioner", - ":executor_backend_preprocess", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/backend:backend_api", - "//executorch/exir/backend/test:op_partitioner_demo", - "//executorch/extension/pybindings:portable_lib", # @manual - ], -) diff --git a/exir/capture/BUCK b/exir/capture/BUCK index 51846daef65..71f1ca9ac6b 100644 --- a/exir/capture/BUCK +++ b/exir/capture/BUCK @@ -1,4 +1,52 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # add this empty BUCK file to unblock landing. Without this, we get land error: # "No build file at xplat/executorch/exir/BUCK when resolving target fbsource//xplat/executorch/exir:." -oncall("executorch") + +# !!!! fbcode/executorch/exir/capture/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + + +fbcode_target(_kind = runtime.python_library, + name = "lib", + srcs = [ + "__init__.py", + ], + deps = [ + ":capture", + ":config", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "capture", + srcs = [ + "_capture.py", + ], + deps = [ + ":config", + "//caffe2:torch", + "//executorch/exir:error", + "//executorch/exir:tracer", + "//executorch/exir/program:lib", + "//executorch/exir/program:program", + "//executorch/exir/verification:verifier", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "config", + srcs = [ + "_config.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:dynamic_shape", + "//executorch/exir:pass_manager", + "//executorch/exir:tracer", + "//executorch/exir/passes:lib", + "//executorch/exir/passes:sym_shape_eval_pass", + ], +) diff --git a/exir/capture/TARGETS b/exir/capture/TARGETS deleted file mode 100644 index 983cdd210c9..00000000000 --- a/exir/capture/TARGETS +++ /dev/null @@ -1,45 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "lib", - srcs = [ - "__init__.py", - ], - deps = [ - ":capture", - ":config", - ], -) - -runtime.python_library( - name = "capture", - srcs = [ - "_capture.py", - ], - deps = [ - ":config", - "//caffe2:torch", - "//executorch/exir:error", - "//executorch/exir:tracer", - "//executorch/exir/program:lib", - "//executorch/exir/program:program", - "//executorch/exir/verification:verifier", - ], -) - -runtime.python_library( - name = "config", - srcs = [ - "_config.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:dynamic_shape", - "//executorch/exir:pass_manager", - "//executorch/exir:tracer", - "//executorch/exir/passes:lib", - "//executorch/exir/passes:sym_shape_eval_pass", - ], -) diff --git a/exir/dialects/TARGETS b/exir/dialects/BUCK similarity index 74% rename from exir/dialects/TARGETS rename to exir/dialects/BUCK index 39f0a9d0f1b..4b8b02472ac 100644 --- a/exir/dialects/TARGETS +++ b/exir/dialects/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 = "lib", srcs = [ "_ops.py", diff --git a/exir/dialects/backend/BUCK b/exir/dialects/backend/BUCK index 00117255f7c..d3ee4633223 100644 --- a/exir/dialects/backend/BUCK +++ b/exir/dialects/backend/BUCK @@ -1,4 +1,21 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # add this empty BUCK file to unblock landing. Without this, we get land error: # "No build file at xplat/executorch/exir/dialects/backend/BUCK when resolving target fbsource//xplat/executorch/exir/dialects/backend:." -oncall("executorch") + +# !!!! fbcode/executorch/exir/dialects/backend/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + + +fbcode_target(_kind = runtime.python_library, + name = "lib", + srcs = [ + "_ops.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir/dialects/edge:lib", + ], +) diff --git a/exir/dialects/backend/TARGETS b/exir/dialects/backend/TARGETS deleted file mode 100644 index 1bfd78a9ae1..00000000000 --- a/exir/dialects/backend/TARGETS +++ /dev/null @@ -1,14 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "lib", - srcs = [ - "_ops.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir/dialects/edge:lib", - ], -) diff --git a/exir/dialects/backend/test/TARGETS b/exir/dialects/backend/test/BUCK similarity index 72% rename from exir/dialects/backend/test/TARGETS rename to exir/dialects/backend/test/BUCK index 9cfc5ecff68..1a79a6aa692 100644 --- a/exir/dialects/backend/test/TARGETS +++ b/exir/dialects/backend/test/BUCK @@ -1,8 +1,9 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") oncall("executorch") -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_backend_ops", srcs = [ "test_backend_ops.py", diff --git a/exir/dialects/edge/BUCK b/exir/dialects/edge/BUCK index b220af1d3e6..c7b0df55c16 100644 --- a/exir/dialects/edge/BUCK +++ b/exir/dialects/edge/BUCK @@ -1,4 +1,36 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # add this empty BUCK file to unblock landing. Without this, we get land error: # "No build file at xplat/executorch/exir/BUCK when resolving target fbsource//xplat/executorch/exir/dialects/edge:." -oncall("executorch") + +# !!!! fbcode/executorch/exir/dialects/edge/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbcode_macros//build_defs:export_files.bzl", "export_file") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + + +fbcode_target(_kind = runtime.python_library, + name = "lib", + srcs = [ + "_ops.py", + ], + resources = { + ":edge_yaml": "edge.yaml", + }, + deps = [ + "fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml", + "fbsource//third-party/pypi/setuptools:setuptools", + "//caffe2:torch", + "//caffe2/torchgen:torchgen", + "//executorch/exir/dialects/edge/dtype:lib", + "//executorch/exir/dialects/edge/op:lib", + "//executorch/exir/dialects/edge/spec:lib", + ], +) + +fbcode_target(_kind = export_file, + name = "edge_yaml", + src = "edge.yaml", + visibility = ["//executorch/..."], +) diff --git a/exir/dialects/edge/TARGETS b/exir/dialects/edge/TARGETS deleted file mode 100644 index 4fcf1948b5f..00000000000 --- a/exir/dialects/edge/TARGETS +++ /dev/null @@ -1,29 +0,0 @@ -load("@fbcode_macros//build_defs:export_files.bzl", "export_file") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "lib", - srcs = [ - "_ops.py", - ], - resources = { - ":edge_yaml": "edge.yaml", - }, - deps = [ - "fbsource//third-party/pypi/ruamel-yaml:ruamel-yaml", - "fbsource//third-party/pypi/setuptools:setuptools", - "//caffe2:torch", - "//caffe2/torchgen:torchgen", - "//executorch/exir/dialects/edge/dtype:lib", - "//executorch/exir/dialects/edge/op:lib", - "//executorch/exir/dialects/edge/spec:lib", - ], -) - -export_file( - name = "edge_yaml", - src = "edge.yaml", - visibility = ["//executorch/..."], -) diff --git a/exir/dialects/edge/arg/TARGETS b/exir/dialects/edge/arg/BUCK similarity index 62% rename from exir/dialects/edge/arg/TARGETS rename to exir/dialects/edge/arg/BUCK index 79705a06357..be04bb2961c 100644 --- a/exir/dialects/edge/arg/TARGETS +++ b/exir/dialects/edge/arg/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("ai_infra_mobile_platform") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "lib", srcs = [ "model.py", diff --git a/exir/dialects/edge/dtype/TARGETS b/exir/dialects/edge/dtype/BUCK similarity index 71% rename from exir/dialects/edge/dtype/TARGETS rename to exir/dialects/edge/dtype/BUCK index 9fbec419812..77db4939eb4 100644 --- a/exir/dialects/edge/dtype/TARGETS +++ b/exir/dialects/edge/dtype/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("ai_infra_mobile_platform") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "lib", srcs = [ "runner.py", diff --git a/exir/dialects/edge/op/TARGETS b/exir/dialects/edge/op/BUCK similarity index 77% rename from exir/dialects/edge/op/TARGETS rename to exir/dialects/edge/op/BUCK index c4f5b5c4d70..0fb7051bd76 100644 --- a/exir/dialects/edge/op/TARGETS +++ b/exir/dialects/edge/op/BUCK @@ -1,9 +1,10 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") oncall("ai_infra_mobile_platform") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "lib", srcs = [ "api.py", @@ -17,7 +18,7 @@ runtime.python_library( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_api", srcs = [ "test/test_api.py", diff --git a/exir/dialects/edge/spec/TARGETS b/exir/dialects/edge/spec/BUCK similarity index 80% rename from exir/dialects/edge/spec/TARGETS rename to exir/dialects/edge/spec/BUCK index ce5c5970e14..006c40ce009 100644 --- a/exir/dialects/edge/spec/TARGETS +++ b/exir/dialects/edge/spec/BUCK @@ -1,9 +1,10 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") 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( +fbcode_target(_kind = runtime.python_library, name = "lib", srcs = [ "gen.py", @@ -18,7 +19,7 @@ runtime.python_library( ], ) -python_binary( +fbcode_target(_kind = python_binary, name = "gen", srcs = [], main_function = "executorch.exir.dialects.edge.spec.gen.main", diff --git a/exir/dialects/edge/test/BUCK b/exir/dialects/edge/test/BUCK index 57d84ff1f8f..2b7e3cc208e 100644 --- a/exir/dialects/edge/test/BUCK +++ b/exir/dialects/edge/test/BUCK @@ -1,4 +1,39 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # add this empty BUCK file to unblock landing. Without this, we get land error: # "No build file at xplat/executorch/exir/dialects/edge/test/BUCK when resolving target fbsource//xplat/executorch/exir/dialects/edge/test:." -oncall("executorch") + +# !!!! fbcode/executorch/exir/dialects/edge/test/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + + +fbcode_target(_kind = python_unittest, + name = "test_edge_yaml", + srcs = [ + "test_edge_yaml.py", + ], + resources = { + "//executorch/exir/dialects/edge:edge_yaml": "edge.yaml", + }, + labels = ["long_running"], + deps = [ + "fbsource//third-party/pypi/expecttest:expecttest", # @manual + "//caffe2:torch", + "//executorch/exir/dialects/edge/dtype:lib", + "//executorch/exir/dialects/edge/spec:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "test_edge_ops", + srcs = [ + "test_edge_ops.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir/dialects:lib", + "//executorch/exir/dialects/edge:lib", + ], +) diff --git a/exir/dialects/edge/test/TARGETS b/exir/dialects/edge/test/TARGETS deleted file mode 100644 index 8a689b0dba6..00000000000 --- a/exir/dialects/edge/test/TARGETS +++ /dev/null @@ -1,32 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -python_unittest( - name = "test_edge_yaml", - srcs = [ - "test_edge_yaml.py", - ], - resources = { - "//executorch/exir/dialects/edge:edge_yaml": "edge.yaml", - }, - labels = ["long_running"], - deps = [ - "fbsource//third-party/pypi/expecttest:expecttest", # @manual - "//caffe2:torch", - "//executorch/exir/dialects/edge/dtype:lib", - "//executorch/exir/dialects/edge/spec:lib", - ], -) - -python_unittest( - name = "test_edge_ops", - srcs = [ - "test_edge_ops.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir/dialects:lib", - "//executorch/exir/dialects/edge:lib", - ], -) diff --git a/exir/dialects/test/TARGETS b/exir/dialects/test/BUCK similarity index 64% rename from exir/dialects/test/TARGETS rename to exir/dialects/test/BUCK index 4327d3041b9..0e37d337779 100644 --- a/exir/dialects/test/TARGETS +++ b/exir/dialects/test/BUCK @@ -1,8 +1,9 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") oncall("executorch") -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_exir_dialect_ops", srcs = [ "test_exir_dialect_ops.py", diff --git a/exir/emit/BUCK b/exir/emit/BUCK index 51846daef65..84b000fee2d 100644 --- a/exir/emit/BUCK +++ b/exir/emit/BUCK @@ -1,4 +1,45 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # add this empty BUCK file to unblock landing. Without this, we get land error: # "No build file at xplat/executorch/exir/BUCK when resolving target fbsource//xplat/executorch/exir:." -oncall("executorch") + +# !!!! fbcode/executorch/exir/emit/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + + +fbcode_target(_kind = runtime.python_library, + name = "lib", + srcs = [ + "__init__.py", + ], + deps = [ + ":emit", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "emit", + srcs = [ + "_emit_program.py", + "_emitter.py", + ], + deps = [ + "fbsource//third-party/pypi/typing-extensions:typing-extensions", + "//caffe2:torch", + "//executorch/exir:delegate", + "//executorch/exir:error", + "//executorch/exir:memory", + "//executorch/exir:print_program", + "//executorch/exir:schema", + "//executorch/exir:tensor", + "//executorch/exir:types", + "//executorch/exir:version", + "//executorch/exir/dialects/backend:lib", + "//executorch/exir/dialects/edge:lib", + "//executorch/exir/operator:convert", + "//executorch/exir/passes:prim_ops_py_registry", + "//executorch/extension/pytree:pylib", + ], +) diff --git a/exir/emit/TARGETS b/exir/emit/TARGETS deleted file mode 100644 index 0adee10e82e..00000000000 --- a/exir/emit/TARGETS +++ /dev/null @@ -1,38 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "lib", - srcs = [ - "__init__.py", - ], - deps = [ - ":emit", - ], -) - -runtime.python_library( - name = "emit", - srcs = [ - "_emit_program.py", - "_emitter.py", - ], - deps = [ - "fbsource//third-party/pypi/typing-extensions:typing-extensions", - "//caffe2:torch", - "//executorch/exir:delegate", - "//executorch/exir:error", - "//executorch/exir:memory", - "//executorch/exir:print_program", - "//executorch/exir:schema", - "//executorch/exir:tensor", - "//executorch/exir:types", - "//executorch/exir:version", - "//executorch/exir/dialects/backend:lib", - "//executorch/exir/dialects/edge:lib", - "//executorch/exir/operator:convert", - "//executorch/exir/passes:prim_ops_py_registry", - "//executorch/extension/pytree:pylib", - ], -) diff --git a/exir/emit/test/BUCK b/exir/emit/test/BUCK index 213d4c228d1..71a9619a0bc 100644 --- a/exir/emit/test/BUCK +++ b/exir/emit/test/BUCK @@ -1,4 +1,37 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # add this empty BUCK file to unblock landing. Without this, we get land error: # "No build file at xplat/executorch/exir/tests/BUCK when resolving target fbsource//xplat/executorch/exir/tests:." -oncall("executorch") + +# !!!! fbcode/executorch/exir/emit/test/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + + +fbcode_target(_kind = python_unittest, + # @autodeps-skip pybindings don't work well with autodeps + name = "emit", + srcs = [ + "test_emit.py", + ], + deps = [ + "fbsource//third-party/pypi/pytest:pytest", + "//caffe2:torch", + "//caffe2/functorch:functorch_src", + "//executorch/exir:error", + "//executorch/exir:lib", + "//executorch/exir:print_program", + "//executorch/exir:schema", + "//executorch/exir/backend/test/demos/rpc:executor_backend_partitioner", + "//executorch/exir/backend:backend_api", + "//executorch/exir/emit:lib", + "//executorch/exir/passes:const_prop_pass", + "//executorch/exir/passes:constant_prop_pass", + "//executorch/exir/passes:init_mutable_pass", + "//executorch/exir/tests:lib", + "//executorch/exir/tests:models", + "//executorch/extension/pybindings:portable_lib", + "//executorch/runtime:runtime", + ], +) diff --git a/exir/emit/test/TARGETS b/exir/emit/test/TARGETS deleted file mode 100644 index 153843d45ea..00000000000 --- a/exir/emit/test/TARGETS +++ /dev/null @@ -1,30 +0,0 @@ -load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") - -oncall("executorch") - -python_unittest( - # @autodeps-skip pybindings don't work well with autodeps - name = "emit", - srcs = [ - "test_emit.py", - ], - deps = [ - "fbsource//third-party/pypi/pytest:pytest", - "//caffe2:torch", - "//caffe2/functorch:functorch_src", - "//executorch/exir:error", - "//executorch/exir:lib", - "//executorch/exir:print_program", - "//executorch/exir:schema", - "//executorch/exir/backend/test/demos/rpc:executor_backend_partitioner", - "//executorch/exir/backend:backend_api", - "//executorch/exir/emit:lib", - "//executorch/exir/passes:const_prop_pass", - "//executorch/exir/passes:constant_prop_pass", - "//executorch/exir/passes:init_mutable_pass", - "//executorch/exir/tests:lib", - "//executorch/exir/tests:models", - "//executorch/extension/pybindings:portable_lib", - "//executorch/runtime:runtime", - ], -) diff --git a/exir/operator/TARGETS b/exir/operator/BUCK similarity index 74% rename from exir/operator/TARGETS rename to exir/operator/BUCK index 1a8f82a495a..0a3aa845fc2 100644 --- a/exir/operator/TARGETS +++ b/exir/operator/BUCK @@ -1,9 +1,10 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") oncall("executorch") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "convert", srcs = [ "convert.py", @@ -14,7 +15,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "manip", srcs = [ "manip.py", @@ -25,7 +26,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "util", srcs = [ "util.py", @@ -37,7 +38,7 @@ runtime.python_library( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_operator", srcs = [ "test/test_operator.py", diff --git a/exir/passes/TARGETS b/exir/passes/BUCK similarity index 84% rename from exir/passes/TARGETS rename to exir/passes/BUCK index 45e505cdc7d..e274d0482e6 100644 --- a/exir/passes/TARGETS +++ b/exir/passes/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 = "lib", srcs = [ "__init__.py", @@ -48,7 +49,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "pass_registry", srcs = [ "pass_registry.py", @@ -59,7 +60,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "external_constants_pass", srcs = [ "external_constants_pass.py", @@ -69,7 +70,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "reinplace_pass", srcs = [ "reinplace.py", @@ -80,7 +81,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "insert_write_back_for_buffers_pass", srcs = [ "insert_write_back_for_buffers_pass.py", @@ -90,7 +91,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "weights_to_outputs_pass", srcs = [ "weights_to_outputs_pass.py", @@ -100,7 +101,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "const_prop_pass", srcs = [ "const_prop_pass.py", @@ -112,7 +113,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "scalar_to_tensor_pass", srcs = [ "scalar_to_tensor_pass.py", @@ -123,7 +124,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "constant_prop_pass", srcs = [ "constant_prop_pass.py", @@ -137,7 +138,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "remove_graph_asserts_pass", srcs = [ "remove_graph_asserts_pass.py", @@ -147,7 +148,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "sym_to_tensor_pass", srcs = [ "sym_to_tensor_pass.py", @@ -158,7 +159,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "quant_fusion_pass", srcs = [ "_quant_patterns_and_replacements.py", @@ -174,7 +175,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "quantize_io_pass", srcs = [ "quantize_io_pass.py", @@ -187,7 +188,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "memory_planning_pass", srcs = [ "memory_planning_pass.py", @@ -203,7 +204,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "remove_noop_pass", srcs = [ "remove_noop_pass.py", @@ -215,7 +216,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "prune_empty_tensor_pass", srcs = [ "prune_empty_tensors_pass.py", @@ -227,7 +228,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "remove_mixed_type_operators", srcs = [ "remove_mixed_type_operators.py", @@ -238,7 +239,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "spec_prop_pass", srcs = [ "spec_prop_pass.py", @@ -251,7 +252,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "init_mutable_pass", srcs = [ "init_mutable_pass.py", @@ -261,7 +262,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "sym_shape_eval_pass", srcs = [ "sym_shape_eval_pass.py", @@ -276,7 +277,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "replace_broken_ops_with_function_ops_pass", srcs = [ "replace_broken_ops_with_function_ops_pass.py", @@ -287,7 +288,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "replace_sym_size_op_pass", srcs = [ "replace_sym_size_op_pass.py", @@ -298,7 +299,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "replace_edge_with_backend_pass", srcs = [ "replace_edge_with_backend_pass.py", @@ -310,7 +311,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "normalize_transpose_pass", srcs = [ "normalize_transpose_pass.py", @@ -321,7 +322,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "replace_aten_with_edge_pass", srcs = [ "replace_aten_with_edge_pass.py", @@ -335,7 +336,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "debug_handle_generator_pass", srcs = [ "debug_handle_generator_pass.py", @@ -348,7 +349,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "prim_ops_py_registry", srcs = ["executorch_prim_ops_registry.py"], deps = [ @@ -357,7 +358,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "dim_order_ops_registry", srcs = ["dim_order_ops_registry.py"], deps = [ @@ -367,7 +368,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "memory_format_ops_pass", srcs = [ "memory_format_ops_pass.py", @@ -381,7 +382,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "normalize_view_copy_base_pass", srcs = [ "normalize_view_copy_base_pass.py", @@ -392,7 +393,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "replace_view_copy_with_view_pass", srcs = [ "replace_view_copy_with_view_pass.py", @@ -405,7 +406,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "remove_unused_parameters_pass", srcs = [ "remove_unused_parameters_pass.py", diff --git a/exir/program/TARGETS b/exir/program/BUCK similarity index 89% rename from exir/program/TARGETS rename to exir/program/BUCK index b113d8ab2bc..0667928de6d 100644 --- a/exir/program/TARGETS +++ b/exir/program/BUCK @@ -1,9 +1,10 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") oncall("executorch") -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "lib", srcs = [ "__init__.py", @@ -14,7 +15,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "program", srcs = [ "_program.py", @@ -50,7 +51,7 @@ runtime.python_library( ] + (["//executorch/exir/program/fb:logger"] if not runtime.is_oss else []) ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "fake_program", srcs = [ "_fake_program.py", diff --git a/exir/program/test/TARGETS b/exir/program/test/BUCK similarity index 86% rename from exir/program/test/TARGETS rename to exir/program/test/BUCK index f9788c42265..e57eb729859 100644 --- a/exir/program/test/TARGETS +++ b/exir/program/test/BUCK @@ -1,8 +1,9 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") oncall("executorch") -python_unittest( +fbcode_target(_kind = python_unittest, # @autodeps-skip pybindings don't work well with autodeps name = "test_program", srcs = [ diff --git a/exir/serde/TARGETS b/exir/serde/BUCK similarity index 84% rename from exir/serde/TARGETS rename to exir/serde/BUCK index 4cc442a0fca..a2f17675f43 100644 --- a/exir/serde/TARGETS +++ b/exir/serde/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, # @autodeps-skip for some reason autodeps thinks this target # needs to depend on exir:lib which it doesn't. name = "serialize", diff --git a/exir/tests/BUCK b/exir/tests/BUCK index 213d4c228d1..86a89e6451f 100644 --- a/exir/tests/BUCK +++ b/exir/tests/BUCK @@ -1,4 +1,521 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +oncall("executorch") # add this empty BUCK file to unblock landing. Without this, we get land error: # "No build file at xplat/executorch/exir/tests/BUCK when resolving target fbsource//xplat/executorch/exir/tests:." -oncall("executorch") + +# !!!! fbcode/executorch/exir/tests/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest") + + +fbcode_target(_kind = runtime.python_library, + name = "lib", + srcs = [ + "common.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:schema", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "models", + srcs = [ + "models.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:lowered_backend_module", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "control_flow_models", + srcs = [ + "control_flow_models.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "dynamic_shape_models", + srcs = [ + "dynamic_shape_models.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "transformer", + srcs = [ + "transformer.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "asr_joiner", + srcs = [ + "asr_joiner.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = python_unittest, + name = "tracer", + srcs = [ + "test_tracer.py", + ], + # Static listing does not support tests generated in runtime. + supports_static_listing = False, + deps = [ + "fbsource//third-party/pypi/parameterized:parameterized", + ":lib", + ":models", + "//caffe2:torch", + "//caffe2/functorch:functorch_src", + "//executorch/exir:lib", + "//executorch/exir:tracer", + "//executorch/exir/dialects:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "serde", + srcs = [ + "test_serde.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/backend:backend_api", + "//executorch/exir/backend/test:backend_with_compiler_demo", + "//executorch/exir/backend/test:op_partitioner_demo", + "//executorch/exir/serde:serialize", + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + ], +) + +fbcode_target(_kind = python_unittest, + name = "joint_graph", + srcs = [ + "test_joint_graph.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/extension/pybindings:portable_lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "error", + srcs = [ + "test_error.py", + ], + deps = [ + "//executorch/exir:error", + ], +) + +fbcode_target(_kind = python_unittest, + name = "tensor", + srcs = [ + "test_tensor.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:schema", + "//executorch/exir:tensor", + ], +) + +fbcode_target(_kind = python_unittest, + name = "reinplace_pass", + srcs = [ + "test_reinplace_pass.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/passes:lib", + "//executorch/extension/pybindings:portable_lib", + ], +) + +fbcode_target(_kind = cpp_library, + name = "test_lib", + srcs = [ + "test_lib.cpp", + ], + supports_python_dlopen = True, + deps = [ + "//caffe2:ATen-cpu", + "//caffe2:torch-cpp-cpu", # @manual + ], +) + +fbcode_target(_kind = python_unittest, + name = "op_convert", + srcs = [ + "test_op_convert.py", + ], + preload_deps = [ + "//executorch/kernels/portable:custom_ops_generated_lib", + ":test_lib", # @manual + ], + deps = [ + "//caffe2:torch", + "//executorch/exir/operator:convert", + ], +) + +fbcode_target(_kind = python_unittest, + name = "memory_planning", + srcs = [ + "test_memory_planning.py", + ], + preload_deps = [ + "//executorch/kernels/portable:custom_ops_generated_lib", + ], + # Static listing does not support tests generated with parameterized + supports_static_listing = False, + deps = [ + "fbsource//third-party/pypi/parameterized:parameterized", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:memory_planning", + "//executorch/exir:pass_base", + "//executorch/exir:pass_manager", + "//executorch/exir/passes:lib", + "//executorch/exir/passes:sym_shape_eval_pass", + ], +) + +fbcode_target(_kind = python_unittest, + name = "passes", + srcs = [ + "test_passes.py", + ], + preload_deps = [":test_lib"], + deps = [ + ":control_flow_models", + ":lib", + ":models", + "//caffe2:torch", + "//caffe2/functorch:functorch_src", + "//executorch/exir:graph_module", + "//executorch/exir:lib", + "//executorch/exir:memory", + "//executorch/exir:memory_planning", + "//executorch/exir:pass_base", + "//executorch/exir:schema", + "//executorch/exir:tensor", + "//executorch/exir/dialects:lib", + "//executorch/exir/dialects/edge:lib", + "//executorch/exir/emit:lib", + "//executorch/exir/passes:constant_prop_pass", + "//executorch/exir/passes:debug_handle_generator_pass", + "//executorch/exir/passes:insert_write_back_for_buffers_pass", + "//executorch/exir/passes:lib", + "//executorch/exir/passes:memory_format_ops_pass", + "//executorch/exir/passes:normalize_view_copy_base_pass", + "//executorch/exir/passes:remove_graph_asserts_pass", + "//executorch/exir/passes:remove_mixed_type_operators", + "//executorch/exir/passes:replace_edge_with_backend_pass", + "//executorch/exir/passes:replace_view_copy_with_view_pass", + "//executorch/exir/passes:scalar_to_tensor_pass", + "//executorch/exir/passes:spec_prop_pass", + "//executorch/exir/passes:sym_to_tensor_pass", + "//executorch/exir/program:program", + "//executorch/extension/pybindings:portable_lib", # @manual + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer_utils", + ], +) + +fbcode_target(_kind = python_unittest, + name = "pass_infra", + srcs = [ + "test_pass_infra.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:pass_manager", + "//executorch/exir/passes:lib", + "//executorch/exir/passes:pass_registry", + ], +) + +fbcode_target(_kind = python_unittest, + name = "common", + srcs = [ + "test_common.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:common", + "//executorch/exir:print_program", + ], +) + +fbcode_target(_kind = python_unittest, + name = "verification", + srcs = [ + "test_verification.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:schema", + "//executorch/exir/passes:const_prop_pass", + "//executorch/exir/verification:interpreter", + "//executorch/exir/verification:verifier", + ], +) + +fbcode_target(_kind = python_unittest, + name = "delegate", + srcs = [ + "test_delegate.py", + ], + deps = [ + ":lib", + ":models", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:lowered_backend_module", + "//executorch/exir:schema", + "//executorch/exir/dialects:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "quant_fusion_pass", + srcs = [ + "test_quant_fusion_pass.py", + ], + preload_deps = [ + "//executorch/kernels/quantized:custom_ops_generated_lib", + ], + deps = [ + ":lib", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/passes:quant_fusion_pass", + "//pytorch/ao:torchao", + "//executorch/exir/passes:constant_prop_pass", + ], +) + +fbcode_target(_kind = python_unittest, + name = "quantization", + srcs = [ + "test_quantization.py", + ], + preload_deps = [ + "//executorch/kernels/quantized:custom_ops_generated_lib", + ], + deps = [ + "fbsource//third-party/pypi/expecttest:expecttest", # @manual + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/passes:quant_fusion_pass", + "//executorch/exir/passes:spec_prop_pass", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + "//pytorch/vision:torchvision", + ], +) + +fbcode_target(_kind = python_unittest, + name = "capture", + srcs = [ + "test_capture.py", + ], + # Static listing does not support tests generated in runtime. + supports_static_listing = False, + deps = [ + "fbsource//third-party/pypi/parameterized:parameterized", + ":models", + "//caffe2:torch", + "//executorch/exir:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "dynamic_shape_propagation", + srcs = [ + "test_dynamic_shape_propagation.py", + ], + deps = [ + ":models", + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/passes:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "arg_validator", + srcs = [ + "test_arg_validator.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/dialects:lib", + "//executorch/exir/dialects/edge:lib", + "//executorch/exir/verification:verifier", + ], +) + +fbcode_target(_kind = python_unittest, + name = "dim_order_utils", + srcs = [ + "test_dim_order_utils.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:dim_order_utils", + "//executorch/exir:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "test_memory_format_ops_pass_aten", + srcs = [ + "test_memory_format_ops_pass_aten.py", + ], + deps = [ + ":test_memory_format_ops_pass_utils", + "//caffe2:torch", + "//executorch/extension/pybindings:aten_lib", # @manual + "//pytorch/vision:torchvision", # @manual + ], +) + +fbcode_target(_kind = python_unittest, + name = "test_memory_format_ops_pass", + srcs = [ + "test_memory_format_ops_pass.py", + ], + deps = [ + ":test_memory_format_ops_pass_utils", + "//caffe2:torch", + "//executorch/exir:dim_order_utils", + "//executorch/exir:lib", + "//executorch/exir:pass_base", + "//executorch/exir/dialects:lib", + "//executorch/exir/dialects/edge:lib", + "//executorch/extension/pybindings:portable_lib", # @manual + "//pytorch/vision:torchvision", # @manual + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "test_memory_format_ops_pass_utils", + srcs = [ + "test_memory_format_ops_pass_utils.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/xnnpack/partition:xnnpack_partitioner", + "//executorch/exir:dim_order_utils", + "//executorch/exir:lib", + "//executorch/exir/capture:config", + ], +) + +fbcode_target(_kind = python_unittest, + name = "print_program", + srcs = [ + "test_print_program.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:print_program", + ], +) + +fbcode_target(_kind = python_unittest, + name = "test_remove_unused_parameters_pass", + srcs = [ + "test_remove_unused_parameters_pass.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/xnnpack:xnnpack_delegate", + "//executorch/exir:lib", + "//executorch/exir:memory", + "//executorch/exir/capture:config", + "//executorch/exir/passes:lib", + "//executorch/runtime:runtime", + ], +) + +fbcode_target(_kind = python_unittest, + name = "test_remove_view_copy", + srcs = [ + "test_remove_view_copy.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:memory", + "//executorch/exir/capture:config", + "//executorch/exir/passes:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "test_prune_empty_tensors", + srcs = [ + "test_prune_empty_tensors_pass.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir:memory", + "//executorch/exir/capture:config", + "//executorch/exir/passes:lib", + ], +) + +fbcode_target(_kind = python_unittest, + name = "warnings", + srcs = [ + "test_warnings.py", + ], + deps = [ + "//executorch/exir:_warnings", + ], +) + +fbcode_target(_kind = python_unittest, + name = "quantize_io_pass", + srcs = [ + "test_quantize_io_pass.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/exir:lib", + "//executorch/exir/passes:quantize_io_pass", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + ], +) diff --git a/exir/tests/TARGETS b/exir/tests/TARGETS deleted file mode 100644 index 017a133b587..00000000000 --- a/exir/tests/TARGETS +++ /dev/null @@ -1,514 +0,0 @@ -load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library") -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 = "lib", - srcs = [ - "common.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:schema", - ], -) - -runtime.python_library( - name = "models", - srcs = [ - "models.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:lowered_backend_module", - ], -) - -runtime.python_library( - name = "control_flow_models", - srcs = [ - "control_flow_models.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "dynamic_shape_models", - srcs = [ - "dynamic_shape_models.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "transformer", - srcs = [ - "transformer.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "asr_joiner", - srcs = [ - "asr_joiner.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -python_unittest( - name = "tracer", - srcs = [ - "test_tracer.py", - ], - # Static listing does not support tests generated in runtime. - supports_static_listing = False, - deps = [ - "fbsource//third-party/pypi/parameterized:parameterized", - ":lib", - ":models", - "//caffe2:torch", - "//caffe2/functorch:functorch_src", - "//executorch/exir:lib", - "//executorch/exir:tracer", - "//executorch/exir/dialects:lib", - ], -) - -python_unittest( - name = "serde", - srcs = [ - "test_serde.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/backend:backend_api", - "//executorch/exir/backend/test:backend_with_compiler_demo", - "//executorch/exir/backend/test:op_partitioner_demo", - "//executorch/exir/serde:serialize", - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - ], -) - -python_unittest( - name = "joint_graph", - srcs = [ - "test_joint_graph.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/extension/pybindings:portable_lib", - ], -) - -python_unittest( - name = "error", - srcs = [ - "test_error.py", - ], - deps = [ - "//executorch/exir:error", - ], -) - -python_unittest( - name = "tensor", - srcs = [ - "test_tensor.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:schema", - "//executorch/exir:tensor", - ], -) - -python_unittest( - name = "reinplace_pass", - srcs = [ - "test_reinplace_pass.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/passes:lib", - "//executorch/extension/pybindings:portable_lib", - ], -) - -cpp_library( - name = "test_lib", - srcs = [ - "test_lib.cpp", - ], - supports_python_dlopen = True, - deps = [ - "//caffe2:ATen-cpu", - "//caffe2:torch-cpp-cpu", # @manual - ], -) - -python_unittest( - name = "op_convert", - srcs = [ - "test_op_convert.py", - ], - preload_deps = [ - "//executorch/kernels/portable:custom_ops_generated_lib", - ":test_lib", # @manual - ], - deps = [ - "//caffe2:torch", - "//executorch/exir/operator:convert", - ], -) - -python_unittest( - name = "memory_planning", - srcs = [ - "test_memory_planning.py", - ], - preload_deps = [ - "//executorch/kernels/portable:custom_ops_generated_lib", - ], - # Static listing does not support tests generated with parameterized - supports_static_listing = False, - deps = [ - "fbsource//third-party/pypi/parameterized:parameterized", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:memory_planning", - "//executorch/exir:pass_base", - "//executorch/exir:pass_manager", - "//executorch/exir/passes:lib", - "//executorch/exir/passes:sym_shape_eval_pass", - ], -) - -python_unittest( - name = "passes", - srcs = [ - "test_passes.py", - ], - preload_deps = [":test_lib"], - deps = [ - ":control_flow_models", - ":lib", - ":models", - "//caffe2:torch", - "//caffe2/functorch:functorch_src", - "//executorch/exir:graph_module", - "//executorch/exir:lib", - "//executorch/exir:memory", - "//executorch/exir:memory_planning", - "//executorch/exir:pass_base", - "//executorch/exir:schema", - "//executorch/exir:tensor", - "//executorch/exir/dialects:lib", - "//executorch/exir/dialects/edge:lib", - "//executorch/exir/emit:lib", - "//executorch/exir/passes:constant_prop_pass", - "//executorch/exir/passes:debug_handle_generator_pass", - "//executorch/exir/passes:insert_write_back_for_buffers_pass", - "//executorch/exir/passes:lib", - "//executorch/exir/passes:memory_format_ops_pass", - "//executorch/exir/passes:normalize_view_copy_base_pass", - "//executorch/exir/passes:remove_graph_asserts_pass", - "//executorch/exir/passes:remove_mixed_type_operators", - "//executorch/exir/passes:replace_edge_with_backend_pass", - "//executorch/exir/passes:replace_view_copy_with_view_pass", - "//executorch/exir/passes:scalar_to_tensor_pass", - "//executorch/exir/passes:spec_prop_pass", - "//executorch/exir/passes:sym_to_tensor_pass", - "//executorch/exir/program:program", - "//executorch/extension/pybindings:portable_lib", # @manual - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer_utils", - ], -) - -python_unittest( - name = "pass_infra", - srcs = [ - "test_pass_infra.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:pass_manager", - "//executorch/exir/passes:lib", - "//executorch/exir/passes:pass_registry", - ], -) - -python_unittest( - name = "common", - srcs = [ - "test_common.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:common", - "//executorch/exir:print_program", - ], -) - -python_unittest( - name = "verification", - srcs = [ - "test_verification.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:schema", - "//executorch/exir/passes:const_prop_pass", - "//executorch/exir/verification:interpreter", - "//executorch/exir/verification:verifier", - ], -) - -python_unittest( - name = "delegate", - srcs = [ - "test_delegate.py", - ], - deps = [ - ":lib", - ":models", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:lowered_backend_module", - "//executorch/exir:schema", - "//executorch/exir/dialects:lib", - ], -) - -python_unittest( - name = "quant_fusion_pass", - srcs = [ - "test_quant_fusion_pass.py", - ], - preload_deps = [ - "//executorch/kernels/quantized:custom_ops_generated_lib", - ], - deps = [ - ":lib", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/passes:quant_fusion_pass", - "//pytorch/ao:torchao", - "//executorch/exir/passes:constant_prop_pass", - ], -) - -python_unittest( - name = "quantization", - srcs = [ - "test_quantization.py", - ], - preload_deps = [ - "//executorch/kernels/quantized:custom_ops_generated_lib", - ], - deps = [ - "fbsource//third-party/pypi/expecttest:expecttest", # @manual - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/passes:quant_fusion_pass", - "//executorch/exir/passes:spec_prop_pass", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - "//pytorch/vision:torchvision", - ], -) - -python_unittest( - name = "capture", - srcs = [ - "test_capture.py", - ], - # Static listing does not support tests generated in runtime. - supports_static_listing = False, - deps = [ - "fbsource//third-party/pypi/parameterized:parameterized", - ":models", - "//caffe2:torch", - "//executorch/exir:lib", - ], -) - -python_unittest( - name = "dynamic_shape_propagation", - srcs = [ - "test_dynamic_shape_propagation.py", - ], - deps = [ - ":models", - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/passes:lib", - ], -) - -python_unittest( - name = "arg_validator", - srcs = [ - "test_arg_validator.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/dialects:lib", - "//executorch/exir/dialects/edge:lib", - "//executorch/exir/verification:verifier", - ], -) - -python_unittest( - name = "dim_order_utils", - srcs = [ - "test_dim_order_utils.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:dim_order_utils", - "//executorch/exir:lib", - ], -) - -python_unittest( - name = "test_memory_format_ops_pass_aten", - srcs = [ - "test_memory_format_ops_pass_aten.py", - ], - deps = [ - ":test_memory_format_ops_pass_utils", - "//caffe2:torch", - "//executorch/extension/pybindings:aten_lib", # @manual - "//pytorch/vision:torchvision", # @manual - ], -) - -python_unittest( - name = "test_memory_format_ops_pass", - srcs = [ - "test_memory_format_ops_pass.py", - ], - deps = [ - ":test_memory_format_ops_pass_utils", - "//caffe2:torch", - "//executorch/exir:dim_order_utils", - "//executorch/exir:lib", - "//executorch/exir:pass_base", - "//executorch/exir/dialects:lib", - "//executorch/exir/dialects/edge:lib", - "//executorch/extension/pybindings:portable_lib", # @manual - "//pytorch/vision:torchvision", # @manual - ], -) - -runtime.python_library( - name = "test_memory_format_ops_pass_utils", - srcs = [ - "test_memory_format_ops_pass_utils.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/xnnpack/partition:xnnpack_partitioner", - "//executorch/exir:dim_order_utils", - "//executorch/exir:lib", - "//executorch/exir/capture:config", - ], -) - -python_unittest( - name = "print_program", - srcs = [ - "test_print_program.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:print_program", - ], -) - -python_unittest( - name = "test_remove_unused_parameters_pass", - srcs = [ - "test_remove_unused_parameters_pass.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/backends/xnnpack:xnnpack_delegate", - "//executorch/exir:lib", - "//executorch/exir:memory", - "//executorch/exir/capture:config", - "//executorch/exir/passes:lib", - "//executorch/runtime:runtime", - ], -) - -python_unittest( - name = "test_remove_view_copy", - srcs = [ - "test_remove_view_copy.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:memory", - "//executorch/exir/capture:config", - "//executorch/exir/passes:lib", - ], -) - -python_unittest( - name = "test_prune_empty_tensors", - srcs = [ - "test_prune_empty_tensors_pass.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir:memory", - "//executorch/exir/capture:config", - "//executorch/exir/passes:lib", - ], -) - -python_unittest( - name = "warnings", - srcs = [ - "test_warnings.py", - ], - deps = [ - "//executorch/exir:_warnings", - ], -) - -python_unittest( - name = "quantize_io_pass", - srcs = [ - "test_quantize_io_pass.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/exir:lib", - "//executorch/exir/passes:quantize_io_pass", - "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", - ], -) diff --git a/exir/verification/TARGETS b/exir/verification/BUCK similarity index 81% rename from exir/verification/TARGETS rename to exir/verification/BUCK index 85251677b55..b275f2d3d2f 100644 --- a/exir/verification/TARGETS +++ b/exir/verification/BUCK @@ -1,9 +1,10 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") 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( +fbcode_target(_kind = runtime.cxx_python_extension, name = "bindings", srcs = [ "bindings.cpp", @@ -16,7 +17,7 @@ runtime.cxx_python_extension( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "interpreter", srcs = [ "interpreter.py", @@ -31,7 +32,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "devhtml", srcs = [ "dev_html.py", @@ -41,7 +42,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "verifier", srcs = [ "arg_validator.py", @@ -57,7 +58,7 @@ runtime.python_library( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_verifier", srcs = ["test/test_verifier.py"], deps = [ diff --git a/export/TARGETS b/export/BUCK similarity index 80% rename from export/TARGETS rename to export/BUCK index 71be2259584..ac52ab66cde 100644 --- a/export/TARGETS +++ b/export/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 = "recipe", srcs = [ "recipe.py", @@ -16,7 +17,7 @@ runtime.python_library( ] ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "export", srcs = [ "export.py", @@ -31,7 +32,7 @@ runtime.python_library( ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "stages", srcs = [ "stages.py", @@ -49,7 +50,7 @@ runtime.python_library( ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "lib", srcs = [ "__init__.py", @@ -65,7 +66,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "recipe_registry", srcs = [ "recipe_registry.py", @@ -78,7 +79,7 @@ runtime.python_library( ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "recipe_provider", srcs = [ "recipe_provider.py", @@ -88,14 +89,14 @@ runtime.python_library( ] ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "types", srcs = [ "types.py", ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "target_recipes", srcs = [ "target_recipes.py", @@ -110,7 +111,7 @@ runtime.python_library( ] ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "export_utils", srcs = ["utils.py"], deps = [