aboutsummaryrefslogtreecommitdiff
path: root/ethosu
diff options
context:
space:
mode:
authorRickard Bolin <rickard.bolin@arm.com>2022-04-25 11:07:56 +0000
committertim.hall <tim.hall@arm.com>2022-05-18 14:40:37 +0000
commit1538dce9f07a310587f057aee5fbe25509963879 (patch)
treed26781bb52598301fa07aa5ca8403ff190a6037b /ethosu
parentc1be0873d9e28a21c7873793da896e6dd576292f (diff)
downloadethos-u-vela-1538dce9f07a310587f057aee5fbe25509963879.tar.gz
MLBEDSW-4783: Add config file directory structure
Add directory structure to support third party config files. Config files should now be placed in an appropriately named directory under the config_files directory, but can also be accessed by providing its absolute path to vela --config. Signed-off-by: Rickard Bolin <rickard.bolin@arm.com> Change-Id: I2fcf52e7b2ddd2c4491dc370c85c0b3937d18062
Diffstat (limited to 'ethosu')
-rw-r--r--ethosu/config_files/Arm/vela.ini135
-rw-r--r--ethosu/vela/vela.py50
2 files changed, 180 insertions, 5 deletions
diff --git a/ethosu/config_files/Arm/vela.ini b/ethosu/config_files/Arm/vela.ini
new file mode 100644
index 00000000..bcc33573
--- /dev/null
+++ b/ethosu/config_files/Arm/vela.ini
@@ -0,0 +1,135 @@
+; Copyright (C) 2020 Arm Limited or its affiliates. All rights reserved.
+;
+; SPDX-License-Identifier: Apache-2.0
+;
+; Licensed under the Apache License, Version 2.0 (the License); you may
+; not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+; www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an AS IS BASIS, WITHOUT
+; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+; -----------------------------------------------------------------------------
+; Vela configuration file
+
+; -----------------------------------------------------------------------------
+; System Configuration
+
+; Ethos-U55 Deep Embedded: SRAM (1.6 GB/s) and Flash (0.1 GB/s)
+[System_Config.Ethos_U55_Deep_Embedded]
+core_clock=200e6
+axi0_port=Sram
+axi1_port=OffChipFlash
+Sram_clock_scale=1.0
+Sram_burst_length=32
+Sram_read_latency=32
+Sram_write_latency=32
+OffChipFlash_clock_scale=0.0625
+OffChipFlash_burst_length=128
+OffChipFlash_read_latency=64
+OffChipFlash_write_latency=64
+
+; Ethos-U55 High-End Embedded: SRAM (4 GB/s) and Flash (0.5 GB/s)
+[System_Config.Ethos_U55_High_End_Embedded]
+core_clock=500e6
+axi0_port=Sram
+axi1_port=OffChipFlash
+Sram_clock_scale=1.0
+Sram_burst_length=32
+Sram_read_latency=32
+Sram_write_latency=32
+OffChipFlash_clock_scale=0.125
+OffChipFlash_burst_length=128
+OffChipFlash_read_latency=64
+OffChipFlash_write_latency=64
+
+; Ethos-U65 Embedded: SRAM (8 GB/s) and Flash (0.5 GB/s)
+[System_Config.Ethos_U65_Embedded]
+core_clock=500e6
+axi0_port=Sram
+axi1_port=OffChipFlash
+Sram_clock_scale=1.0
+Sram_burst_length=32
+Sram_read_latency=32
+Sram_write_latency=32
+OffChipFlash_clock_scale=0.0625
+OffChipFlash_burst_length=128
+OffChipFlash_read_latency=64
+OffChipFlash_write_latency=64
+
+; Ethos-U65 Mid-End: SRAM (8 GB/s) and DRAM (3.75 GB/s)
+[System_Config.Ethos_U65_Mid_End]
+core_clock=500e6
+axi0_port=Sram
+axi1_port=Dram
+Sram_clock_scale=1.0
+Sram_burst_length=32
+Sram_read_latency=32
+Sram_write_latency=32
+Dram_clock_scale=0.46875
+Dram_burst_length=128
+Dram_read_latency=500
+Dram_write_latency=250
+
+; Ethos-U65 High-End: SRAM (16 GB/s) and DRAM (3.75 GB/s)
+[System_Config.Ethos_U65_High_End]
+core_clock=1e9
+axi0_port=Sram
+axi1_port=Dram
+Sram_clock_scale=1.0
+Sram_burst_length=32
+Sram_read_latency=32
+Sram_write_latency=32
+Dram_clock_scale=0.234375
+Dram_burst_length=128
+Dram_read_latency=500
+Dram_write_latency=250
+
+; Ethos-U65 Client-Server: SRAM (16 GB/s) and DRAM (12 GB/s)
+[System_Config.Ethos_U65_Client_Server]
+core_clock=1e9
+axi0_port=Sram
+axi1_port=Dram
+Sram_clock_scale=1.0
+Sram_burst_length=32
+Sram_read_latency=32
+Sram_write_latency=32
+Dram_clock_scale=0.75
+Dram_burst_length=128
+Dram_read_latency=500
+Dram_write_latency=250
+
+; -----------------------------------------------------------------------------
+; Memory Mode
+
+; SRAM Only: only one AXI port is used and the SRAM is used for all storage
+[Memory_Mode.Sram_Only]
+const_mem_area=Axi0
+arena_mem_area=Axi0
+cache_mem_area=Axi0
+
+; Shared SRAM: the SRAM is shared between the Ethos-U and the Cortex-M software
+; The non-SRAM memory is assumed to be read-only
+[Memory_Mode.Shared_Sram]
+const_mem_area=Axi1
+arena_mem_area=Axi0
+cache_mem_area=Axi0
+
+; Dedicated SRAM: the SRAM (384KB) is only for use by the Ethos-U
+; The non-SRAM memory is assumed to be read-writeable
+[Memory_Mode.Dedicated_Sram]
+const_mem_area=Axi1
+arena_mem_area=Axi1
+cache_mem_area=Axi0
+arena_cache_size=393216
+
+; Dedicated SRAM 512KB: the SRAM (512KB) is only for use by the Ethos-U
+; The non-SRAM memory is assumed to be read-writeable
+[Memory_Mode.Dedicated_Sram_512KB]
+inherit=Memory_Mode.Dedicated_Sram
+arena_cache_size=524288
diff --git a/ethosu/vela/vela.py b/ethosu/vela/vela.py
index 2108e209..b5f9f986 100644
--- a/ethosu/vela/vela.py
+++ b/ethosu/vela/vela.py
@@ -18,6 +18,7 @@
#
# Provides command line interface, options parsing, and network loading. Before calling the compiler driver.
import argparse
+import glob
import os
import sys
import time
@@ -49,6 +50,8 @@ from .tosa_model_semantic import TosaSemantic
from .tosa_supported_operators import TosaSupportedOperators
from ethosu.vela.architecture_features import ArchitectureFeatures
+CONFIG_FILES_PATH = os.path.abspath(f"{__file__}/../../config_files")
+
def process(input_name, enable_debug_db, arch, model_reader_options, compiler_options, scheduler_options):
if compiler_options.timing:
@@ -282,6 +285,12 @@ def generate_supported_ops():
print(f"Report file: {filepath}")
+def list_config_files():
+ print("\nAvailable config files:\n")
+ for config in glob.glob(os.path.join(CONFIG_FILES_PATH, "*", "*.ini")):
+ print(config.lstrip(CONFIG_FILES_PATH + os.path.sep))
+
+
def main(args=None):
try:
if args is None:
@@ -298,6 +307,15 @@ def main(args=None):
help="Generate the SUPPORTED_OPS.md file in the current working directory and exit",
)
+ parser.add_argument(
+ "--list-config-files",
+ action="store_true",
+ help=(
+ "Display all available configurations in the `config_files` folder and exit. To select config file, "
+ "use the --config argument with one of the listed config files (For example: --config Arm/vela.ini )"
+ ),
+ )
+
# set network nargs to be optional to allow the support-ops-report CLI option to be used standalone
parser.add_argument(
"network",
@@ -428,14 +446,36 @@ def main(args=None):
generate_supported_ops()
return 0
+ if args.list_config_files:
+ list_config_files()
+ return 0
+
if args.network is None:
parser.error("the following argument is required: NETWORK")
+ def _parse_config(config):
+ if not config.endswith(".ini"):
+ raise InputFileError(config, "Configuration files must use the .ini extension")
+
+ if len(config.split(os.path.sep)) == 2 and not config.startswith(os.path.sep):
+ config_path = os.path.join(CONFIG_FILES_PATH, config)
+ else:
+ print(
+ f"Warning: Configuration file `{config}` not located in a folder directly under the "
+ "`config_files` directory. Note that the file depth from the `config_files` directory must be "
+ "exactly 2 to be discovered via the --list-config-files mechanism "
+ "(e.g. `config_files/directory_name/my_config_file.ini`). This config file will still be "
+ "parsed however, and treated as an absolute path config instead."
+ )
+ config_path = config
+
+ if not os.access(config_path, os.R_OK):
+ raise InputFileError(config_path, "File not found or is not readable")
+
+ return config_path
+
# check all config files exist because they will be read as a group
- if args.config is not None:
- for filename in args.config:
- if not os.access(filename, os.R_OK):
- raise InputFileError(filename, "File not found or is not readable")
+ config_files = [_parse_config(cfg) for cfg in args.config] if args.config else None
if args.cpu_tensor_alignment < 16 or args.cpu_tensor_alignment & (args.cpu_tensor_alignment - 1) != 0:
parser.error(
@@ -457,7 +497,7 @@ def main(args=None):
sys.setrecursionlimit(args.recursion_limit)
arch = architecture_features.ArchitectureFeatures(
- vela_config_files=args.config,
+ vela_config_files=config_files,
system_config=args.system_config,
memory_mode=args.memory_mode,
accelerator_config=args.accelerator_config,