diff options
author | Patrik Gustavsson <patrik.gustavsson@arm.com> | 2020-06-25 12:56:04 +0200 |
---|---|---|
committer | Patrik Gustavsson <patrik.gustavsson@arm.com> | 2020-06-30 17:51:01 +0200 |
commit | 5f47c0511d3fc6b54aba331b58c85c3970b61718 (patch) | |
tree | 02cd91ade6ea9d78ccc8969e5394fee5709fbc0e | |
parent | 8c32e15b613815052e47f793466f4f7b7c591eb1 (diff) | |
download | ethos-u-vela-5f47c0511d3fc6b54aba331b58c85c3970b61718.tar.gz |
MLBEDSW-2564 Restrict settings of perm. storage
Restrict settings of permanent storage.
Signed-off-by: Patrik Gustavsson <patrik.gustavsson@arm.com>
Change-Id: Iaa81ee05e8e567b2737825be634baa9085192f0e
-rw-r--r-- | ethosu/vela/architecture_features.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/ethosu/vela/architecture_features.py b/ethosu/vela/architecture_features.py index e33c5d55..dc668895 100644 --- a/ethosu/vela/architecture_features.py +++ b/ethosu/vela/architecture_features.py @@ -199,7 +199,7 @@ Note the difference between ArchitectureFeatures and CompilerOptions self.memory_port_widths = np.zeros(MemArea.Size) # Get system configuration - self.__read_sys_config() + self.__read_sys_config(is_yoda_system) # apply the global memory clock scales to the individual ones from the system config for mem in MemArea.all(): @@ -549,7 +549,7 @@ Note the difference between ArchitectureFeatures and CompilerOptions print("Warning: No configured CPU performance estimate for", op.type) return 0 - def __read_sys_config(self): + def __read_sys_config(self, is_yoda_system): """ Gets the system configuration with the given name from the vela configuration file Example configuration snippet: @@ -592,13 +592,22 @@ Note the difference between ArchitectureFeatures and CompilerOptions "Invalid memory configuration fast_storage_mem_area must be same as feature_map_storage_mem_area" ) self.permanent_storage_mem_area = MemArea[self.__sys_config("permanent_storage_mem_area", "OffChipFlash")] - if self.permanent_storage_mem_area not in set((MemArea.OnChipFlash, MemArea.OffChipFlash, MemArea.Dram)): - raise Exception( - "Invalid permanent_storage_mem_area = " - + str(self.permanent_storage_mem_area) - + " (must be 'OnChipFlash', 'OffChipFlash' or 'DRAM')." - " To store the weights and other constant data in SRAM on ethosu-55 select 'OnChipFlash'" - ) + if is_yoda_system: + if self.permanent_storage_mem_area is not MemArea.Dram: + raise Exception( + "Invalid permanent_storage_mem_area = " + + str(self.permanent_storage_mem_area) + + " (must be 'DRAM' for Yoda)." + ) + else: + if self.permanent_storage_mem_area not in set((MemArea.OnChipFlash, MemArea.OffChipFlash)): + raise Exception( + "Invalid permanent_storage_mem_area = " + + str(self.permanent_storage_mem_area) + + " (must be 'OnChipFlash' or 'OffChipFlash' for ethosu-55)." + " To store the weights and other constant data in SRAM on ethosu-55 select 'OnChipFlash'" + ) + self.sram_size = 1024 * int(self.__sys_config("sram_size_kb", "204800")) except Exception: |