diff --git a/backends/apple/mps/BUCK b/backends/apple/mps/BUCK index 00fc5dd178c..bf7e029fe68 100644 --- a/backends/apple/mps/BUCK +++ b/backends/apple/mps/BUCK @@ -3,15 +3,105 @@ # Provided subject to the LICENSE file in the top level directory. # -# Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain xplat-only targets. - +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") load("@fbsource//tools/build_defs:default_platform_defs.bzl", "APPLE") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":targets.bzl", "define_common_targets") +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_xplat") oncall("executorch") define_common_targets( - is_xplat = True, + is_xplat = is_xplat(), platforms = [APPLE], ) + +fbcode_target( + _kind = runtime.python_library, + name = "backend", + srcs = [ + "__init__.py", + "mps_preprocess.py", + ], + visibility = ["PUBLIC"], + deps = [ + ":operators", + ":serialization", + ":utils", + "//caffe2:torch", + "//executorch/exir/backend:backend_details", + "//executorch/exir/backend:compile_spec_schema", + ], +) + +fbcode_target( + _kind = runtime.python_library, + name = "operators", + srcs = glob([ + "operators/*.py", + ]), + deps = [ + ":serialization", + ":utils", + "//executorch/backends/transforms:lib", + ], +) + +fbcode_target( + _kind = runtime.python_library, + name = "partitioner", + srcs = glob([ + "partition/*.py", + ]), + visibility = ["PUBLIC"], + deps = [ + ":backend", + "//caffe2:torch", + "//executorch/exir/backend:compile_spec_schema", + "//executorch/exir/backend:partitioner", + "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", + ], +) + +fbcode_target( + _kind = runtime.python_library, + name = "serialization", + srcs = glob([ + "serialization/*.py", + ]), + resources = [ + "serialization/schema.fbs", + ], +) + +fbcode_target( + _kind = runtime.python_library, + name = "utils", + srcs = glob([ + "utils/*.py", + ]), + deps = [ + ":serialization", + "//caffe2:torch", + "//executorch/exir:lib", + ], +) + +fbcode_target( + _kind = runtime.python_test, + name = "test", + srcs = glob([ + "test/*.py", + ]), + deps = [ + ":backend", + ":partitioner", + "//caffe2:torch", + "//executorch/examples/models:models", + "//executorch/exir/tests:models", + "//executorch/extension/export_util:export_util", + "//executorch/devtools:lib", + "//executorch/devtools/bundled_program/serialize:lib", + "fbsource//third-party/pypi/pytest:pytest", + ], +) diff --git a/backends/apple/mps/TARGETS b/backends/apple/mps/TARGETS deleted file mode 100644 index d138b02e991..00000000000 --- a/backends/apple/mps/TARGETS +++ /dev/null @@ -1,98 +0,0 @@ -# -# Copyright (c) 2023 Apple Inc. All rights reserved. -# Provided subject to the LICENSE file in the top level directory. -# - -# Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain fbcode-only targets. - -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.python_library( - name = "backend", - srcs = [ - "__init__.py", - "mps_preprocess.py", - ], - visibility = ["PUBLIC"], - deps = [ - ":operators", - ":serialization", - ":utils", - "//caffe2:torch", - "//executorch/exir/backend:backend_details", - "//executorch/exir/backend:compile_spec_schema", - ], -) - -runtime.python_library( - name = "operators", - srcs = glob([ - "operators/*.py", - ]), - deps = [ - ":serialization", - ":utils", - "//executorch/backends/transforms:lib", - ], -) - -runtime.python_library( - name = "partitioner", - srcs = glob([ - "partition/*.py", - ]), - visibility = ["PUBLIC"], - deps = [ - ":backend", - "//caffe2:torch", - "//executorch/exir/backend:compile_spec_schema", - "//executorch/exir/backend:partitioner", - "//executorch/exir/backend/canonical_partitioners:canonical_partitioner_lib", - ], -) - -runtime.python_library( - name = "serialization", - srcs = glob([ - "serialization/*.py", - ]), - resources = [ - "serialization/schema.fbs", - ], -) - -runtime.python_library( - name = "utils", - srcs = glob([ - "utils/*.py", - ]), - deps = [ - ":serialization", - "//caffe2:torch", - "//executorch/exir:lib", - ], -) - -runtime.python_test( - name = "test", - srcs = glob([ - "test/*.py", - ]), - deps = [ - ":backend", - ":partitioner", - "//caffe2:torch", - "//executorch/examples/models:models", - "//executorch/exir/tests:models", - "//executorch/extension/export_util:export_util", - "//executorch/devtools:lib", - "//executorch/devtools/bundled_program/serialize:lib", - "fbsource//third-party/pypi/pytest:pytest", - ], -) diff --git a/backends/xnnpack/serialization/BUCK b/backends/xnnpack/serialization/BUCK index c0b4f27eb52..dd7f2f3dde7 100644 --- a/backends/xnnpack/serialization/BUCK +++ b/backends/xnnpack/serialization/BUCK @@ -1,3 +1,32 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":targets.bzl", "define_common_targets") +oncall("executorch") + define_common_targets() + +fbcode_target( + _kind = runtime.python_library, + name = "xnnpack_schema", + srcs = [ + "xnnpack_graph_schema.py", + ], + visibility = ["PUBLIC"], +) + +fbcode_target( + _kind = runtime.python_library, + name = "xnnpack_serializer", + srcs = [ + "xnnpack_graph_serialize.py", + ], + resources = [ + "schema.fbs", + ], + visibility = ["PUBLIC"], + deps = [ + ":xnnpack_schema", + "//executorch/exir/_serialize:lib", + ], +) diff --git a/backends/xnnpack/serialization/TARGETS b/backends/xnnpack/serialization/TARGETS deleted file mode 100644 index a644520ac64..00000000000 --- a/backends/xnnpack/serialization/TARGETS +++ /dev/null @@ -1,29 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.python_library( - name = "xnnpack_schema", - srcs = [ - "xnnpack_graph_schema.py", - ], - visibility = ["PUBLIC"], -) - -runtime.python_library( - name = "xnnpack_serializer", - srcs = [ - "xnnpack_graph_serialize.py", - ], - resources = [ - "schema.fbs", - ], - visibility = ["PUBLIC"], - deps = [ - ":xnnpack_schema", - "//executorch/exir/_serialize:lib", - ], -) diff --git a/devtools/bundled_program/BUCK b/devtools/bundled_program/BUCK index 0a42614a385..06951d344fb 100644 --- a/devtools/bundled_program/BUCK +++ b/devtools/bundled_program/BUCK @@ -1,5 +1,48 @@ +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":targets.bzl", "define_common_targets") oncall("executorch") define_common_targets() + +fbcode_target( + _kind = runtime.python_library, + name = "core", + srcs = [ + "core.py", + ], + visibility = ["PUBLIC"], + deps = [ + ":config", + ":version", + "//caffe2:torch", + "//executorch/devtools/bundled_program/schema:bundled_program_schema_py", + "//executorch/exir:schema", + "//executorch/exir:tensor", + ], +) + +fbcode_target( + _kind = runtime.python_library, + name = "config", + srcs = [ + "config.py", + ], + visibility = ["PUBLIC"], + deps = [ + "fbsource//third-party/pypi/typing-extensions:typing-extensions", + "//caffe2:torch", + ], +) + +fbcode_target( + _kind = runtime.python_library, + name = "version", + srcs = [ + "version.py", + ], + visibility = [ + "//executorch/devtools/...", + ], +) diff --git a/devtools/bundled_program/TARGETS b/devtools/bundled_program/TARGETS deleted file mode 100644 index 10d4d0b9154..00000000000 --- a/devtools/bundled_program/TARGETS +++ /dev/null @@ -1,44 +0,0 @@ -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.python_library( - name = "core", - srcs = [ - "core.py", - ], - visibility = ["PUBLIC"], - deps = [ - ":config", - ":version", - "//caffe2:torch", - "//executorch/devtools/bundled_program/schema:bundled_program_schema_py", - "//executorch/exir:schema", - "//executorch/exir:tensor", - ], -) - -runtime.python_library( - name = "config", - srcs = [ - "config.py", - ], - visibility = ["PUBLIC"], - deps = [ - "fbsource//third-party/pypi/typing-extensions:typing-extensions", - "//caffe2:torch", - ], -) - -runtime.python_library( - name = "version", - srcs = [ - "version.py", - ], - visibility = [ - "//executorch/devtools/...", - ], -) diff --git a/devtools/bundled_program/schema/BUCK b/devtools/bundled_program/schema/BUCK index 1e8cc179228..c943db0765a 100644 --- a/devtools/bundled_program/schema/BUCK +++ b/devtools/bundled_program/schema/BUCK @@ -1,8 +1,26 @@ # Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain xplat-only targets. +# targets.bzl. This file can contain fbcode-only targets. +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":targets.bzl", "define_common_targets") oncall("executorch") define_common_targets() + +fbcode_target( + _kind = runtime.python_library, + name = "bundled_program_schema_py", + srcs = [ + "__init__.py", + "bundled_program_schema.py", + ], + visibility = [ + "//executorch/devtools/bundled_program/...", + "//executorch/devtools/etrecord/...", + ], + deps = [ + "//executorch/exir:scalar_type", + ], +) diff --git a/devtools/bundled_program/schema/TARGETS b/devtools/bundled_program/schema/TARGETS deleted file mode 100644 index 51c004cbec0..00000000000 --- a/devtools/bundled_program/schema/TARGETS +++ /dev/null @@ -1,24 +0,0 @@ -# Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain fbcode-only targets. - -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.python_library( - name = "bundled_program_schema_py", - srcs = [ - "__init__.py", - "bundled_program_schema.py", - ], - visibility = [ - "//executorch/devtools/bundled_program/...", - "//executorch/devtools/etrecord/...", - ], - deps = [ - "//executorch/exir:scalar_type", - ], -) diff --git a/exir/emit/BUCK b/exir/emit/BUCK index 51846daef65..433b583dc1c 100644 --- a/exir/emit/BUCK +++ b/exir/emit/BUCK @@ -1,4 +1,41 @@ -# 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:." +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") oncall("executorch") + +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/extension/pytree/BUCK b/extension/pytree/BUCK index 1e8cc179228..913a2c43fe1 100644 --- a/extension/pytree/BUCK +++ b/extension/pytree/BUCK @@ -1,8 +1,53 @@ # Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain xplat-only targets. +# targets.bzl. This file can contain fbcode-only targets. +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":targets.bzl", "define_common_targets") oncall("executorch") define_common_targets() + +fbcode_target( + _kind = runtime.cxx_python_extension, + name = "pybindings", + srcs = [ + "pybindings.cpp", + ], + base_module = "executorch.extension.pytree", + deps = [ + ":pytree", + ], + external_deps = [ + "pybind11", + ], +) + +fbcode_target( + _kind = runtime.cxx_python_extension, + name = "pybindings_debug", + srcs = [ + "pybindings.cpp", + ], + base_module = "executorch.extension.pytree", + deps = [ + ":pytree", + ], + external_deps = [ + "pybind11", + ], +) + +fbcode_target( + _kind = runtime.python_library, + name = "pylib", + srcs = [ + "__init__.py", + ], + base_module = "executorch.extension.pytree", + deps = [ + ":pybindings", + "//caffe2:torch", + ], +) diff --git a/extension/pytree/TARGETS b/extension/pytree/TARGETS deleted file mode 100644 index 79c4d2b8b3f..00000000000 --- a/extension/pytree/TARGETS +++ /dev/null @@ -1,49 +0,0 @@ -# Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain fbcode-only targets. - -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.cxx_python_extension( - name = "pybindings", - srcs = [ - "pybindings.cpp", - ], - base_module = "executorch.extension.pytree", - deps = [ - ":pytree", - ], - external_deps = [ - "pybind11", - ], -) - -runtime.cxx_python_extension( - name = "pybindings_debug", - srcs = [ - "pybindings.cpp", - ], - base_module = "executorch.extension.pytree", - deps = [ - ":pytree", - ], - external_deps = [ - "pybind11", - ], -) - -runtime.python_library( - name = "pylib", - srcs = [ - "__init__.py", - ], - base_module = "executorch.extension.pytree", - deps = [ - ":pybindings", - "//caffe2:torch", - ], -) diff --git a/extension/training/BUCK b/extension/training/BUCK index 1e8cc179228..6c4cc1eabf3 100644 --- a/extension/training/BUCK +++ b/extension/training/BUCK @@ -1,8 +1,22 @@ # Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain xplat-only targets. +# targets.bzl. This file can contain fbcode-only targets. +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":targets.bzl", "define_common_targets") oncall("executorch") define_common_targets() + +fbcode_target( + _kind = runtime.python_library, + name = "lib", + srcs = [ + "__init__.py", + ], + deps = [ + "//executorch/extension/training/pybindings:_training_lib", + "//executorch/extension/training/pybindings:_training_module", + ], +) diff --git a/extension/training/TARGETS b/extension/training/TARGETS deleted file mode 100644 index eeed302c339..00000000000 --- a/extension/training/TARGETS +++ /dev/null @@ -1,20 +0,0 @@ -# Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain fbcode-only targets. - -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") -load(":targets.bzl", "define_common_targets") - -oncall("executorch") - -define_common_targets() - -runtime.python_library( - name = "lib", - srcs = [ - "__init__.py", - ], - deps = [ - "//executorch/extension/training/pybindings:_training_lib", - "//executorch/extension/training/pybindings:_training_module", - ], -) diff --git a/kernels/portable/test/BUCK b/kernels/portable/test/BUCK index 1e8cc179228..7d42f44e1c4 100644 --- a/kernels/portable/test/BUCK +++ b/kernels/portable/test/BUCK @@ -1,8 +1,30 @@ # Any targets that should be shared between fbcode and xplat must be defined in -# targets.bzl. This file can contain xplat-only targets. +# targets.bzl. This file can contain fbcode-only targets. +load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target") +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load(":targets.bzl", "define_common_targets") oncall("executorch") define_common_targets() + +fbcode_target( + _kind = runtime.cxx_library, + name = "aot_ops_test_lib", + srcs = [ + "register_ops_aot_for_test.cpp", + ], + visibility = ["PUBLIC"], + deps = [ + "//executorch/extension/aten_util:aten_bridge", + "//executorch/kernels/portable/cpu:op_grid_sampler_2d", + "//executorch/kernels/portable/cpu:op_upsample_bilinear2d", + "//executorch/kernels/portable/cpu:op_upsample_bilinear2d_aa", + "//executorch/kernels/portable/cpu:op_upsample_nearest2d", + "//executorch/runtime/core/exec_aten:lib", + ], + external_deps = [ + "libtorch", + ], +) diff --git a/kernels/portable/test/TARGETS b/kernels/portable/test/TARGETS deleted file mode 100644 index 44c5697729e..00000000000 --- a/kernels/portable/test/TARGETS +++ /dev/null @@ -1,28 +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") -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") - -oncall("executorch") - -define_common_targets() - -runtime.cxx_library( - name = "aot_ops_test_lib", - srcs = [ - "register_ops_aot_for_test.cpp", - ], - visibility = ["PUBLIC"], - deps = [ - "//executorch/extension/aten_util:aten_bridge", - "//executorch/kernels/portable/cpu:op_grid_sampler_2d", - "//executorch/kernels/portable/cpu:op_upsample_bilinear2d", - "//executorch/kernels/portable/cpu:op_upsample_bilinear2d_aa", - "//executorch/kernels/portable/cpu:op_upsample_nearest2d", - "//executorch/runtime/core/exec_aten:lib", - ], - external_deps = [ - "libtorch", - ], -)