Skip to content

Arm backend: add tosa_spec and et-version info to .tosa files #9308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2025
Merged
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
6 changes: 4 additions & 2 deletions backends/arm/test/misc/test_debug_feats.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import shutil
import tempfile
import unittest
from importlib.metadata import version

import torch
from executorch.backends.arm.test import common
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 4 additions & 1 deletion backends/arm/tosa_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Loading