From bb65fba5f87e4387e972bf453b1e18e5a0be11cd Mon Sep 17 00:00:00 2001 From: Luka Macan Date: Thu, 9 Nov 2023 11:12:03 +0100 Subject: [PATCH 1/3] Fix voltage and change frequency to perf --- .../PULP/Common/Templates/main.c.t | 2 + .../PULP/GAP9/HW_description.json | 6 +-- .../PULP/GAP9_NE16/HW_description.json | 48 +------------------ 3 files changed, 6 insertions(+), 50 deletions(-) mode change 100644 => 120000 dory/Hardware_targets/PULP/GAP9_NE16/HW_description.json diff --git a/dory/Hardware_targets/PULP/Common/Templates/main.c.t b/dory/Hardware_targets/PULP/Common/Templates/main.c.t index ece05b4d..c7b07f91 100644 --- a/dory/Hardware_targets/PULP/Common/Templates/main.c.t +++ b/dory/Hardware_targets/PULP/Common/Templates/main.c.t @@ -95,6 +95,8 @@ void application(void * arg) { int main () { #ifndef TARGET_CHIP_FAMILY_GAP9 PMU_set_voltage(1000, 0); +#else + pi_pmu_voltage_set(PI_PMU_VOLTAGE_DOMAIN_CHIP, PI_PMU_VOLT_800); #endif pi_time_wait_us(10000); pi_freq_set(PI_FREQ_DOMAIN_FC, ${fc_frequency}); diff --git a/dory/Hardware_targets/PULP/GAP9/HW_description.json b/dory/Hardware_targets/PULP/GAP9/HW_description.json index 954e10a6..46b28b5c 100644 --- a/dory/Hardware_targets/PULP/GAP9/HW_description.json +++ b/dory/Hardware_targets/PULP/GAP9/HW_description.json @@ -33,9 +33,9 @@ "8bits": 32, "float32": null }, - "core frequency": 50000000, - "accelerator frequency": 50000000, - "peripheral frequency": 50000000, + "core frequency": 370000000, + "accelerator frequency": 370000000, + "peripheral frequency": 370000000, "HW specific parameters":{ "accelerator core0 stack": 3500, "accelerator core1-7 stack": 3400 diff --git a/dory/Hardware_targets/PULP/GAP9_NE16/HW_description.json b/dory/Hardware_targets/PULP/GAP9_NE16/HW_description.json deleted file mode 100644 index 39c8c17c..00000000 --- a/dory/Hardware_targets/PULP/GAP9_NE16/HW_description.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "PULP/GAP9_NE16", - "memory": { - "levels": 3, - "L1": { - "dimension": 120000, - "bandwidth": 32, - "latency": 1, - "frequency": 100000000 - }, - "L2": { - "dimension": 1536000, - "bandwidth": 8, - "latency": 10, - "frequency": 100000000 - }, - "L3": { - "dimension": 8000000, - "bandwidth": null, - "latency": null, - "frequency": null - }, - "DMA": "yes", - "cache": "no" - }, - "architecture": "single-core+accelerator", - "software development kit": { - "name": "gap_sdk", - "directory": "~/gap_sdk/sdk_private" - }, - "peak MAC/cycle": - { - "8bits": 32, - "float32": null - }, - "core frequency": 50000000, - "accelerator frequency": 50000000, - "peripheral frequency": 50000000, - "HW specific parameters":{ - "accelerator core0 stack": 2048, - "accelerator core1-7 stack": 1024 - }, - "double_buffering": 2, - "split_ints": true, - "blocking_dma_transfers": false, - "single_core_dma": true -} diff --git a/dory/Hardware_targets/PULP/GAP9_NE16/HW_description.json b/dory/Hardware_targets/PULP/GAP9_NE16/HW_description.json new file mode 120000 index 00000000..d8294108 --- /dev/null +++ b/dory/Hardware_targets/PULP/GAP9_NE16/HW_description.json @@ -0,0 +1 @@ +../GAP9/HW_description.json \ No newline at end of file From 8db66ab469bf2004f004fd4ad9d9e336c3339d36 Mon Sep 17 00:00:00 2001 From: Luka Macan Date: Thu, 9 Nov 2023 12:03:36 +0100 Subject: [PATCH 2/3] Add instruction cache flags --- dory/Hardware_targets/PULP/GAP9/Templates/network_c_template.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dory/Hardware_targets/PULP/GAP9/Templates/network_c_template.c b/dory/Hardware_targets/PULP/GAP9/Templates/network_c_template.c index 230ac9c2..49ebbbcf 100644 --- a/dory/Hardware_targets/PULP/GAP9/Templates/network_c_template.c +++ b/dory/Hardware_targets/PULP/GAP9/Templates/network_c_template.c @@ -127,6 +127,9 @@ struct ${prefix}network_run_token ${prefix}network_run_async(void *l2_buffer, si // First open the cluster pi_cluster_conf_init(&conf); conf.id=0; +#ifdef TARGET_CHIP_FAMILY_GAP9 + conf.icache_conf = PI_CLUSTER_MASTER_CORE_ICACHE_ENABLE | PI_CLUSTER_ICACHE_PREFETCH_ENABLE | PI_CLUSTER_ICACHE_ENABLE; +#endif <% n_args = 4 if l3_supported else 5 %>\ From 2cf758bd3373f19e266fe6ec9ccebc12ecc4c682 Mon Sep 17 00:00:00 2001 From: Luka Macan Date: Thu, 9 Nov 2023 13:08:36 +0100 Subject: [PATCH 3/3] Use relative path from c_parser to find utils --- dory/Parsers/Parser_HW_to_C.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dory/Parsers/Parser_HW_to_C.py b/dory/Parsers/Parser_HW_to_C.py index 8282411d..63535abd 100644 --- a/dory/Parsers/Parser_HW_to_C.py +++ b/dory/Parsers/Parser_HW_to_C.py @@ -98,9 +98,8 @@ def copy_backend_files(self, node): def copy_utils_files(self): print("\nCopying Utils.") - utils_files_dir = os.path.join(os.path.dirname(__file__), '../Hardware_targets', self.HW_description["name"], 'Utils_files') - for file in os.listdir(utils_files_dir): - file_to_copy = os.path.join(utils_files_dir, file) + for file in os.listdir(self.utils_files_dir): + file_to_copy = os.path.join(self.utils_files_dir, file) if file_to_copy[-1] == 'c': os.system('cp -L "{}" {}'.format(file_to_copy, self.src_dir)) elif file_to_copy[-1] == 'h': @@ -173,6 +172,10 @@ def get_file_path(self): def tmpl_dir(self): return os.path.realpath(os.path.join(self.get_file_path(), 'Templates/layer_templates')) + @property + def utils_files_dir(self): + return os.path.realpath(os.path.join(self.get_file_path(), 'Utils_files')) + def full_graph_parsing(self): print("#####################################################") print("## DORY GENERAL PARSING FROM DORY HW IR TO C FILES ##")