Commit b031fd3f authored by mir's avatar mir

TASK_MANAGER_RU RF Sim working

parent b11c8070
......@@ -5,17 +5,13 @@
#define TASK_MANAGER_DECODING
#define TASK_MANAGER_DEMODULATION
#define TASK_MANAGER_CODING
//#define TASK_MANAGER_RU
#define TASK_MANAGER_RU
//#define TASK_MANAGER_UE
//#define TASK_MANAGER_UE_DECODING
//#define TASK_MANAGER_SIM
//#define TASK_MANAGER_LTE
// LTE
//#define TASK_MANAGER_LTE
#include "task.h"
#ifndef __cplusplus
......@@ -36,6 +32,7 @@
#elif __aarch64__
// This is not always true for ARM
// in linux, you can obtain the size at runtime using sysconf (_SC_LEVEL1_DCACHE_LINESIZE)
// or from the bash with the command $ getconf LEVEL1_DCACHE_LINESIZE
// in c++ using std::hardware_destructive_interference_size
#define LEVEL1_DCACHE_LINESIZE 64
#else
......
......@@ -54,6 +54,8 @@
#include <executables/softmodem-common.h>
#include "common/utils/thread_pool/task_manager.h"
#ifdef SMBV
#include "PHY/TOOLS/smbv.h"
unsigned short config_frames[4] = {2,9,11,13};
......@@ -1907,6 +1909,9 @@ void init_NR_RU(configmodule_interface_t *cfg, char *rf_config_file)
s_offset+=sprintf(pool+s_offset,",%d",ru->tpcores[icpu]);
}
LOG_I(PHY,"RU thread-pool core string %s\n",pool);
#ifdef TASK_MANAGER_RU
init_task_manager(&ru->man, ru->num_tpcores);
#endif
ru->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
initTpool(pool, ru->threadPool, cpumeas(CPUMEAS_GETSTATE));
// FEP RX result FIFO
......
......@@ -41,6 +41,8 @@
#include "nfapi_nr_interface_scf.h"
#include <common/utils/threadPool/thread-pool.h>
#include <executables/rt_profiling.h>
#include "common/utils/thread_pool/task_manager.h"
#define MAX_BANDS_PER_RRU 4
#define MAX_RRU_CONFIG_SIZE 1024
......@@ -176,6 +178,9 @@ typedef struct {
int startSymbol;
int endSymbol;
int slot;
#ifdef TASK_MANAGER_RU
task_ans_t* ans;
#endif
} feprx_cmd_t;
typedef struct {
......@@ -184,6 +189,9 @@ typedef struct {
int slot;
int startSymbol;
int numSymbols;
#ifdef TASK_MANAGER_RU
task_ans_t* ans;
#endif
} feptx_cmd_t;
typedef struct {
......@@ -426,6 +434,9 @@ typedef enum {
typedef struct RU_t_s {
#ifdef TASK_MANAGER_RU
task_manager_t man;
#endif
/// ThreadPool for RU
tpool_t *threadPool;
/// index of this ru
......
......@@ -38,6 +38,8 @@
#include "common/utils/LOG/log.h"
#include "common/utils/system.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/thread_pool/task_manager.h"
#include "T.h"
......@@ -319,6 +321,10 @@ void nr_feptx(void *arg) {
////////////FEPTX////////////
nr_feptx0(ru,slot,startSymbol,numSymbols,aa);
#ifdef TASK_MANAGER_RU
completed_task_ans(feptx->ans);
#endif
}
// RU FEP TX using thread-pool
......@@ -331,33 +337,69 @@ void nr_feptx_tp(RU_t *ru, int frame_tx, int slot) {
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 1 );
start_meas(&ru->ofdm_total_stats);
#ifdef TASK_MANAGER_RU
size_t const sz = ru->nb_tx + (ru->half_slot_parallelization>0)*ru->nb_tx;
feptx_cmd_t arr[sz];
task_ans_t ans[sz];
memset(ans, 0, sz*sizeof(task_ans_t));
#endif
for (int aid=0;aid<ru->nb_tx;aid++) {
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid,ru->respfeptx,nr_feptx);
feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req);
#ifdef TASK_MANAGER_RU
feptx_cmd_t *feptx_cmd = &arr[nbfeptx];
feptx_cmd->ans = &ans[nbfeptx];
#else
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid,ru->respfeptx,nr_feptx);
feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req);
#endif
feptx_cmd->aid = aid;
feptx_cmd->ru = ru;
feptx_cmd->slot = slot;
feptx_cmd->startSymbol = 0;
feptx_cmd->numSymbols = (ru->half_slot_parallelization>0)?ru->nr_frame_parms->symbols_per_slot>>1:ru->nr_frame_parms->symbols_per_slot;
#ifdef TASK_MANAGER_RU
task_t t = {.func = nr_feptx, .args = feptx_cmd};
async_task_manager(&ru->man, t);
#else
pushTpool(ru->threadPool,req);
#endif
nbfeptx++;
if (ru->half_slot_parallelization>0) {
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid + ru->nb_tx,ru->respfeptx,nr_feptx);
#ifdef TASK_MANAGER_RU
feptx_cmd_t *feptx_cmd = &arr[nbfeptx];
feptx_cmd->ans = &ans[nbfeptx];
#else
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid + ru->nb_tx,ru->respfeptx,nr_feptx);
feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req);
#endif
feptx_cmd->aid = aid;
feptx_cmd->ru = ru;
feptx_cmd->slot = slot;
feptx_cmd->startSymbol = ru->nr_frame_parms->symbols_per_slot>>1;
feptx_cmd->numSymbols = ru->nr_frame_parms->symbols_per_slot>>1;
#ifdef TASK_MANAGER_RU
task_t t = {.func = nr_feptx, .args = feptx_cmd};
async_task_manager(&ru->man, t);
#else
pushTpool(ru->threadPool,req);
#endif
nbfeptx++;
}
}
#ifdef TASK_MANAGER_RU
if(nbfeptx > 0)
join_task_ans(ans, nbfeptx);
#else
while (nbfeptx>0) {
notifiedFIFO_elt_t *req=pullTpool(ru->respfeptx, ru->threadPool);
delNotifiedFIFO_elt(req);
nbfeptx--;
}
#endif
stop_meas(&ru->ofdm_total_stats);
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 0 );
}
......@@ -387,6 +429,10 @@ void nr_fep(void* arg) {
tti_rx,
ru->N_TA_offset);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+aid, 0);
#ifdef TASK_MANAGER_RU
completed_task_ans(feprx_cmd->ans);
#endif
}
// RU RX FEP using thread-pool
......@@ -395,33 +441,69 @@ void nr_fep_tp(RU_t *ru, int slot) {
int nbfeprx=0;
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 );
start_meas(&ru->ofdm_demod_stats);
#ifdef TASK_MANAGER_RU
size_t const sz = ru->nb_rx + (ru->half_slot_parallelization>0)*ru->nb_rx;
feprx_cmd_t arr[sz];
task_ans_t ans[sz];
memset(&ans, 0, sz * sizeof(task_ans_t));
#endif
for (int aid=0;aid<ru->nb_rx;aid++) {
#ifdef TASK_MANAGER_RU
feprx_cmd_t* feprx_cmd= &arr[nbfeprx];
feprx_cmd->ans = &ans[nbfeprx];
#else
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feprx_cmd_t), 1000 + aid,ru->respfeprx,nr_fep);
feprx_cmd_t *feprx_cmd=(feprx_cmd_t*)NotifiedFifoData(req);
#endif
feprx_cmd->aid = aid;
feprx_cmd->ru = ru;
feprx_cmd->slot = ru->proc.tti_rx;
feprx_cmd->startSymbol = 0;
feprx_cmd->endSymbol = (ru->half_slot_parallelization > 0)?(ru->nr_frame_parms->symbols_per_slot>>1)-1:(ru->nr_frame_parms->symbols_per_slot-1);
#ifdef TASK_MANAGER_RU
task_t t = {.func = nr_fep, .args = feprx_cmd};
async_task_manager(&ru->man, t);
#else
pushTpool(ru->threadPool,req);
#endif
nbfeprx++;
if (ru->half_slot_parallelization>0) {
#ifdef TASK_MANAGER_RU
feprx_cmd_t* feprx_cmd= &arr[nbfeprx];
feprx_cmd->ans = &ans[nbfeprx];
#else
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feprx_cmd_t), 1000 + aid + ru->nb_rx,ru->respfeprx,nr_fep);
feprx_cmd_t *feprx_cmd=(feprx_cmd_t*)NotifiedFifoData(req);
#endif
feprx_cmd->aid = aid;
feprx_cmd->ru = ru;
feprx_cmd->slot = ru->proc.tti_rx;
feprx_cmd->startSymbol = ru->nr_frame_parms->symbols_per_slot>>1;
feprx_cmd->endSymbol = ru->nr_frame_parms->symbols_per_slot-1;
#ifdef TASK_MANAGER_RU
task_t t = {.func = nr_fep, .args = feprx_cmd};
async_task_manager(&ru->man, t);
#else
pushTpool(ru->threadPool,req);
#endif
nbfeprx++;
}
}
#ifdef TASK_MANAGER_RU
if(nbfeprx > 0)
join_task_ans(ans, nbfeprx);
#else
while (nbfeprx>0) {
notifiedFIFO_elt_t *req=pullTpool(ru->respfeprx, ru->threadPool);
delNotifiedFIFO_elt(req);
nbfeprx--;
}
#endif
stop_meas(&ru->ofdm_demod_stats);
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment