Skip to content

Commit e0c2028

Browse files
committed
Try fixing arm tests
1 parent 19f6c27 commit e0c2028

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

backends/arm/quantizer/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@
1919
try:
2020
import executorch.extension.pybindings.portable_lib
2121
import executorch.kernels.quantized # noqa
22-
except:
22+
except ImportError as e:
2323
import logging
2424

25-
logging.info(
26-
"Failed to load portable_lib and quantized_aot_lib. To run quantized kernels AOT, either build "
25+
logging.warning(
26+
f"Failed to load portable_lib and quantized_aot_lib: {e}. To run quantized kernels AOT, either build "
27+
"Executorch with pybindings, or load your own custom built op library using torch.ops.load_library."
28+
)
29+
del logging
30+
except Exception as e:
31+
import logging
32+
33+
logging.warning(
34+
f"Unexpected error loading quantized ops: {e}. To run quantized kernels AOT, either build "
2735
"Executorch with pybindings, or load your own custom built op library using torch.ops.load_library."
2836
)
2937
del logging

exir/passes/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,18 @@ def make_alloc_node(
314314
return alloc
315315

316316

317+
# Ensure quantized operators are available for ToOutVarPass
318+
# This prevents "Missing out variants" errors for quantized_decomposed operators
319+
try:
320+
from torch.ao.quantization.fx._decomposed import quantized_decomposed_lib # noqa: F401
321+
# Also import ExecutorTorch quantized kernels which define the out variants
322+
import executorch.extension.pybindings.portable_lib # noqa: F401
323+
import executorch.kernels.quantized # noqa: F401
324+
except ImportError:
325+
# Quantized operators are optional, continue without them
326+
pass
327+
328+
317329
class ToOutVarPass(PassBase):
318330
def __init__(self, ignore_to_out_var_failure: bool = False) -> None:
319331
self.ignore_to_out_var_failure = ignore_to_out_var_failure

0 commit comments

Comments
 (0)