Skip to content

Commit ad1af52

Browse files
Arm backend: Address more logging issues
dump_operator_distribution now prints instead of log to align behavior with dump_artifact. Also fixes a log-level comparison in ethosu_backend. Signed-off-by: Oscar Andersson <[email protected]> Change-Id: I53eb8dcb1197e420abdb8a635fe2eaad925acaae
1 parent c1b4dad commit ad1af52

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

backends/arm/ethosu/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _compile_tosa_flatbuffer(
6363
binary = vela_compile(
6464
tosa_flatbuffer,
6565
compile_flags,
66-
verbose=logger.getEffectiveLevel() == logging.INFO,
66+
verbose=logger.getEffectiveLevel() <= logging.INFO,
6767
intermediate_path=compile_spec.get_intermediate_path(),
6868
)
6969
return binary

backends/arm/test/misc/test_debug_feats.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
)
2424
from executorch.backends.test.harness.stages import StageType
2525

26-
2726
input_t1 = Tuple[torch.Tensor] # Input x
2827

2928

@@ -261,14 +260,14 @@ def test_dump_tosa_debug_tosa(test_data: input_t1):
261260

262261

263262
@common.parametrize("test_data", Linear.inputs)
264-
def test_dump_tosa_ops(caplog, test_data: input_t1):
263+
def test_dump_tosa_ops(capsys, test_data: input_t1):
265264
aten_ops: list[str] = []
266265
exir_ops: list[str] = []
267266
pipeline = TosaPipelineINT[input_t1](Linear(), test_data, aten_ops, exir_ops)
268267
pipeline.pop_stage("run_method_and_compare_outputs")
269268
pipeline.dump_operator_distribution("to_edge_transform_and_lower")
270269
pipeline.run()
271-
assert "TOSA operators:" in caplog.text
270+
assert "TOSA operators:" in capsys.readouterr().out
272271

273272

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

283282
@common.parametrize("test_data", Add.inputs)
284283
@common.XfailIfNoCorstone300
285-
def test_fail_dump_tosa_ops(caplog, test_data: input_t1):
284+
def test_fail_dump_tosa_ops(capsys, test_data: input_t1):
286285
aten_ops: list[str] = []
287286
exir_ops: list[str] = []
288287
pipeline = EthosU55PipelineINT[input_t1](
289288
Add(), test_data, aten_ops, exir_ops, use_to_edge_transform_and_lower=True
290289
)
291290
pipeline.dump_operator_distribution("to_edge_transform_and_lower")
292291
pipeline.run()
293-
assert "Can not get operator distribution for Vela command stream." in caplog.text
292+
assert (
293+
"Can not get operator distribution for Vela command stream."
294+
in capsys.readouterr().out
295+
)

backends/arm/test/tester/arm_tester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def _dump_str(to_print: str, path_to_dump: Optional[str] = None):
832832
with open(path_to_dump, "a") as fp:
833833
fp.write(to_print)
834834
else:
835-
logger.info(to_print)
835+
print(to_print)
836836

837837

838838
def _format_dict(to_print: dict, print_table: bool = True) -> str:

0 commit comments

Comments
 (0)