From 66cfcfef720fc686384ade768dd7b3d0b9a6b254 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 10 Sep 2025 09:06:14 -0700 Subject: [PATCH 1/6] Update [ghstack-poisoned] --- codegen/tools/targets.bzl | 4 ++-- shim_et/xplat/executorch/build/runtime_wrapper.bzl | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/codegen/tools/targets.bzl b/codegen/tools/targets.bzl index 39de8fcb482..0d815432ec7 100644 --- a/codegen/tools/targets.bzl +++ b/codegen/tools/targets.bzl @@ -17,9 +17,9 @@ def define_common_targets(is_fbcode = False): ], deps = [ "//executorch/codegen:gen_lib", - ] + select({ + ] + [] if runtime.is_oss else select({ "DEFAULT": [], - "ovr_config//os:linux": [] if runtime.is_oss else ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet + "ovr_config//os:linux": ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet }), ) diff --git a/shim_et/xplat/executorch/build/runtime_wrapper.bzl b/shim_et/xplat/executorch/build/runtime_wrapper.bzl index d6d8d89eddc..0221100ea06 100644 --- a/shim_et/xplat/executorch/build/runtime_wrapper.bzl +++ b/shim_et/xplat/executorch/build/runtime_wrapper.bzl @@ -290,6 +290,7 @@ def _cxx_test(*args, **kwargs): def _cxx_python_extension(*args, **kwargs): _patch_kwargs_common(kwargs) + _remove_caffe2_deps(kwargs) kwargs["srcs"] = _patch_executorch_references(kwargs["srcs"]) if "types" in kwargs: kwargs["types"] = _patch_executorch_references(kwargs["types"]) @@ -324,8 +325,17 @@ def _genrule(*args, **kwargs): kwargs["name"] += "_static" env.genrule(*args, **kwargs) +def _remove_caffe2_deps(kwargs): + # We don't have Buckified PyTorch in OSS. At least let buck query work. + MISSING_BUCK_DIRS = ("//caffe2", "//pytorch", "fbsource//third-party") + for dep_type in ('deps', 'exported_deps'): + if dep_type not in kwargs: + continue + kwargs[dep_type] = [x for x in kwargs[dep_type] if not any([x.startswith(y) for y in MISSING_BUCK_DIRS])] + def _python_library(*args, **kwargs): _patch_kwargs_common(kwargs) + _remove_caffe2_deps(kwargs) env.python_library(*args, **kwargs) def _python_binary(*args, **kwargs): From 165d880c9a8cbef1c299443509c6a7192d5bbd02 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 10 Sep 2025 09:06:19 -0700 Subject: [PATCH 2/6] Update [ghstack-poisoned] --- backends/arm/TARGETS | 26 ++++++-------------------- backends/arm/tosa/TARGETS | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/backends/arm/TARGETS b/backends/arm/TARGETS index 35b16f819e5..ec1a5241bc8 100644 --- a/backends/arm/TARGETS +++ b/backends/arm/TARGETS @@ -14,7 +14,8 @@ runtime.python_library( "ethosu/partitioner.py" ], deps = [ - ":arm_partitioner", + ":arm_vela", + "//executorch/backends/arm/tosa:arm_partitioner", ] ) runtime.python_library( @@ -25,7 +26,7 @@ runtime.python_library( "vgf/partitioner.py" ], deps = [ - ":arm_partitioner", + "//executorch/backends/arm/tosa:arm_partitioner", ] ) runtime.python_library( @@ -50,25 +51,11 @@ runtime.python_library( "//executorch/exir:lib", ], ) + runtime.python_library( - name = "arm_partitioner", - srcs = [ - "tosa/backend.py", - "tosa/partitioner.py", - ], - deps = [ - ":arm_backend", - ":constants", - "//executorch/backends/arm/debug:schema", - "//executorch/backends/arm/operator_support:operator_support", - "//executorch/backends/arm/_passes:passes", - "//executorch/exir:lib", - ], -) -runtime.python_library( - name = "arm_backend", + name = "arm_compile_spec", srcs = [ - "arm_backend.py", + "common/arm_compile_spec.py", ], deps = [ "fbsource//third-party/pypi/flatbuffers:flatbuffers", @@ -77,7 +64,6 @@ runtime.python_library( "fbsource//third-party/tosa_tools/v1.00/serialization_lib/python/serializer:serializer", "fbsource//third-party/tosa_tools/v0.80/serialization_lib/python/tosa:tosa", "fbsource//third-party/tosa_tools/v1.00/serialization_lib/python/tosa:tosa", - ":arm_vela", ":process_node", "//executorch/backends/arm/operators:lib", "//executorch/backends/arm/operators:node_visitor", diff --git a/backends/arm/tosa/TARGETS b/backends/arm/tosa/TARGETS index b1df4f37c53..fec53f2a7fb 100644 --- a/backends/arm/tosa/TARGETS +++ b/backends/arm/tosa/TARGETS @@ -59,3 +59,20 @@ runtime.python_library( ":specification", ], ) + +runtime.python_library( + name = "arm_partitioner", + srcs = [ + "backend.py", + "partitioner.py", + ], + deps = [ + "//executorch/backends/arm:arm_compile_spec", + "//executorch/backends/arm:constants", + "//executorch/backends/arm:process_node", + "//executorch/backends/arm/debug:schema", + "//executorch/backends/arm/operator_support:operator_support", + "//executorch/backends/arm/_passes:passes", + "//executorch/exir:lib", + ], +) From ee18ec365782916d04b3053b7e219768b9e0ed1b Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 10 Sep 2025 09:06:24 -0700 Subject: [PATCH 3/6] Update [ghstack-poisoned] --- .ci/scripts/unittest-buck2.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.ci/scripts/unittest-buck2.sh b/.ci/scripts/unittest-buck2.sh index f748be62ac1..340f7438f02 100755 --- a/.ci/scripts/unittest-buck2.sh +++ b/.ci/scripts/unittest-buck2.sh @@ -9,7 +9,11 @@ set -eux # TODO: expand this to //... # TODO: can't query cadence & vulkan backends # TODO: can't query //kernels/prim_ops because of non-buckified stuff in OSS. -buck2 query "//backends/apple/... + //backends/example/... + \ +# TODO: Make //backends/arm tests use runtime wrapper so we can just query //backends/arm/... +buck2 query "//backends/apple/... + //backends/arm: + //backends/arm/debug/... + \ +//backends/arm/operator_support/... + //backends/arm/operators/... + \ +//backends/arm/_passes/... + //backends/arm/runtime/... + //backends/arm/tosa/... \ ++ //backends/example/... + \ //backends/mediatek/... + //backends/transforms/... + \ //backends/xnnpack/... + //configurations/... + //extension/flat_tensor: + \ //extension/llm/runner: + //kernels/aten/... + //kernels/optimized/... + \ From 702f0d930fe97e394f742f7f0766727b259aa710 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 10 Sep 2025 17:07:12 -0700 Subject: [PATCH 4/6] Update [ghstack-poisoned] --- shim_et/xplat/executorch/build/runtime_wrapper.bzl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shim_et/xplat/executorch/build/runtime_wrapper.bzl b/shim_et/xplat/executorch/build/runtime_wrapper.bzl index e778b671786..46101ab36db 100644 --- a/shim_et/xplat/executorch/build/runtime_wrapper.bzl +++ b/shim_et/xplat/executorch/build/runtime_wrapper.bzl @@ -326,6 +326,8 @@ def _genrule(*args, **kwargs): env.genrule(*args, **kwargs) def _remove_caffe2_deps(kwargs): + if not env.is_oss: + return # We don't have Buckified PyTorch in OSS. At least let buck query work. MISSING_BUCK_DIRS = ("//caffe2", "//pytorch", "fbsource//third-party") for dep_type in ('deps', 'exported_deps'): From 8ec8c0665762f8085221440d9f99e72e847401eb Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 10 Sep 2025 17:29:18 -0700 Subject: [PATCH 5/6] Update [ghstack-poisoned] --- codegen/tools/targets.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codegen/tools/targets.bzl b/codegen/tools/targets.bzl index 0d815432ec7..acea3370e7d 100644 --- a/codegen/tools/targets.bzl +++ b/codegen/tools/targets.bzl @@ -17,10 +17,10 @@ def define_common_targets(is_fbcode = False): ], deps = [ "//executorch/codegen:gen_lib", - ] + [] if runtime.is_oss else select({ + ] + ([] if runtime.is_oss else select({ "DEFAULT": [], "ovr_config//os:linux": ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet - }), + })), ) runtime.python_binary( From 5965d4f9e081aa8b852343f26677023e6fa76f95 Mon Sep 17 00:00:00 2001 From: Scott Wolchok Date: Wed, 10 Sep 2025 20:29:46 -0700 Subject: [PATCH 6/6] Update [ghstack-poisoned] --- backends/arm/tosa/TARGETS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/arm/tosa/TARGETS b/backends/arm/tosa/TARGETS index fec53f2a7fb..18868054259 100644 --- a/backends/arm/tosa/TARGETS +++ b/backends/arm/tosa/TARGETS @@ -67,7 +67,7 @@ runtime.python_library( "partitioner.py", ], deps = [ - "//executorch/backends/arm:arm_compile_spec", + "//executorch/backends/arm:arm_backend", "//executorch/backends/arm:constants", "//executorch/backends/arm:process_node", "//executorch/backends/arm/debug:schema",