Skip to content

Commit 8e10687

Browse files
committed
Arm backend: Bump to 2026.05 release of tosa-tools
Bump the release to 2026.05 and enable the compatibility flag for the serialization to make current and older versions of model-converter being able to deserialize the resulting flatbuffer file. Signed-off-by: Per Åstrand <per.astrand@arm.com> Change-Id: I717d59011bd211e3586e656a8dad62e77a8660dd
1 parent 6f2331b commit 8e10687

7 files changed

Lines changed: 746 additions & 2 deletions

File tree

backends/arm/common/arm_compile_spec.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class DebugMode(Enum):
3737
path_for_intermediates: str | None = None
3838
tosa_debug_mode: DebugMode | None = None
3939
preserve_io_quantization: bool = False
40+
tosa_dev_mode: bool | None = None
4041

4142
_TOSA_SPEC_KEY = "tosa_spec"
4243
_COMPILE_FLAGS_KEY = "compile_flags"
@@ -46,6 +47,7 @@ class DebugMode(Enum):
4647
_OUTPUT_REORDER_KEY = "ouput_reorder_workaround"
4748
_TRANSFORM_PIPELINE_CONFIG_KEY = "transform_pipeline_config"
4849
_PRESERVE_IO_QUANT_KEY = "preserve_io_quantization"
50+
_TOSA_DEV_MODE = "tosa_sw_dev_mode"
4951

5052
def _set_compile_specs(
5153
self,
@@ -56,6 +58,7 @@ def _set_compile_specs(
5658
output_order_workaround: bool = False,
5759
pipeline_config: ArmPassPipelineConfig | None = None,
5860
preserve_io_quantization: bool = False,
61+
tosa_dev_mode: bool | None = None,
5962
):
6063
"""Set all values of dataclass directly."""
6164
self.tosa_spec = tosa_spec
@@ -66,6 +69,7 @@ def _set_compile_specs(
6669
self.output_order_workaround = output_order_workaround
6770
self.preserve_io_quantization = preserve_io_quantization
6871
self._warn_if_redundant_preserve_io_quantization()
72+
self.tosa_dev_mode = tosa_dev_mode
6973
if output_order_workaround:
7074
warnings.warn(
7175
"ArmCompileSpec(output_order_workaround=True) is deprecated and will be "
@@ -84,6 +88,7 @@ def _from_list(cls, compile_specs: list[CompileSpec]): # noqa: C901
8488
output_order_workaround: bool = False
8589
pipeline_config: ArmPassPipelineConfig | None = None
8690
preserve_io_quantization: bool = False
91+
tosa_dev_mode: bool | None = None
8792
unknown_specs: dict[str, str] = {}
8893
for spec in compile_specs:
8994
key = spec.key
@@ -136,6 +141,12 @@ def _from_list(cls, compile_specs: list[CompileSpec]): # noqa: C901
136141
pipeline_config = ArmPassPipelineConfig.from_dict(json.loads(val))
137142
elif key == ArmCompileSpec._PRESERVE_IO_QUANT_KEY:
138143
preserve_io_quantization = str(val).lower() in ("1", "true", "yes")
144+
elif key == ArmCompileSpec._TOSA_DEV_MODE:
145+
if tosa_dev_mode is not None:
146+
raise ValueError(
147+
"More than one tosa_sw_dev_mode entry in compile spec."
148+
)
149+
tosa_dev_mode = str(val).lower() in ("1", "true", "yes")
139150
else:
140151
unknown_specs[key] = val
141152

@@ -160,6 +171,7 @@ def _from_list(cls, compile_specs: list[CompileSpec]): # noqa: C901
160171
output_order_workaround=output_order_workaround,
161172
pipeline_config=pipeline_config,
162173
preserve_io_quantization=preserve_io_quantization,
174+
tosa_dev_mode=tosa_dev_mode,
163175
)
164176
cls._from_list_hook(compile_spec, unknown_specs)
165177
compile_spec._validate()
@@ -242,6 +254,15 @@ def _to_list(self):
242254
str(bool(self.preserve_io_quantization)).encode(),
243255
)
244256
)
257+
258+
if self.tosa_dev_mode is not None:
259+
compile_spec.append(
260+
CompileSpec(
261+
ArmCompileSpec._TOSA_DEV_MODE,
262+
str(bool(self.tosa_dev_mode)).encode(),
263+
)
264+
)
265+
245266
return compile_spec
246267

247268
def _set_preserve_io_quantization(self, enabled: bool) -> "ArmCompileSpec":
@@ -326,6 +347,16 @@ def dump_debug_info(self, debug_mode: DebugMode | None):
326347
self.tosa_debug_mode = debug_mode
327348
return self
328349

350+
def _set_tosa_dev_mode(self, tosa_dev_mode: bool):
351+
"""Sets whether to enable TOSA software development mode.
352+
353+
Args:
354+
tosa_dev_mode: Boolean indicating whether to enable TOSA software development mode.
355+
356+
"""
357+
self.tosa_dev_mode = tosa_dev_mode
358+
return self
359+
329360
@deprecated(
330361
"set_output_order_workaround() is deprecated and will be removed in v1.5; please remove this call."
331362
)

backends/arm/requirements-arm-tosa.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ flatbuffers == 24.3.25
1010
tosa-adapter-model-explorer == 0.1.0
1111
ai-edge-model-explorer >= 0.1.16
1212
pytest-timeout == 2.4.0
13-
tosa-tools == 2026.2.1
13+
tosa-tools == 2026.5.0

backends/arm/test/misc/test_compile_spec.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ def test_preserve_io_quantization_roundtrip_vgf_FP_INT():
9494
assert roundtripped.preserve_io_quantization is True
9595

9696

97+
def test_preserve_tosa_dev_mode_roundtrip_vgf_FP_INT():
98+
compile_spec = VgfCompileSpec()
99+
roundtripped = VgfCompileSpec._from_list(compile_spec._to_list())
100+
assert roundtripped.tosa_dev_mode is True
101+
102+
97103
def test_preserve_io_quantization_warns_for_u55_INT():
98104
with warns(
99105
UserWarning,

backends/arm/tosa/backend.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ def _preprocess( # noqa: C901
232232
targetDraft=True if version.minor > 0 else False,
233233
)
234234

235+
if compile_spec.tosa_dev_mode:
236+
tosa_graph.setExperimentalDevVersion()
237+
235238
if not (
236239
tosa_spec.version.major == ts.TOSA_VERSION_MAJOR
237240
and tosa_spec.version.minor <= ts.TOSA_VERSION_MINOR
@@ -484,4 +487,5 @@ def filter_tosa_compile_specs(
484487
)
485488
.dump_debug_info(compile_spec.tosa_debug_mode)
486489
.set_output_order_workaround(compile_spec.output_order_workaround)
490+
._set_tosa_dev_mode(compile_spec.tosa_dev_mode)
487491
)

0 commit comments

Comments
 (0)