2727from executorch .export import (
2828 BackendRecipeProvider ,
2929 ExportRecipe ,
30+ LoweringRecipe ,
3031 QuantizationRecipe ,
3132 RecipeType ,
3233)
@@ -88,12 +89,19 @@ def create_recipe(
8889 )
8990 return None
9091
92+ def _get_xnnpack_lowering_recipe (
93+ self , precision_type : Optional [ConfigPrecisionType ] = None
94+ ) -> LoweringRecipe :
95+ return LoweringRecipe (
96+ partitioners = [XnnpackPartitioner (precision_type = precision_type )],
97+ edge_compile_config = get_xnnpack_edge_compile_config (),
98+ )
99+
91100 def _build_fp32_recipe (self , recipe_type : RecipeType ) -> ExportRecipe :
92101 return ExportRecipe (
93102 name = recipe_type .value ,
94- edge_compile_config = get_xnnpack_edge_compile_config (),
103+ lowering_recipe = self . _get_xnnpack_lowering_recipe (),
95104 executorch_backend_config = get_xnnpack_executorch_backend_config (),
96- partitioners = [XnnpackPartitioner ()],
97105 )
98106
99107 def _build_quantized_recipe (
@@ -120,9 +128,8 @@ def _build_quantized_recipe(
120128 return ExportRecipe (
121129 name = recipe_type .value ,
122130 quantization_recipe = quant_recipe ,
123- edge_compile_config = get_xnnpack_edge_compile_config ( ),
131+ lowering_recipe = self . _get_xnnpack_lowering_recipe ( precision_type ),
124132 executorch_backend_config = get_xnnpack_executorch_backend_config (),
125- partitioners = [XnnpackPartitioner (config_precision = precision_type )],
126133 )
127134
128135 def _build_int8da_intx_weight_recipe (
@@ -150,9 +157,8 @@ def _build_int8da_intx_weight_recipe(
150157 return ExportRecipe (
151158 name = recipe_type .value ,
152159 quantization_recipe = quant_recipe ,
153- edge_compile_config = get_xnnpack_edge_compile_config (),
160+ lowering_recipe = self . _get_xnnpack_lowering_recipe (),
154161 executorch_backend_config = get_xnnpack_executorch_backend_config (),
155- partitioners = [XnnpackPartitioner ()],
156162 )
157163
158164 def _validate_recipe_kwargs (self , recipe_type : RecipeType , ** kwargs : Any ) -> None :
0 commit comments