From d7bc502dc2a762a1b81e8413f51bfc5cee1253a3 Mon Sep 17 00:00:00 2001 From: Gregory Comer Date: Thu, 16 Jan 2025 00:11:31 -0800 Subject: [PATCH] Exclude upsample_bilinear2d.vec and nearest2d.vec from default export decomposition table (#7126) Summary: As upsample_bilinear2d.vec and upsample_nearest2d.vec are core ATen ops, they should not be decomposed by default in the export path. Because the operators have CompositeImplicitAutograd dispatch, their decomposition is registered by default. This change adds an override list for CIA decompositions being registered in the default decomp table. In the long-term, we likely will want to exclude decompositions for all core-tagged CIA ops, but this will require all consumers to be ready to handle the remaining two ops, avg_pool1d, and adaptive_avg_pool1d. Until they are ready, I believe an explicit override list is the safest option. Additionally, I've also removed the ExecuTorch XNNPACK delegate ConvertToUpsampleBilinear2d pass, as the pass breaks (and is not needed), given that the op is not decomposed. The purpose of this pass was originally to pattern match the decomposition and recompose it, but this is no longer necessary. X-link: https://github.com/pytorch/pytorch/pull/141791 Differential Revision: D66575454 --- backends/xnnpack/_passes/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backends/xnnpack/_passes/__init__.py b/backends/xnnpack/_passes/__init__.py index 00e1ba03586..496beda3d38 100644 --- a/backends/xnnpack/_passes/__init__.py +++ b/backends/xnnpack/_passes/__init__.py @@ -4,6 +4,8 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. +# pyre-unsafe + from typing import List, Optional, Type from executorch.backends.xnnpack._passes.channels_last_tagged_reshape_pass import ( @@ -14,9 +16,6 @@ ) from executorch.backends.xnnpack._passes.convert_to_linear import ConvertToLinearPass from executorch.backends.xnnpack._passes.convert_to_sdpa import ConvertToSDPAPass -from executorch.backends.xnnpack._passes.convert_to_upsample_bilinear2d import ( - ConvertToUpsampleBilinear2d, -) from executorch.backends.xnnpack._passes.fuse_activation_pass import FuseActivationPass from executorch.backends.xnnpack._passes.fuse_batch_norm_with_conv import ( FuseBatchNormWithConvPass, @@ -57,7 +56,6 @@ def __init__( self.passes = [ # TODO - remove this pass once we have a better support for dim_order ops lowering DimOrderOpsRevertPass, - ConvertToUpsampleBilinear2d, ConvertToLinearPass, ConvertToSDPAPass, ConstPropPass,