Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion backends/arm/_passes/decompose_embedding_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from .arm_pass_utils import create_node, get_first_fake_tensor

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)


class DecomposeEmbeddingPass(ArmPass):
Expand Down
2 changes: 1 addition & 1 deletion backends/arm/ethosu/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _compile_tosa_flatbuffer(
binary = vela_compile(
tosa_flatbuffer,
compile_flags,
verbose=logger.getEffectiveLevel() == logging.INFO,
verbose=logger.getEffectiveLevel() <= logging.INFO,
intermediate_path=compile_spec.get_intermediate_path(),
)
return binary
Expand Down
2 changes: 1 addition & 1 deletion backends/arm/operator_support/right_shift_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ def is_node_tosa_supported(
"""
# TODO MLETORCH-525 Remove warning
if tosa_spec.is_U55_subset:
logging.warning(f"{node.target} may introduce one-off errors.")
logger.warning(f"{node.target} may introduce one-off errors.")
return True
2 changes: 1 addition & 1 deletion backends/arm/operator_support/slice_copy_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ def is_node_tosa_supported(self, node: fx.Node, tosa_spec: TosaSpecification) ->

args = node.args
if len(args) == 5 and (step := args[4]) != 1:
logging.warning(f"{node.target} with step size of {step} not supported.")
logger.warning(f"{node.target} with step size of {step} not supported.")
return False
return True
7 changes: 3 additions & 4 deletions backends/arm/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import logging
import os
import random
import sys
from typing import Any

import pytest

logger = logging.getLogger(__name__)

"""
This file contains the pytest hooks, fixtures etc. for the Arm test suite.
"""
Expand All @@ -29,8 +30,6 @@ def pytest_configure(config):
if config.option.arm_run_tosa_version:
pytest._test_options["tosa_version"] = config.option.arm_run_tosa_version

logging.basicConfig(level=logging.INFO, stream=sys.stdout)


def pytest_collection_modifyitems(config, items):
pass
Expand Down Expand Up @@ -98,7 +97,7 @@ def set_random_seed():
"ARM_TEST_SEED env variable must be integers or the string RANDOM"
)

print(f" ARM_TEST_SEED={seed} ", end=" ")
logger.info(f"ARM_TEST_SEED={seed}")


# ==== End of Pytest fixtures =====
Expand Down
12 changes: 7 additions & 5 deletions backends/arm/test/misc/test_debug_feats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
)
from executorch.backends.test.harness.stages import StageType


input_t1 = Tuple[torch.Tensor] # Input x


Expand Down Expand Up @@ -261,14 +260,14 @@ def test_dump_tosa_debug_tosa(test_data: input_t1):


@common.parametrize("test_data", Linear.inputs)
def test_dump_tosa_ops(caplog, test_data: input_t1):
def test_dump_tosa_ops(capsys, test_data: input_t1):
aten_ops: list[str] = []
exir_ops: list[str] = []
pipeline = TosaPipelineINT[input_t1](Linear(), test_data, aten_ops, exir_ops)
pipeline.pop_stage("run_method_and_compare_outputs")
pipeline.dump_operator_distribution("to_edge_transform_and_lower")
pipeline.run()
assert "TOSA operators:" in caplog.text
assert "TOSA operators:" in capsys.readouterr().out


class Add(torch.nn.Module):
Expand All @@ -282,12 +281,15 @@ def forward(self, x):

@common.parametrize("test_data", Add.inputs)
@common.XfailIfNoCorstone300
def test_fail_dump_tosa_ops(caplog, test_data: input_t1):
def test_fail_dump_tosa_ops(capsys, test_data: input_t1):
aten_ops: list[str] = []
exir_ops: list[str] = []
pipeline = EthosU55PipelineINT[input_t1](
Add(), test_data, aten_ops, exir_ops, use_to_edge_transform_and_lower=True
)
pipeline.dump_operator_distribution("to_edge_transform_and_lower")
pipeline.run()
assert "Can not get operator distribution for Vela command stream." in caplog.text
assert (
"Can not get operator distribution for Vela command stream."
in capsys.readouterr().out
)
1 change: 0 additions & 1 deletion backends/arm/test/models/test_deit_tiny_arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from torchvision import transforms

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


deit_tiny = timm.models.deit.deit_tiny_patch16_224(pretrained=True)
Expand Down
4 changes: 2 additions & 2 deletions backends/arm/test/runner_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,11 +763,11 @@ def run_tosa_graph(
if isinstance(tosa_version, Tosa_1_00):
import tosa_reference_model as reference_model # type: ignore[import-untyped]

debug_mode = "ALL" if logger.level <= logging.DEBUG else None
debug_mode = "ALL" if logger.getEffectiveLevel() <= logging.DEBUG else None
outputs_np, status = reference_model.run(
graph,
inputs_np,
verbosity=_tosa_refmodel_loglevel(logger.level),
verbosity=_tosa_refmodel_loglevel(logger.getEffectiveLevel()),
initialize_variable_tensor_from_numpy=True,
debug_mode=debug_mode,
)
Expand Down
5 changes: 1 addition & 4 deletions backends/arm/test/tester/analyze_output_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,8 @@ def dump_error_output(


if __name__ == "__main__":
import sys

logging.basicConfig(stream=sys.stdout, level=logging.INFO)

""" This is expected to produce the example output of print_diff"""
"""This is expected to produce the example output of print_diff"""
torch.manual_seed(0)
a = torch.rand(3, 3, 2, 2) * 0.01
b = a.clone().detach()
Expand Down
2 changes: 1 addition & 1 deletion backends/arm/test/tester/arm_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def _dump_str(to_print: str, path_to_dump: Optional[str] = None):
with open(path_to_dump, "a") as fp:
fp.write(to_print)
else:
logger.info(to_print)
print(to_print)


def _format_dict(to_print: dict, print_table: bool = True) -> str:
Expand Down
Loading