From bbd4b7af47f5d5161b61cc110ad4d677cf9bc7e6 Mon Sep 17 00:00:00 2001 From: Francesco Conti Date: Mon, 19 Feb 2024 14:34:51 +0000 Subject: [PATCH] expose prefetch option in N-EUREKA --- neureka/hal/neureka_task.c | 6 ++++++ neureka/hal/neureka_task.h | 5 +++++ neureka/hal/neureka_task_defs.h | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/neureka/hal/neureka_task.c b/neureka/hal/neureka_task.c index 501b2b9..16f54f8 100644 --- a/neureka/hal/neureka_task.c +++ b/neureka/hal/neureka_task.c @@ -115,6 +115,12 @@ void neureka_task_set_weight_source(neureka_task_t *task, task->data.cfg.conf0 |= weight_source; } +void neureka_task_set_activation_prefetch(neureka_task_t *task, + neureka_activation_prefetch_e activation_prefetch) { + task->data.cfg.conf0 &= ~NEUREKA_MASK_FLAG_ACTIVATION_PREFETCH; + task->data.cfg.conf0 |= activation_prefetch; +} + /** neureka_pad_ptr * * Calculate the pointer to the start of the ptr as if diff --git a/neureka/hal/neureka_task.h b/neureka/hal/neureka_task.h index 2d06468..5217a71 100644 --- a/neureka/hal/neureka_task.h +++ b/neureka/hal/neureka_task.h @@ -39,6 +39,11 @@ typedef enum neureka_weight_offset_mode_e { weightOffsetModeLayerWise = NEUREKA_FLAG_WEIGHT_OFFSET_LAYER_WISE } neureka_weight_offset_mode_e; +typedef enum neureka_activation_prefetch_e { + activationPrefetchOn = NEUREKA_FLAG_ACTIVATION_PREFETCH_ON, + activationPrefetchOff = NEUREKA_FLAG_ACTIVATION_PREFETCH_OFF +} neureka_activation_prefetch_e; + typedef enum { normMode8Bit = NEUREKA_NORM_MODE_8BIT, normMode32Bit = NEUREKA_NORM_MODE_32BIT diff --git a/neureka/hal/neureka_task_defs.h b/neureka/hal/neureka_task_defs.h index dfd74d4..7a4ca3e 100644 --- a/neureka/hal/neureka_task_defs.h +++ b/neureka/hal/neureka_task_defs.h @@ -92,7 +92,8 @@ #define NEUREKA_FLAG_STREAMIN (1 << 14) #define NEUREKA_NORM_MODE_8BIT (0 << 12) #define NEUREKA_NORM_MODE_32BIT (2 << 12) -#define NEUREKA_FLAG_ACTIVATION_PREFETCH (1 << 10) +#define NEUREKA_FLAG_ACTIVATION_PREFETCH_ON (1 << 10) +#define NEUREKA_FLAG_ACTIVATION_PREFETCH_OFF (0 << 10) #define NEUREKA_FLAG_WEIGHT_SOURCE_WMEM (1 << 9) #define NEUREKA_FLAG_WEIGHT_SOURCE_TCDM (0 << 9) #define NEUREKA_FLAG_LINEAR_MODE (1 << 7) // not tested