@@ -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 )
0 commit comments