From 7ad997fccd8246674832710110aefd9a160907c1 Mon Sep 17 00:00:00 2001 From: Kimish Patel Date: Thu, 7 Nov 2024 09:06:32 -0800 Subject: [PATCH] [Executorch] Renable operator optimization flags Previous attempt at this resulted in revert due to app size increase. Much of this was due to op_div exploding. Two diffs underneath solve this issue Differential Revision: [D65606666](https://our.internmc.facebook.com/intern/diff/D65606666/) [ghstack-poisoned] --- .../kernels/portable/op_registration_util.bzl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/shim/xplat/executorch/kernels/portable/op_registration_util.bzl b/shim/xplat/executorch/kernels/portable/op_registration_util.bzl index 3aae6b31ca8..95ae518fd4a 100644 --- a/shim/xplat/executorch/kernels/portable/op_registration_util.bzl +++ b/shim/xplat/executorch/kernels/portable/op_registration_util.bzl @@ -2,7 +2,21 @@ load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "is_xplat", "runti load("@fbsource//xplat/executorch/build:selects.bzl", "selects") def get_compiler_optimization_flags(): - # App size regressons requires this to be baktraced until I have a better solution + # various ovr_configs are not available in oss + if not runtime.is_oss: + compiler_flags = select({ + "DEFAULT": [], + "ovr_config//os:android-arm64": [ + "-Os", + ], + "ovr_config//os:iphoneos": [ + "-Os", + ], + "ovr_config//os:macos-arm64": [ + "-Os", + ], + }) + return compiler_flags return [] def op_target(name, deps = [], android_deps = [], _allow_third_party_deps = False, _aten_mode_deps = []):