From 8eff5b08b020dfc8d8ca706f7489337e86768f5e Mon Sep 17 00:00:00 2001 From: Daksh Shami Date: Thu, 16 Oct 2025 12:44:39 -0700 Subject: [PATCH 1/2] Add exception free quantized kernels (#14962) Summary: Explicitly declaring generated libs with exception code off for quantized kernels as executorch does not use exceptions in general, and it can cause downstream errors. Detailed error is P1986979595 but the relevant part is: ``` buck-out/ABC/gen/fbsource/6e53edb0a9a0d828/xplat/executorch/kernels/quantized/__generated_lib_combined__/out/RegisterCodegenUnboxedKernelsEverything.cpp:77:44: error: exception handling disabled, use '-fexceptions' to enable 77 | } catch (const std::exception& ex) { | ``` This means the existing generated code uses exceptions in its code, so when we use these kernels with -fno-exceptions downstream, the build fails. After this diff, we can use the exception free kernels with 'no_exceptions' suffix -- `//xplat/executorch/kernels/quantized:generated_lib_no_exceptions` or `//xplat/executorch/kernels/quantized:generated_lib_aten_no_exceptions` as appropriate. We still have `//xplat/executorch/kernels/quantized:generated_lib` and `//xplat/executorch/kernels/quantized:generated_lib_aten` available, same as before, so no downstream side effects are expected. Reviewed By: swolchok Differential Revision: D84284541 --- kernels/quantized/targets.bzl | 73 +++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/kernels/quantized/targets.bzl b/kernels/quantized/targets.bzl index 7bd8f6852a7..3448fd9c603 100644 --- a/kernels/quantized/targets.bzl +++ b/kernels/quantized/targets.bzl @@ -96,41 +96,46 @@ def define_common_targets(): ], ) - executorch_generated_lib( - name = "generated_lib" + aten_suffix, - deps = [ - ":quantized_operators" + aten_suffix, - ":all_quantized_ops", - ], - custom_ops_yaml_target = ":quantized.yaml", - custom_ops_aten_kernel_deps = [":quantized_operators_aten"] if aten_mode else [], - custom_ops_requires_aot_registration = False, - aten_mode = aten_mode, - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], - define_static_targets = True, - ) + for support_exceptions in [True, False]: + exception_suffix = "_no_exceptions" if not support_exceptions else "" - # On Windows we can only compile these two ops currently, so adding a - # separate target for this. - executorch_generated_lib( - name = "q_dq_ops_generated_lib" + aten_suffix, - custom_ops_yaml_target = ":quantized.yaml", - kernel_deps = [ - "//executorch/kernels/quantized/cpu:op_quantize" + aten_suffix, - "//executorch/kernels/quantized/cpu:op_dequantize" + aten_suffix, - ], - aten_mode = aten_mode, - deps = [ - ":q_dq_ops", - ], - visibility = [ - "//executorch/...", - "@EXECUTORCH_CLIENTS", - ], - ) + executorch_generated_lib( + name = "generated_lib" + aten_suffix + exception_suffix, + deps = [ + ":quantized_operators" + aten_suffix, + ":all_quantized_ops", + ], + custom_ops_yaml_target = ":quantized.yaml", + custom_ops_aten_kernel_deps = [":quantized_operators_aten"] if aten_mode else [], + custom_ops_requires_aot_registration = False, + aten_mode = aten_mode, + support_exceptions = support_exceptions, + visibility = [ + "//executorch/...", + "@EXECUTORCH_CLIENTS", + ], + define_static_targets = True, + ) + + # On Windows we can only compile these two ops currently, so adding a + # separate target for this. + executorch_generated_lib( + name = "q_dq_ops_generated_lib" + aten_suffix + exception_suffix, + custom_ops_yaml_target = ":quantized.yaml", + kernel_deps = [ + "//executorch/kernels/quantized/cpu:op_quantize" + aten_suffix, + "//executorch/kernels/quantized/cpu:op_dequantize" + aten_suffix, + ], + aten_mode = aten_mode, + deps = [ + ":q_dq_ops", + ], + support_exceptions = support_exceptions, + visibility = [ + "//executorch/...", + "@EXECUTORCH_CLIENTS", + ], + ) runtime.python_library( name = "quantized_ops_lib", From d0a505d15fa4f89f192efe0291100e7912a5e790 Mon Sep 17 00:00:00 2001 From: Daksh Shami Date: Thu, 16 Oct 2025 12:44:39 -0700 Subject: [PATCH 2/2] Add fpu embedded target to EthosUBackend (#15202) Summary: We need to add embedded fpu target as well for EthosUBackend as Arm FVP platform can use that for tests for some models. Differential Revision: D84284543 --- backends/arm/runtime/targets.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/arm/runtime/targets.bzl b/backends/arm/runtime/targets.bzl index 88ce410d956..b4c17acda34 100644 --- a/backends/arm/runtime/targets.bzl +++ b/backends/arm/runtime/targets.bzl @@ -14,7 +14,7 @@ def define_common_targets(): name = "arm_backend", srcs = ["EthosUBackend.cpp"], headers = [], - compatible_with = ["ovr_config//cpu:arm32-embedded"], + compatible_with = ["ovr_config//cpu:arm32-embedded", "ovr_config//cpu:arm32-embedded-fpu"], # arm_executor_runner.cpp needs to compile with executor as whole # @lint-ignore BUCKLINT: Avoid `link_whole=True` (https://fburl.com/avoid-link-whole) link_whole = True,