Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions backends/arm/test/tester/arm_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import inspect

import logging
import platform

from collections import Counter, defaultdict
from pprint import pformat
Expand Down Expand Up @@ -105,6 +106,21 @@
logger = logging.getLogger(__name__)


# TODO(MLETORCH-2048: Remove if possible or rework this to match minimal tolerance diff between architectures when TOSA is updated, or investigate/update atol in the failing tests)
def _adjust_tosa_aarch64_atol(compile_spec: ArmCompileSpec, atol: float) -> float:
"""Increase tolerance for aarch64 when running on TOSA.

This is due to the TOSA ref model being experimental on Aarch64.

"""
if isinstance(compile_spec, TosaCompileSpec) and platform.machine().lower() in (
"aarch64",
"arm64",
):
return atol * 1.1
return atol


def _dump_lowered_modules_artifact(
path_to_dump: Optional[str],
artifact: Union[EdgeProgramManager, ExecutorchProgramManager],
Expand Down Expand Up @@ -573,6 +589,8 @@ def run_method_and_compare_outputs(

"""

atol = _adjust_tosa_aarch64_atol(self.compile_spec, atol)

# backward-compatible ordering (accept inputs as the first positional argument)
inputs, reference_stage, test_stage = self._get_input_and_stages(
inputs, stage, reference_stage_type, run_eager_mode
Expand Down
Loading