diff --git a/examples/models/smollm2/BUCK b/examples/models/smollm2/BUCK new file mode 100644 index 00000000000..6d81065373b --- /dev/null +++ b/examples/models/smollm2/BUCK @@ -0,0 +1,25 @@ +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_library.bzl", "python_library") + +oncall("executorch") + +fbcode_target(_kind = runtime.python_library, + name = "smollm2", + srcs = [ + "__init__.py", + "convert_weights.py", + ], + _is_external_target = True, + base_module = "executorch.examples.models.smollm2", + resources = { + "135M_config.json": "135M_config.json", + }, + 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/smollm3/BUCK b/examples/models/smollm3/BUCK new file mode 100644 index 00000000000..b03f024c53e --- /dev/null +++ b/examples/models/smollm3/BUCK @@ -0,0 +1,25 @@ +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_library.bzl", "python_library") + +oncall("executorch") + +fbcode_target(_kind = runtime.python_library, + name = "smollm3", + srcs = [ + "__init__.py", + "convert_weights.py", + ], + _is_external_target = True, + base_module = "executorch.examples.models.smollm3", + resources = { + "3b_config.json": "3b_config.json", + }, + 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/torchvision_vit/BUCK b/examples/models/torchvision_vit/BUCK new file mode 100644 index 00000000000..b830e3070eb --- /dev/null +++ b/examples/models/torchvision_vit/BUCK @@ -0,0 +1,17 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +oncall("executorch") + +fbcode_target(_kind = python_library, + name = "vit_model", + srcs = [ + "__init__.py", + "model.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/examples/models:model_base", + "//pytorch/vision:torchvision", # @manual + ], +) diff --git a/examples/models/toy_model/BUCK b/examples/models/toy_model/BUCK new file mode 100644 index 00000000000..bf6f892c51c --- /dev/null +++ b/examples/models/toy_model/BUCK @@ -0,0 +1,17 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +oncall("executorch") + +fbcode_target(_kind = python_library, + name = "toy_model", + srcs = [ + "__init__.py", + "model.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/examples/models:model_base", + "//executorch/exir/backend:compile_spec_schema", + ], +) diff --git a/examples/models/wav2letter/BUCK b/examples/models/wav2letter/BUCK new file mode 100644 index 00000000000..7708586627d --- /dev/null +++ b/examples/models/wav2letter/BUCK @@ -0,0 +1,17 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") +load("@fbcode_macros//build_defs:python_library.bzl", "python_library") + +oncall("executorch") + +fbcode_target(_kind = python_library, + name = "w2l_model", + srcs = [ + "__init__.py", + "model.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/examples/models:model_base", + "//pytorch/audio/src:torchaudio_core", + ], +) diff --git a/examples/portable/custom_ops/BUCK b/examples/portable/custom_ops/BUCK index 1e8cc179228..6c16eccfff5 100644 --- a/examples/portable/custom_ops/BUCK +++ b/examples/portable/custom_ops/BUCK @@ -1,8 +1,19 @@ +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/examples/portable/custom_ops/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. This file can contain fbcode-only targets. + +load(":targets.bzl", "define_common_targets") + + +fbcode_target(_kind = define_common_targets,) diff --git a/examples/portable/executor_runner/BUCK b/examples/portable/executor_runner/BUCK index 1e8cc179228..ed0f093e453 100644 --- a/examples/portable/executor_runner/BUCK +++ b/examples/portable/executor_runner/BUCK @@ -1,8 +1,19 @@ +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/examples/portable/executor_runner/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. This file can contain fbcode-only targets. + +load(":targets.bzl", "define_common_targets") + + +fbcode_target(_kind = define_common_targets,) diff --git a/examples/portable/executor_runner/TARGETS b/examples/portable/executor_runner/TARGETS deleted file mode 100644 index 2341af9282f..00000000000 --- a/examples/portable/executor_runner/TARGETS +++ /dev/null @@ -1,8 +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(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() diff --git a/examples/portable/scripts/BUCK b/examples/portable/scripts/BUCK new file mode 100644 index 00000000000..ba3ebc023de --- /dev/null +++ b/examples/portable/scripts/BUCK @@ -0,0 +1,20 @@ +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") + +fbcode_target(_kind = runtime.python_binary, + name = "export", + srcs = [ + "export.py", + ], + main_function = "executorch.examples.portable.scripts.export.main", + resources = { + "//executorch/examples/models/llama/params:params": "params", + }, + visibility = ["//executorch/..."], + deps = [ + "//executorch/examples/models:models", + "//executorch/extension/export_util:export_util", + ], +) diff --git a/examples/qualcomm/TARGETS b/examples/qualcomm/BUCK similarity index 87% rename from examples/qualcomm/TARGETS rename to examples/qualcomm/BUCK index 73d4788d705..a1b5dbaa12d 100644 --- a/examples/qualcomm/TARGETS +++ b/examples/qualcomm/BUCK @@ -1,3 +1,4 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") # Any targets that should be shared between fbcode and xplat must be defined in # targets.bzl. This file can contain fbcode-only targets. @@ -8,7 +9,7 @@ load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_l oncall("executorch") -python_binary( +fbcode_target(_kind = python_binary, name = "export_example", srcs = ["scripts/export_example.py"], main_function = ".scripts.export_example.main", @@ -24,7 +25,7 @@ python_binary( ], ) -runtime.command_alias( +fbcode_target(_kind = 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()), @@ -33,7 +34,7 @@ runtime.command_alias( exe = ":export_example", ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "utils", srcs = ["utils.py"], deps = [ diff --git a/examples/qualcomm/executor_runner/BUCK b/examples/qualcomm/executor_runner/BUCK index 1e8cc179228..678f861e0d4 100644 --- a/examples/qualcomm/executor_runner/BUCK +++ b/examples/qualcomm/executor_runner/BUCK @@ -1,8 +1,19 @@ +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") + + +non_fbcode_target(_kind = define_common_targets,) + +# !!!! fbcode/executorch/examples/qualcomm/executor_runner/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + # Any targets that should be shared between fbcode and xplat must be defined in # targets.bzl. This file can contain xplat-only targets. load(":targets.bzl", "define_common_targets") -oncall("executorch") -define_common_targets() +fbcode_target(_kind = define_common_targets,) diff --git a/examples/qualcomm/executor_runner/TARGETS b/examples/qualcomm/executor_runner/TARGETS deleted file mode 100644 index 1e8cc179228..00000000000 --- a/examples/qualcomm/executor_runner/TARGETS +++ /dev/null @@ -1,8 +0,0 @@ -# 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() diff --git a/examples/qualcomm/oss_scripts/llama/BUCK b/examples/qualcomm/oss_scripts/llama/BUCK index 1e8cc179228..3ed7e14b6c6 100644 --- a/examples/qualcomm/oss_scripts/llama/BUCK +++ b/examples/qualcomm/oss_scripts/llama/BUCK @@ -1,8 +1,132 @@ +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/examples/qualcomm/oss_scripts/llama/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("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version") +load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + + +fbcode_target(_kind = runtime.python_library, + name = "static_llama", + srcs = [ + "model/__init__.py", + "model/apply_rope.py", + "model/feed_forward.py", + "model/layernorm.py", + "model/static_llama.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/examples/models/llama:transformer_modules", + "fbsource//third-party/pypi/transformers:transformers", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "decoder_utils", + srcs = [ + "decoder_utils.py", + ], + deps = [ + "//caffe2:torch", + "//executorch/examples/models/llama:eval_library", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "masking_utils", + srcs = [ + "masking_utils.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "decoder_constants", + srcs = [ + "decoder_constants.py", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "llama_lib", + srcs = ["__init__.py", "llama.py"], + deps = [ + ":decoder_constants", + ":decoder_utils", + ":masking_utils", + "//executorch/examples/models/llama:source_transformation", + "//caffe2:torch", + "//executorch/backends/qualcomm/partition:partition", + "//executorch/backends/qualcomm/quantizer:quantizer", + "//executorch/devtools/backend_debug:delegation_info", + "//executorch/devtools:lib", + "//executorch/examples/models:models", + "//executorch/examples/models/llama:hf_download", + "//executorch/examples/qualcomm/oss_scripts/llama:range_setting_pt2e", + "//executorch/examples/qualcomm/oss_scripts/llama:static_llama", + "//executorch/examples/qualcomm:utils", + "//executorch/extension/export_util:export_util", + "//executorch/extension/llm/export:export_lib", + "//executorch/extension/pybindings:aten_lib", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "range_setting_pt2e", + srcs = [ + "range_setting_pt2e.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = python_binary, + name = "llama", + main_function = "executorch.examples.qualcomm.oss_scripts.llama.llama.main", + preload_deps = [ + "//executorch/extension/llm/custom_ops:model_sharding_py", + ], + deps = [ + ":llama_lib", + ], +) + +fbcode_target(_kind = python_binary, + name = "eval_llama_qnn", + srcs = ["eval_llama_qnn.py"], + main_function = "executorch.examples.qualcomm.oss_scripts.llama.eval_llama_qnn.main", + preload_deps = [ + "//executorch/extension/llm/custom_ops:model_sharding_py", + ], + deps = [ + ":llama_lib", + "//executorch/examples/models/llama:eval_library", + "//executorch/examples/qualcomm/oss_scripts/llama:range_setting_pt2e", + "fbsource//third-party/pypi/lm-eval:lm-eval", + ], + keep_gpu_sections = True, +) + +fbcode_target(_kind = runtime.command_alias, + name = "llama_qnn", + env = { + "LD_LIBRARY_PATH": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs)".format(get_qnn_library_version()), + # Place holder to pass the QNN_SDK_ROOT check in executorch/examples/qualcomm/utils.py + "QNN_SDK_ROOT": "", + }, + exe = ":llama", +) diff --git a/examples/qualcomm/oss_scripts/llama/TARGETS b/examples/qualcomm/oss_scripts/llama/TARGETS deleted file mode 100644 index a222554ac0d..00000000000 --- a/examples/qualcomm/oss_scripts/llama/TARGETS +++ /dev/null @@ -1,121 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version") -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 = "static_llama", - srcs = [ - "model/__init__.py", - "model/apply_rope.py", - "model/feed_forward.py", - "model/layernorm.py", - "model/static_llama.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/examples/models/llama:transformer_modules", - "fbsource//third-party/pypi/transformers:transformers", - ], -) - -runtime.python_library( - name = "decoder_utils", - srcs = [ - "decoder_utils.py", - ], - deps = [ - "//caffe2:torch", - "//executorch/examples/models/llama:eval_library", - ], -) - -runtime.python_library( - name = "masking_utils", - srcs = [ - "masking_utils.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "decoder_constants", - srcs = [ - "decoder_constants.py", - ], -) - -runtime.python_library( - name = "llama_lib", - srcs = ["__init__.py", "llama.py"], - deps = [ - ":decoder_constants", - ":decoder_utils", - ":masking_utils", - "//executorch/examples/models/llama:source_transformation", - "//caffe2:torch", - "//executorch/backends/qualcomm/partition:partition", - "//executorch/backends/qualcomm/quantizer:quantizer", - "//executorch/devtools/backend_debug:delegation_info", - "//executorch/devtools:lib", - "//executorch/examples/models:models", - "//executorch/examples/models/llama:hf_download", - "//executorch/examples/qualcomm/oss_scripts/llama:range_setting_pt2e", - "//executorch/examples/qualcomm/oss_scripts/llama:static_llama", - "//executorch/examples/qualcomm:utils", - "//executorch/extension/export_util:export_util", - "//executorch/extension/llm/export:export_lib", - "//executorch/extension/pybindings:aten_lib", - ], -) - -runtime.python_library( - name = "range_setting_pt2e", - srcs = [ - "range_setting_pt2e.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -python_binary( - name = "llama", - main_function = "executorch.examples.qualcomm.oss_scripts.llama.llama.main", - preload_deps = [ - "//executorch/extension/llm/custom_ops:model_sharding_py", - ], - deps = [ - ":llama_lib", - ], -) - -python_binary( - name = "eval_llama_qnn", - srcs = ["eval_llama_qnn.py"], - main_function = "executorch.examples.qualcomm.oss_scripts.llama.eval_llama_qnn.main", - preload_deps = [ - "//executorch/extension/llm/custom_ops:model_sharding_py", - ], - deps = [ - ":llama_lib", - "//executorch/examples/models/llama:eval_library", - "//executorch/examples/qualcomm/oss_scripts/llama:range_setting_pt2e", - "fbsource//third-party/pypi/lm-eval:lm-eval", - ], - keep_gpu_sections = True, -) - -runtime.command_alias( - name = "llama_qnn", - env = { - "LD_LIBRARY_PATH": "$(location fbsource//third-party/qualcomm/qnn/qnn-{0}:qnn_offline_compile_libs)".format(get_qnn_library_version()), - # Place holder to pass the QNN_SDK_ROOT check in executorch/examples/qualcomm/utils.py - "QNN_SDK_ROOT": "", - }, - exe = ":llama", -) diff --git a/examples/qualcomm/oss_scripts/whisper/BUCK b/examples/qualcomm/oss_scripts/whisper/BUCK index 1e8cc179228..9e9308ba5a7 100644 --- a/examples/qualcomm/oss_scripts/whisper/BUCK +++ b/examples/qualcomm/oss_scripts/whisper/BUCK @@ -1,8 +1,59 @@ +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/examples/qualcomm/oss_scripts/whisper/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("@fbcode_macros//build_defs:python_binary.bzl", "python_binary") +load("@fbsource//xplat/executorch/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") + + +fbcode_target(_kind = runtime.python_library, + name = "whisper_model_lib", + srcs = [ + "whisper_model.py", + ], + deps = [ + "//caffe2:torch", + "fbsource//third-party/pypi/transformers:transformers", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "whisper_lib", + srcs = ["whisper.py"], + deps = [ + ":whisper_model_lib", + "//caffe2:torch", + "//executorch/backends/qualcomm/_passes:passes", + "//executorch/backends/qualcomm/partition:partition", + "//executorch/backends/qualcomm/quantizer:quantizer", + "//executorch/backends/qualcomm/serialization:serialization", + "//executorch/backends/qualcomm/utils:utils", + "//executorch/devtools/backend_debug:delegation_info", + "//executorch/examples/qualcomm:utils", + "//executorch/exir/capture:config", + "//executorch/exir/passes:memory_planning_pass", + "fbsource//third-party/pypi/datasets:datasets", + "fbsource//third-party/pypi/librosa:librosa", + "fbsource//third-party/pypi/soundfile:soundfile", + "fbsource//third-party/pypi/torchmetrics:torchmetrics", + "fbsource//third-party/pypi/transformers:transformers", + ], +) + +fbcode_target(_kind = python_binary, + name = "whisper", + main_module = "executorch.examples.qualcomm.oss_scripts.whisper.whisper", + deps = [ + ":whisper_lib", + ], +) diff --git a/examples/qualcomm/oss_scripts/whisper/TARGETS b/examples/qualcomm/oss_scripts/whisper/TARGETS deleted file mode 100644 index 7bd33c3db3f..00000000000 --- a/examples/qualcomm/oss_scripts/whisper/TARGETS +++ /dev/null @@ -1,48 +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/backends/qualcomm/qnn_version.bzl", "get_qnn_library_version") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "whisper_model_lib", - srcs = [ - "whisper_model.py", - ], - deps = [ - "//caffe2:torch", - "fbsource//third-party/pypi/transformers:transformers", - ], -) - -runtime.python_library( - name = "whisper_lib", - srcs = ["whisper.py"], - deps = [ - ":whisper_model_lib", - "//caffe2:torch", - "//executorch/backends/qualcomm/_passes:passes", - "//executorch/backends/qualcomm/partition:partition", - "//executorch/backends/qualcomm/quantizer:quantizer", - "//executorch/backends/qualcomm/serialization:serialization", - "//executorch/backends/qualcomm/utils:utils", - "//executorch/devtools/backend_debug:delegation_info", - "//executorch/examples/qualcomm:utils", - "//executorch/exir/capture:config", - "//executorch/exir/passes:memory_planning_pass", - "fbsource//third-party/pypi/datasets:datasets", - "fbsource//third-party/pypi/librosa:librosa", - "fbsource//third-party/pypi/soundfile:soundfile", - "fbsource//third-party/pypi/torchmetrics:torchmetrics", - "fbsource//third-party/pypi/transformers:transformers", - ], -) - -python_binary( - name = "whisper", - main_module = "executorch.examples.qualcomm.oss_scripts.whisper.whisper", - deps = [ - ":whisper_lib", - ], -) diff --git a/examples/selective_build/BUCK b/examples/selective_build/BUCK index 1e8cc179228..47bc3844aea 100644 --- a/examples/selective_build/BUCK +++ b/examples/selective_build/BUCK @@ -1,8 +1,19 @@ +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/examples/selective_build/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. This file can contain fbcode-only targets. + +load(":targets.bzl", "define_common_targets") + + +fbcode_target(_kind = define_common_targets,) diff --git a/examples/selective_build/TARGETS b/examples/selective_build/TARGETS deleted file mode 100644 index 2341af9282f..00000000000 --- a/examples/selective_build/TARGETS +++ /dev/null @@ -1,8 +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(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() diff --git a/examples/portable/custom_ops/TARGETS b/examples/xnnpack/BUCK similarity index 59% rename from examples/portable/custom_ops/TARGETS rename to examples/xnnpack/BUCK index 2341af9282f..f488cf7ec94 100644 --- a/examples/portable/custom_ops/TARGETS +++ b/examples/xnnpack/BUCK @@ -1,3 +1,4 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target") # Any targets that should be shared between fbcode and xplat must be defined in # targets.bzl. This file can contain fbcode-only targets. @@ -5,4 +6,4 @@ load(":targets.bzl", "define_common_targets") oncall("executorch") -define_common_targets() +fbcode_target(_kind = define_common_targets,) diff --git a/examples/xnnpack/TARGETS b/examples/xnnpack/TARGETS deleted file mode 100644 index 2341af9282f..00000000000 --- a/examples/xnnpack/TARGETS +++ /dev/null @@ -1,8 +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(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() diff --git a/examples/xnnpack/executor_runner/BUCK b/examples/xnnpack/executor_runner/BUCK index 2341af9282f..19e6c63c305 100644 --- a/examples/xnnpack/executor_runner/BUCK +++ b/examples/xnnpack/executor_runner/BUCK @@ -1,8 +1,19 @@ +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 fbcode-only targets. + +load(":targets.bzl", "define_common_targets") + + +non_fbcode_target(_kind = define_common_targets,) + +# !!!! fbcode/executorch/examples/xnnpack/executor_runner/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + # Any targets that should be shared between fbcode and xplat must be defined in # targets.bzl. This file can contain fbcode-only targets. load(":targets.bzl", "define_common_targets") -oncall("executorch") -define_common_targets() +fbcode_target(_kind = define_common_targets,) diff --git a/examples/xnnpack/executor_runner/TARGETS b/examples/xnnpack/executor_runner/TARGETS deleted file mode 100644 index 2341af9282f..00000000000 --- a/examples/xnnpack/executor_runner/TARGETS +++ /dev/null @@ -1,8 +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(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() diff --git a/examples/xnnpack/quantization/BUCK b/examples/xnnpack/quantization/BUCK new file mode 100644 index 00000000000..e04a6ef93c0 --- /dev/null +++ b/examples/xnnpack/quantization/BUCK @@ -0,0 +1,31 @@ +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") + +fbcode_target(_kind = runtime.python_binary, + name = "example", + main_function = ".example.main", + main_src = "example.py", + preload_deps = ["//executorch/kernels/quantized:aot_lib"], + deps = [ + ":quant_utils", + "//caffe2:torch", + "//executorch/examples/xnnpack:models", + "//executorch/extension/export_util:export_util", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "quant_utils", + srcs = [ + "utils.py", + ], + visibility = [ + "//executorch/examples/...", + ], + deps = [ + "//caffe2:torch", + "//executorch/backends/xnnpack/quantizer:xnnpack_quantizer", + ], +) diff --git a/exir/BUCK b/exir/BUCK index 51846daef65..f00b3f1c787 100644 --- a/exir/BUCK +++ b/exir/BUCK @@ -1,4 +1,305 @@ +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/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 = "tracer", + srcs = [ + "tracer.py", + ], + deps = [ + "fbsource//third-party/pypi/typing-extensions:typing-extensions", + ":common", + ":error", + ":graph_module", + ":types", + "//caffe2:torch", + "//executorch/exir/operator:convert", + "//executorch/exir/operator:util", + "//executorch/extension/pytree:pylib", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "graph", + srcs = [ + "graph.py", + ], + deps = [ + ":tensor", + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "graph_module", + srcs = [ + "graph_module.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "scalar_type", + srcs = [ + "scalar_type.py", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "schema", + srcs = [ + "schema.py", + ], + deps = [ + ":scalar_type", + "//executorch/exir/backend:compile_spec_schema", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "version", + srcs = [ + "version.py", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "tensor", + srcs = [ + "tensor.py", + ], + deps = [ + ":error", + ":schema", + "//caffe2:torch", + "//executorch/exir:sym_util", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "tensor_layout", + srcs = [ + "tensor_layout.py", + ], + deps = [ + ":scalar_type", + ":tensor", + ] +) + +fbcode_target(_kind = runtime.python_library, + name = "memory", + srcs = [ + "memory.py", + ], + deps = [ + "fbsource//third-party/pypi/typing-extensions:typing-extensions", + ":tensor", + "//caffe2:torch", + "//executorch/exir:sym_util", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "control_flow", + srcs = [ + "control_flow.py", + ], + deps = [ + ":error", + ":tracer", + ":wrap", + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "delegate", + srcs = [ + "delegate.py", + "delegate.pyi", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "lowered_backend_module", + srcs = [ + "lowered_backend_module.py", + ], + deps = [ + ":delegate", + ":graph_module", + ":schema", + ":tracer", + "//caffe2:torch", + "//executorch/exir/_serialize:lib", + "//executorch/exir/backend:compile_spec_schema", + "//executorch/exir/emit:lib", + "//executorch/exir/passes:memory_planning_pass", + "//executorch/exir/passes:spec_prop_pass", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "lib", + srcs = [ + "__init__.py", + ], + deps = [ + ":tracer", + "//caffe2:torch", + "//executorch/exir/capture:lib", + "//executorch/exir/emit:lib", + "//executorch/exir/program:lib", + "//executorch/exir/serde:serialize", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "memory_planning", + srcs = [ + "memory_planning.py", + ], + deps = [ + ":control_flow", + ":delegate", + ":error", + ":memory", + ":schema", + ":tensor", + "//caffe2:torch", + "//executorch/exir/operator:convert", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "common", + srcs = [ + "common.py", + ], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "error", + srcs = [ + "error.py", + ], + deps = [], +) + +fbcode_target(_kind = runtime.python_library, + name = "types", + srcs = [ + "types.py", + ], + deps = [ + "fbsource//third-party/pypi/typing-extensions:typing-extensions", + ":tensor", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "wrap", + srcs = [ + "wrap.py", + ], + deps = [ + ":tracer", + "//caffe2:torch", + "//caffe2/functorch:functorch", # @manual + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "print_program", + srcs = [ + "print_program.py", + ], + deps = [ + ":error", + ":schema", + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "dynamic_shape", + srcs = [ + "dynamic_shape.py", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "pass_base", + srcs = [ + "pass_base.py", + ], + deps = [ + ":delegate", + ":error", + ":memory", + "//caffe2:torch", + "//executorch/exir/dialects/edge:lib", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "pass_manager", + srcs = [ + "pass_manager.py", + ], + deps = [ + "fbsource//third-party/pypi/typing-extensions:typing-extensions", + ":error", + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "sym_util", + srcs = ["sym_util.py"], + deps = [ + "fbsource//third-party/pypi/sympy:sympy", + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "dim_order_utils", + srcs = ["dim_order_utils.py"], + deps = [ + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "_warnings", + srcs = ["_warnings.py"], + deps = [ + "fbsource//third-party/pypi/typing-extensions:typing-extensions", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "debug_handle_utils", + srcs = ["debug_handle_utils.py"], + deps = [ + "//caffe2:torch", + ], +) diff --git a/exir/TARGETS b/exir/TARGETS deleted file mode 100644 index 58cfa3735de..00000000000 --- a/exir/TARGETS +++ /dev/null @@ -1,298 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -runtime.python_library( - name = "tracer", - srcs = [ - "tracer.py", - ], - deps = [ - "fbsource//third-party/pypi/typing-extensions:typing-extensions", - ":common", - ":error", - ":graph_module", - ":types", - "//caffe2:torch", - "//executorch/exir/operator:convert", - "//executorch/exir/operator:util", - "//executorch/extension/pytree:pylib", - ], -) - -runtime.python_library( - name = "graph", - srcs = [ - "graph.py", - ], - deps = [ - ":tensor", - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "graph_module", - srcs = [ - "graph_module.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "scalar_type", - srcs = [ - "scalar_type.py", - ], -) - -runtime.python_library( - name = "schema", - srcs = [ - "schema.py", - ], - deps = [ - ":scalar_type", - "//executorch/exir/backend:compile_spec_schema", - ], -) - -runtime.python_library( - name = "version", - srcs = [ - "version.py", - ], -) - -runtime.python_library( - name = "tensor", - srcs = [ - "tensor.py", - ], - deps = [ - ":error", - ":schema", - "//caffe2:torch", - "//executorch/exir:sym_util", - ], -) - -runtime.python_library( - name = "tensor_layout", - srcs = [ - "tensor_layout.py", - ], - deps = [ - ":scalar_type", - ":tensor", - ] -) - -runtime.python_library( - name = "memory", - srcs = [ - "memory.py", - ], - deps = [ - "fbsource//third-party/pypi/typing-extensions:typing-extensions", - ":tensor", - "//caffe2:torch", - "//executorch/exir:sym_util", - ], -) - -runtime.python_library( - name = "control_flow", - srcs = [ - "control_flow.py", - ], - deps = [ - ":error", - ":tracer", - ":wrap", - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "delegate", - srcs = [ - "delegate.py", - "delegate.pyi", - ], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "lowered_backend_module", - srcs = [ - "lowered_backend_module.py", - ], - deps = [ - ":delegate", - ":graph_module", - ":schema", - ":tracer", - "//caffe2:torch", - "//executorch/exir/_serialize:lib", - "//executorch/exir/backend:compile_spec_schema", - "//executorch/exir/emit:lib", - "//executorch/exir/passes:memory_planning_pass", - "//executorch/exir/passes:spec_prop_pass", - ], -) - -runtime.python_library( - name = "lib", - srcs = [ - "__init__.py", - ], - deps = [ - ":tracer", - "//caffe2:torch", - "//executorch/exir/capture:lib", - "//executorch/exir/emit:lib", - "//executorch/exir/program:lib", - "//executorch/exir/serde:serialize", - ], -) - -runtime.python_library( - name = "memory_planning", - srcs = [ - "memory_planning.py", - ], - deps = [ - ":control_flow", - ":delegate", - ":error", - ":memory", - ":schema", - ":tensor", - "//caffe2:torch", - "//executorch/exir/operator:convert", - ], -) - -runtime.python_library( - name = "common", - srcs = [ - "common.py", - ], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "error", - srcs = [ - "error.py", - ], - deps = [], -) - -runtime.python_library( - name = "types", - srcs = [ - "types.py", - ], - deps = [ - "fbsource//third-party/pypi/typing-extensions:typing-extensions", - ":tensor", - ], -) - -runtime.python_library( - name = "wrap", - srcs = [ - "wrap.py", - ], - deps = [ - ":tracer", - "//caffe2:torch", - "//caffe2/functorch:functorch", # @manual - ], -) - -runtime.python_library( - name = "print_program", - srcs = [ - "print_program.py", - ], - deps = [ - ":error", - ":schema", - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "dynamic_shape", - srcs = [ - "dynamic_shape.py", - ], -) - -runtime.python_library( - name = "pass_base", - srcs = [ - "pass_base.py", - ], - deps = [ - ":delegate", - ":error", - ":memory", - "//caffe2:torch", - "//executorch/exir/dialects/edge:lib", - ], -) - -runtime.python_library( - name = "pass_manager", - srcs = [ - "pass_manager.py", - ], - deps = [ - "fbsource//third-party/pypi/typing-extensions:typing-extensions", - ":error", - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "sym_util", - srcs = ["sym_util.py"], - deps = [ - "fbsource//third-party/pypi/sympy:sympy", - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "dim_order_utils", - srcs = ["dim_order_utils.py"], - deps = [ - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "_warnings", - srcs = ["_warnings.py"], - deps = [ - "fbsource//third-party/pypi/typing-extensions:typing-extensions", - ], -) - -runtime.python_library( - name = "debug_handle_utils", - srcs = ["debug_handle_utils.py"], - deps = [ - "//caffe2:torch", - ], -) diff --git a/exir/_serialize/TARGETS b/exir/_serialize/BUCK similarity index 89% rename from exir/_serialize/TARGETS rename to exir/_serialize/BUCK index 7208befb51e..be09c1756b3 100644 --- a/exir/_serialize/TARGETS +++ b/exir/_serialize/BUCK @@ -1,10 +1,11 @@ +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") # TODO(T157145817): Update other flatbuffer serializers to use flatc like # _flatbuffer.py does, and remove this. -runtime.cxx_python_extension( +fbcode_target(_kind = runtime.cxx_python_extension, name = "_bindings", srcs = [ "bindings.cpp", @@ -23,7 +24,7 @@ runtime.cxx_python_extension( # Use runtime.python_library instead of the one defined in python_library.bzl, # so we can have access to EXECUTORCH_CLIENTS list. -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "lib", srcs = [ "__init__.py", diff --git a/exir/_serialize/test/TARGETS b/exir/_serialize/test/BUCK similarity index 78% rename from exir/_serialize/test/TARGETS rename to exir/_serialize/test/BUCK index 483d8bb31d0..c70a3629cd1 100644 --- a/exir/_serialize/test/TARGETS +++ b/exir/_serialize/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_program", srcs = [ "test_program.py", @@ -14,7 +15,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_flatbuffer", srcs = [ "test_flatbuffer.py", @@ -24,7 +25,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_cord", srcs = [ "test_cord.py", @@ -34,7 +35,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_named_data_store", srcs = [ "test_named_data_store.py", @@ -44,7 +45,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_serialize", srcs = [ "test_serialize.py", diff --git a/exir/backend/BUCK b/exir/backend/BUCK index 1e8cc179228..bb54371ef63 100644 --- a/exir/backend/BUCK +++ b/exir/backend/BUCK @@ -1,8 +1,108 @@ +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/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!! + +# Any targets that should be shared between fbcode and xplat must be defined in +# targets.bzl. This file can contain fbcode-only targets. + +load("@fbsource//xplat/executorch/backends:backends.bzl", "get_all_cpu_aot_and_backend_targets") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") +load(":targets.bzl", "define_common_targets") + + +fbcode_target(_kind = define_common_targets,) + +# Use runtime.python_library instead of the one defined in python_library.bzl, +# so we can have access to EXECUTORCH_CLIENTS list. +fbcode_target(_kind = runtime.python_library, + name = "backend_api", + srcs = [ + "backend_api.py", + ], + visibility = ["PUBLIC"], + deps = [ + ":backend_details", + ":compile_spec_schema", + "//caffe2:torch", + "//executorch/exir/backend:utils", + "//executorch/exir/backend/canonical_partitioners:duplicate_constant_node_pass", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "compile_spec_schema", + srcs = [ + "compile_spec_schema.py", + ], + visibility = ["PUBLIC"], +) + +fbcode_target(_kind = runtime.python_library, + name = "operator_support", + srcs = [ + "operator_support.py", + ], + visibility = ["PUBLIC"], +) + +fbcode_target(_kind = runtime.python_library, + name = "partitioner", + srcs = [ + "partitioner.py", + ], + visibility = ["PUBLIC"], + deps = [ + ":compile_spec_schema", + "//caffe2:torch", + ], +) + +fbcode_target(_kind = runtime.python_library, + name = "backend_details", + srcs = [ + "backend_details.py", + ], + visibility = ["PUBLIC"], + deps = [ + ":compile_spec_schema", + ":partitioner", + "//caffe2:torch", + "//executorch/exir:delegate", + "//executorch/exir:graph_module", + ], +) + +# backend_lib includes all ahead of time apis and supported backends, +# it's supposed to be only used on server side and not for production on device. +fbcode_target(_kind = runtime.python_library, + name = "backend_lib", + visibility = ["PUBLIC"], + deps = [ + ":backend_api", + ":backend_details", + ":utils", + "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", + ] + get_all_cpu_aot_and_backend_targets(), +) + +fbcode_target(_kind = runtime.python_library, + name = "utils", + srcs = [ + "utils.py", + ], + visibility = ["PUBLIC"], + deps = [ + "fbsource//third-party/pypi/pandas:pandas", + "//caffe2:torch", + "//executorch/exir:lowered_backend_module", + "//executorch/exir/backend/canonical_partitioners:duplicate_constant_node_pass", + ], +) diff --git a/exir/backend/TARGETS b/exir/backend/TARGETS deleted file mode 100644 index fa33fa96428..00000000000 --- a/exir/backend/TARGETS +++ /dev/null @@ -1,97 +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/backends:backends.bzl", "get_all_cpu_aot_and_backend_targets") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -# Use runtime.python_library instead of the one defined in python_library.bzl, -# so we can have access to EXECUTORCH_CLIENTS list. -runtime.python_library( - name = "backend_api", - srcs = [ - "backend_api.py", - ], - visibility = ["PUBLIC"], - deps = [ - ":backend_details", - ":compile_spec_schema", - "//caffe2:torch", - "//executorch/exir/backend:utils", - "//executorch/exir/backend/canonical_partitioners:duplicate_constant_node_pass", - ], -) - -runtime.python_library( - name = "compile_spec_schema", - srcs = [ - "compile_spec_schema.py", - ], - visibility = ["PUBLIC"], -) - -runtime.python_library( - name = "operator_support", - srcs = [ - "operator_support.py", - ], - visibility = ["PUBLIC"], -) - -runtime.python_library( - name = "partitioner", - srcs = [ - "partitioner.py", - ], - visibility = ["PUBLIC"], - deps = [ - ":compile_spec_schema", - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "backend_details", - srcs = [ - "backend_details.py", - ], - visibility = ["PUBLIC"], - deps = [ - ":compile_spec_schema", - ":partitioner", - "//caffe2:torch", - "//executorch/exir:delegate", - "//executorch/exir:graph_module", - ], -) - -# backend_lib includes all ahead of time apis and supported backends, -# it's supposed to be only used on server side and not for production on device. -runtime.python_library( - name = "backend_lib", - visibility = ["PUBLIC"], - deps = [ - ":backend_api", - ":backend_details", - ":utils", - "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", - ] + get_all_cpu_aot_and_backend_targets(), -) - -runtime.python_library( - name = "utils", - srcs = [ - "utils.py", - ], - visibility = ["PUBLIC"], - deps = [ - "fbsource//third-party/pypi/pandas:pandas", - "//caffe2:torch", - "//executorch/exir:lowered_backend_module", - "//executorch/exir/backend/canonical_partitioners:duplicate_constant_node_pass", - ], -) diff --git a/exir/backend/canonical_partitioners/TARGETS b/exir/backend/canonical_partitioners/BUCK similarity index 79% rename from exir/backend/canonical_partitioners/TARGETS rename to exir/backend/canonical_partitioners/BUCK index 27b850dc9e1..17b1fc21ef2 100644 --- a/exir/backend/canonical_partitioners/TARGETS +++ b/exir/backend/canonical_partitioners/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 = "canonical_partitioner_lib", srcs = [ "duplicate_dequant_node_pass.py", @@ -17,7 +18,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "duplicate_constant_node_pass", srcs = [ "duplicate_constant_node_pass.py", @@ -29,7 +30,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "config_partitioner_lib", srcs = [ "config_partitioner.py", @@ -41,7 +42,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "group_partitioner_lib", srcs = [ "group_partitioner.py", diff --git a/exir/backend/test/TARGETS b/exir/backend/test/BUCK similarity index 93% rename from exir/backend/test/TARGETS rename to exir/backend/test/BUCK index cf44a3021d4..1212880068a 100644 --- a/exir/backend/test/TARGETS +++ b/exir/backend/test/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 = "backend_with_compiler_demo", srcs = [ "backend_with_compiler_demo.py", @@ -20,7 +21,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "backend_with_delegate_mapping_demo", srcs = [ "backend_with_delegate_mapping_demo.py", @@ -38,7 +39,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "backend_with_named_data_map", srcs = [ "backend_with_named_data_map.py", @@ -66,7 +67,7 @@ runtime.python_library( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_backend_with_named_data_map", srcs = [ "test_backend_with_named_data_map.py", @@ -94,7 +95,7 @@ python_unittest( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "demo_backend", srcs = [ "demo_backend.py", @@ -109,7 +110,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "hta_partitioner_demo", srcs = [ "hta_partitioner_demo.py", @@ -128,7 +129,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "op_partitioner_demo", srcs = [ "op_partitioner_demo.py", @@ -149,7 +150,7 @@ runtime.python_library( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "example_backends", deps = [ ":backend_with_compiler_demo", @@ -157,7 +158,7 @@ runtime.python_library( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_backends", srcs = [ "test_backends.py", @@ -189,7 +190,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_to_backend_multi_method", srcs = [ "test_to_backend_multi_method.py", @@ -219,7 +220,7 @@ python_unittest( ], ) -runtime.python_library( +fbcode_target(_kind = runtime.python_library, name = "backend_with_preprocess_all_demo", srcs = [ "backend_with_preprocess_all_demo.py" @@ -242,7 +243,7 @@ runtime.python_library( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_debug_handle_map", srcs = [ "test_debug_handle_map.py", @@ -259,7 +260,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_backends_lifted", srcs = [ "test_backends_lifted.py", @@ -291,7 +292,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_lowered_backend_module", srcs = [ "test_lowered_backend_module.py", @@ -316,7 +317,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_graph_partition", srcs = [ "test_graph_partition.py", @@ -333,7 +334,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_backends_nested", srcs = [ "test_backends_nested.py", @@ -359,7 +360,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_delegate_map_builder", srcs = [ "test_delegate_map_builder.py", @@ -373,7 +374,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_utils", srcs = [ "test_utils.py", @@ -391,7 +392,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_partitioner", srcs = [ "test_partitioner.py", @@ -417,7 +418,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_passes", srcs = [ "test_passes.py", @@ -429,7 +430,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_compatibility", srcs = [ "test_compatibility.py", @@ -448,7 +449,7 @@ python_unittest( ], ) -python_unittest( +fbcode_target(_kind = python_unittest, name = "test_group_partitioner", srcs = [ "test_group_partitioner.py",