diff --git a/aidge_core/export_utils/export_registry.py b/aidge_core/export_utils/export_registry.py index eabc6eb6b656b0c0b0c8381b665d6a6d8f3805ff..51711b751a676017dbd8b0db14aaba8846574330 100644 --- a/aidge_core/export_utils/export_registry.py +++ b/aidge_core/export_utils/export_registry.py @@ -28,6 +28,8 @@ class ExportLib(aidge_core.OperatorImpl): # key: Path where static file is # Value: Path where to copy the file relative to the export root static_files: Dict[str, str] = {} + # Main memory section + memory_section = None # PRIVATE # Registry of exportNode, class level dictionary, shared across all ExportLib _cls_export_node_registry = {} diff --git a/aidge_core/export_utils/scheduler_export.py b/aidge_core/export_utils/scheduler_export.py index 6829832feda7af7b2c808df4cd430fc77b37b3cb..13b5cb9ce64d859c459db65dbc9ac8166eaa82e9 100644 --- a/aidge_core/export_utils/scheduler_export.py +++ b/aidge_core/export_utils/scheduler_export.py @@ -114,6 +114,7 @@ def scheduler_export(scheduler, export_folder_path: str, export_lib: ExportLib = headers=set(list_configs), actions=list_actions, mem_ctype=inputs_dtype[0], # Legacy behavior ... + mem_section=export_lib.mem_section, peak_mem=peak_mem, inputs_name=inputs_name, inputs_dtype=inputs_dtype, diff --git a/aidge_core/export_utils/templates/forward.jinja b/aidge_core/export_utils/templates/forward.jinja index aec5867b132e0ece9a8a39d9cf5daadeb25ea24a..fde4b2a1392c4ada353af06246951e26c6236df6 100644 --- a/aidge_core/export_utils/templates/forward.jinja +++ b/aidge_core/export_utils/templates/forward.jinja @@ -14,7 +14,11 @@ {%- endfor %} // Memory block +{%- if mem_section == None %} static {{mem_ctype}} mem[{{peak_mem}}]; +{%- else %} +static {{mem_ctype}} mem[{{peak_mem}}] __attribute__((section("{{ mem_section }}"))); +{%- endif %} {# Forward function #} {#- Support multiple inputs with different datatypes and multiple outputs with different datatypes -#}