From c89bb7f2ac1d678a2e0f00e25f1020ae9face4da Mon Sep 17 00:00:00 2001 From: Oscar Andersson Date: Wed, 26 Feb 2025 15:53:29 +0100 Subject: [PATCH 1/2] Add tosa_spec and et-version info to .tosa files output_tag.tosa is not very informative. Output files will now be named as output_tag__.tosa instead. Signed-off-by: Oscar Andersson Change-Id: Ie8704ea1da0707803420f9533da58b7364e2048c --- backends/arm/test/misc/test_debug_feats.py | 6 ++++-- backends/arm/tosa_backend.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backends/arm/test/misc/test_debug_feats.py b/backends/arm/test/misc/test_debug_feats.py index 690549d7174..156d646cb6e 100644 --- a/backends/arm/test/misc/test_debug_feats.py +++ b/backends/arm/test/misc/test_debug_feats.py @@ -9,6 +9,7 @@ import shutil import tempfile import unittest +from importlib.metadata import version import torch from executorch.backends.arm.test import common @@ -192,15 +193,16 @@ def test_collate_tosa_BI_tests(self): .to_edge_transform_and_lower() .to_executorch() ) + et_version = version("executorch") # test that the output directory is created and contains the expected files assert os.path.exists( "test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests" ) assert os.path.exists( - "test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/output_tag6.tosa" + f"test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/output_tag6_TOSA-0.80+BI_{et_version}.tosa" ) assert os.path.exists( - "test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/desc_tag6.json" + f"test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/desc_tag6_TOSA-0.80+BI_{et_version}.json" ) os.environ.pop("TOSA_TESTCASES_BASE_PATH") diff --git a/backends/arm/tosa_backend.py b/backends/arm/tosa_backend.py index 0eb0757e262..6030b4e8bef 100644 --- a/backends/arm/tosa_backend.py +++ b/backends/arm/tosa_backend.py @@ -12,6 +12,7 @@ # import logging import os +from importlib.metadata import version from typing import cast, final, List import serializer.tosa_serializer as ts # type: ignore @@ -122,10 +123,12 @@ def preprocess( # noqa: C901 if artifact_path: tag = _get_first_delegation_tag(graph_module) + et_version = version("executorch") dbg_tosa_dump( tosa_graph, artifact_path, - suffix="{}".format(f"_{tag}" if tag else ""), + suffix="{}".format(f"_{tag}" if tag else "") + + (f"_{tosa_spec}" + (f"_{et_version}")), ) # Serialize and return the TOSA flatbuffer. From 68f6a266f7a4787fc93153172dda7dcf137a8bd4 Mon Sep 17 00:00:00 2001 From: Oscar Andersson Date: Fri, 21 Mar 2025 08:32:30 +0100 Subject: [PATCH 2/2] Remove et-version from TOSA output file names Signed-off-by: Oscar Andersson Change-Id: Ib7e96f8983bc78c3be309de1ba7b488f9499f66c --- backends/arm/test/misc/test_debug_feats.py | 6 ++---- backends/arm/tosa_backend.py | 5 +---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/backends/arm/test/misc/test_debug_feats.py b/backends/arm/test/misc/test_debug_feats.py index 156d646cb6e..4a3767833a3 100644 --- a/backends/arm/test/misc/test_debug_feats.py +++ b/backends/arm/test/misc/test_debug_feats.py @@ -9,7 +9,6 @@ import shutil import tempfile import unittest -from importlib.metadata import version import torch from executorch.backends.arm.test import common @@ -193,16 +192,15 @@ def test_collate_tosa_BI_tests(self): .to_edge_transform_and_lower() .to_executorch() ) - et_version = version("executorch") # test that the output directory is created and contains the expected files assert os.path.exists( "test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests" ) assert os.path.exists( - f"test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/output_tag6_TOSA-0.80+BI_{et_version}.tosa" + "test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/output_tag6_TOSA-0.80+BI.tosa" ) assert os.path.exists( - f"test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/desc_tag6_TOSA-0.80+BI_{et_version}.json" + "test_collate_tosa_tests/tosa-bi/TestCollateTosaTests/test_collate_tosa_BI_tests/desc_tag6_TOSA-0.80+BI.json" ) os.environ.pop("TOSA_TESTCASES_BASE_PATH") diff --git a/backends/arm/tosa_backend.py b/backends/arm/tosa_backend.py index 6030b4e8bef..c93ba8398ee 100644 --- a/backends/arm/tosa_backend.py +++ b/backends/arm/tosa_backend.py @@ -12,7 +12,6 @@ # import logging import os -from importlib.metadata import version from typing import cast, final, List import serializer.tosa_serializer as ts # type: ignore @@ -123,12 +122,10 @@ def preprocess( # noqa: C901 if artifact_path: tag = _get_first_delegation_tag(graph_module) - et_version = version("executorch") dbg_tosa_dump( tosa_graph, artifact_path, - suffix="{}".format(f"_{tag}" if tag else "") - + (f"_{tosa_spec}" + (f"_{et_version}")), + suffix="{}".format(f"_{tag}" if tag else "") + (f"_{tosa_spec}"), ) # Serialize and return the TOSA flatbuffer.