From d030440d642caa9f498e9664b8f420033bd6421f Mon Sep 17 00:00:00 2001 From: Jake Stevens Date: Tue, 12 May 2026 09:25:57 -0700 Subject: [PATCH] Add cortex_passes Buck target and fix quantizer dep Summary: Add a new `cortex_passes` Python library target in `backends/cortex_m/passes` containing the CortexMPassManager and its constituent passes (activation fusion, convert-to-cortex-m, decompose hardswish/mean, quantized clamp activation, clamp hardswish). These were previously not in any Buck target, making CortexMQuantizer unusable from Buck builds. Differential Revision: D104841579 --- backends/cortex_m/passes/BUCK | 26 ++++++++++++++++++++++++++ backends/cortex_m/quantizer/TARGETS | 1 + 2 files changed, 27 insertions(+) diff --git a/backends/cortex_m/passes/BUCK b/backends/cortex_m/passes/BUCK index b70dd5b565e..9243cc986e8 100644 --- a/backends/cortex_m/passes/BUCK +++ b/backends/cortex_m/passes/BUCK @@ -25,6 +25,32 @@ fbcode_target(_kind = runtime.python_library, ], ) +fbcode_target(_kind = runtime.python_library, + name="cortex_passes", + srcs=[ + "activation_fusion_pass.py", + "clamp_hardswish_pass.py", + "convert_to_cortex_m_pass.py", + "cortex_m_pass_manager.py", + "decompose_hardswish_pass.py", + "decompose_mean_pass.py", + "quantized_clamp_activation_pass.py", + ], + deps=[ + "//caffe2:torch", + "//executorch/backends/arm/_passes:passes", + "//executorch/backends/cortex_m/ops:ops", + "//executorch/backends/cortex_m/passes:passes_utils", + "//executorch/backends/cortex_m/passes:replace_quant_nodes_pass", + "//executorch/backends/transforms:remove_getitem_op", + "//executorch/backends/transforms:replace_scalar_with_tensor", + "//executorch/exir:lib", + "//executorch/exir:pass_base", + "//executorch/exir:pass_manager", + "//executorch/exir/program:lib", + ], +) + fbcode_target(_kind = runtime.python_library, name="passes_utils", srcs=[ diff --git a/backends/cortex_m/quantizer/TARGETS b/backends/cortex_m/quantizer/TARGETS index d765e59cf8e..90d57e81734 100644 --- a/backends/cortex_m/quantizer/TARGETS +++ b/backends/cortex_m/quantizer/TARGETS @@ -27,6 +27,7 @@ python_library( "//executorch/backends/arm/quantizer:quantization_annotator", "//executorch/backends/arm/quantizer:quantization_config", "//executorch/backends/cortex_m:quantizer_reporter", + "//executorch/backends/cortex_m/passes:cortex_passes", "//pytorch/ao:torchao", "fbsource//third-party/pypi/tabulate:tabulate", ],