From b52b585f1c9ee3f2800fa51f3031117ed1396abd Mon Sep 17 00:00:00 2001 From: Liam Barry Date: Mon, 15 Nov 2021 11:41:40 +0000 Subject: MLECO-2471: Move arena-cache-size to setup script Signed-off-by: Liam Barry Change-Id: Ibf712cb9359b9bc9977d4f77aec1d7c7f4245825 --- scripts/vela/default_vela.ini | 1 - set_up_default_resources.py | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/vela/default_vela.ini b/scripts/vela/default_vela.ini index 30de99d..c15e81f 100644 --- a/scripts/vela/default_vela.ini +++ b/scripts/vela/default_vela.ini @@ -57,7 +57,6 @@ Dram_write_latency=250 const_mem_area=Axi1 arena_mem_area=Axi0 cache_mem_area=Axi0 -arena_cache_size=4194304 ; Dedicated SRAM: the SRAM (384KB) is only for use by the Ethos-U ; The non-SRAM memory is assumed to be read-writeable diff --git a/set_up_default_resources.py b/set_up_default_resources.py index 4a5ef10..3eff6bf 100755 --- a/set_up_default_resources.py +++ b/set_up_default_resources.py @@ -134,6 +134,9 @@ NPUConfig = namedtuple('NPUConfig',['config_name', 'ethos_u_npu_id', 'ethos_u_config_id']) +# The default internal SRAM size for Corstone-300 implementation on MPS3 +mps3_max_sram_sz = 4 * 1024 * 1024 # 4 MiB + def call_command(command: str) -> str: """ @@ -192,7 +195,9 @@ def get_default_npu_config_from_name(config_name: str) -> NPUConfig: return None -def set_up_resources(run_vela_on_models=False, additional_npu_config_names=[]): +def set_up_resources(run_vela_on_models=False, + additional_npu_config_names=[], + arena_cache_size=mps3_max_sram_sz): """ Helpers function that retrieve the output from a command. @@ -200,6 +205,7 @@ def set_up_resources(run_vela_on_models=False, additional_npu_config_names=[]): ---------- run_vela_on_models (bool): Specifies if run vela on downloaded models. additional_npu_config_names(list): list of strings of Ethos-U NPU configs. + arena_cache_size(int): Specifies arena cache size in bytes. """ current_file_dir = os.path.dirname(os.path.abspath(__file__)) download_dir = os.path.abspath(os.path.join(current_file_dir, "resources_downloaded")) @@ -313,7 +319,8 @@ def set_up_resources(run_vela_on_models=False, additional_npu_config_names=[]): f"--config {config_file} " + f"--memory-mode={config.memory_mode} " + f"--system-config={config.system_config} " + - f"--output-dir={output_dir}") + f"--output-dir={output_dir} " + + f"--arena-cache-size={arena_cache_size} ") # we want the name to include the configuration suffix. For example: vela_H128, # vela_Y512 etc. @@ -341,9 +348,15 @@ if __name__ == '__main__': help=f"""Additional (non-default) configurations for Vela: {valid_npu_config_names}""", default=[], action="append") + parser.add_argument("--arena-cache-size", + help="Arena cache size in bytes", + type=int, + default=mps3_max_sram_sz) args = parser.parse_args() logging.basicConfig(filename='log_build_default.log', level=logging.DEBUG) logging.getLogger().addHandler(logging.StreamHandler(sys.stdout)) - set_up_resources(not args.skip_vela, args.additional_ethos_u_config_name) + set_up_resources(not args.skip_vela, + args.additional_ethos_u_config_name, + args.arena_cache_size) -- cgit v1.2.1