Commit 7d5ea3e9 authored by mir's avatar mir

TASK_MANAGER_LTE flag removed

parent 7886ec11
#ifndef TASK_MANAGER_WORKING_STEALING_H
#define TASK_MANAGER_WORKING_STEALING_H
#define TASK_MANAGER_LTE
#include "task.h"
#ifndef __cplusplus
......
......@@ -552,31 +552,18 @@ int main ( int argc, char **argv )
L1_rxtx_proc_t *L1proctx= &RC.eNB[x][CC_id]->proc.L1_proc_tx;
L1proc->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
if ( strlen(get_softmodem_params()->threadPoolConfig) > 0 ){
#ifdef TASK_MANAGER_LTE
L1proc->man = calloc(1, sizeof(task_manager_t));
assert(L1proc->man != NULL && "Memory exhausted");
int const num_threads = parse_num_threads(get_softmodem_params()->threadPoolConfig);
init_task_manager(L1proc->man, num_threads);
#else
initTpool(get_softmodem_params()->threadPoolConfig, L1proc->threadPool, true);
#endif
L1proc->man = calloc(1, sizeof(task_manager_t));
assert(L1proc->man != NULL && "Memory exhausted");
int const num_threads = parse_num_threads(get_softmodem_params()->threadPoolConfig);
init_task_manager(L1proc->man, num_threads);
}else {
#ifdef TASK_MANAGER_LTE
L1proc->man = calloc(1, sizeof(task_manager_t));
assert(L1proc->man != NULL && "Memory exhausted");
int const num_threads = parse_num_threads("n");
init_task_manager(L1proc->man, num_threads);
#else
initTpool("n", L1proc->threadPool, true);
#endif
L1proc->man = calloc(1, sizeof(task_manager_t));
assert(L1proc->man != NULL && "Memory exhausted");
int const num_threads = parse_num_threads("n");
init_task_manager(L1proc->man, num_threads);
}
initNotifiedFIFO(L1proc->respDecode);
#ifdef TASK_MANAGER_LTE
L1proctx->man = L1proc->man;
#else
L1proctx->threadPool = L1proc->threadPool;
#endif
}
printf("wait_eNBs()\n");
......
......@@ -282,9 +282,8 @@ static void TPencode(void * arg) {
hadlsch->nb_rb);
stop_meas(rdata->rm_stats);
#ifdef TASK_MANAGER_LTE
// Task completed in parallel
completed_task_ans(rdata->ans);
#endif
}
int dlsch_encoding(PHY_VARS_eNB *eNB,
......@@ -322,8 +321,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
num_pdcch_symbols,
frame,subframe,beamforming_mode);
int nbEncode = 0;
// if (hadlsch->Ndi == 1) { // this is a new packet
if (hadlsch->round == 0) { // this is a new packet
// Add 24-bit crc (polynomial A) to payload
......@@ -350,23 +347,14 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
return(-1);
}
#ifdef TASK_MANAGER_LTE
turboEncode_t arr[hadlsch->C];
task_ans_t ans[hadlsch->C];
memset(ans, 0, hadlsch->C * sizeof(task_ans_t));
#endif
notifiedFIFO_t respEncode;
initNotifiedFIFO(&respEncode);
for (int r=0, r_offset=0; r<hadlsch->C; r++) {
#ifdef TASK_MANAGER_LTE
turboEncode_t* rdata = &arr[r];
rdata->ans = &ans[r];
#else
union turboReqUnion id= {.s={dlsch->rnti,frame,subframe,r,0}};
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(turboEncode_t), id.p, &respEncode, TPencode);
turboEncode_t * rdata=(turboEncode_t *) NotifiedFifoData(req);
#endif
for (int r = 0, r_offset = 0; r < hadlsch->C; r++) {
turboEncode_t* rdata = &arr[r];
rdata->ans = &ans[r];
rdata->input=hadlsch->c[r];
rdata->Kr_bytes= ( r<hadlsch->Cminus ? hadlsch->Kminus : hadlsch->Kplus) >>3;
rdata->filler=(r==0) ? hadlsch->F : 0;
......@@ -379,13 +367,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
rdata->round=hadlsch->round;
rdata->r_offset=r_offset;
rdata->G=G;
#ifdef TASK_MANAGER_LTE
task_t t = {.func = TPencode, .args = rdata};
async_task_manager(proc->man, t);
#else
pushTpool(proc->threadPool, req);
#endif
nbEncode++;
task_t t = {.func = TPencode, .args = rdata};
async_task_manager(proc->man, t);
int Qm=hadlsch->Qm;
int C=hadlsch->C;
......@@ -397,21 +381,8 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
else
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
}
#ifdef TASK_MANAGER_LTE
if(nbEncode > 0){
join_task_ans(ans, hadlsch->C);
}
#else
// Wait all other threads finish to process
while (nbEncode) {
notifiedFIFO_elt_t *res = pullTpool(&respEncode, proc->threadPool);
if (res == NULL)
break; // Tpool has been stopped
delNotifiedFIFO_elt(res);
nbEncode--;
}
#endif
join_task_ans(ans, hadlsch->C);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
return(0);
......@@ -477,24 +448,14 @@ int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
&hadlsch->F)<0)
return(-1);
}
int nbEncode = 0;
#ifdef TASK_MANAGER_LTE
turboEncode_t arr[hadlsch->C];
task_ans_t ans[hadlsch->C];
memset(ans, 0, hadlsch->C * sizeof(task_ans_t));
#endif
notifiedFIFO_t respEncode;
initNotifiedFIFO(&respEncode);
for (int r=0, r_offset=0; r<hadlsch->C; r++) {
#ifdef TASK_MANAGER_LTE
turboEncode_t* rdata = &arr[r];
rdata->ans = &ans[r];
#else
union turboReqUnion id= {.s={dlsch->rnti,frame,subframe,r,0}};
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(turboEncode_t), id.p, &respEncode, TPencode);
turboEncode_t * rdata=(turboEncode_t *) NotifiedFifoData(req);
#endif
for (int r = 0, r_offset = 0; r < hadlsch->C; r++) {
turboEncode_t* rdata = &arr[r];
rdata->ans = &ans[r];
rdata->input=hadlsch->c[r];
rdata->Kr_bytes= ( r<hadlsch->Cminus ? hadlsch->Kminus : hadlsch->Kplus) >>3;
rdata->filler=(r==0) ? hadlsch->F : 0;
......@@ -508,13 +469,8 @@ int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
rdata->r_offset=r_offset;
rdata->G=G;
#ifdef TASK_MANAGER_LTE
task_t t = {.func = TPencode, .args = rdata};
async_task_manager(proc->man, t);
#else
pushTpool(proc->threadPool, req);
#endif
nbEncode++;
task_t t = {.func = TPencode, .args = rdata};
async_task_manager(proc->man, t);
int Qm=hadlsch->Qm;
int C=hadlsch->C;
......@@ -527,20 +483,8 @@ int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
}
#ifdef TASK_MANAGER_LTE
if(nbEncode > 0){
join_task_ans(ans, hadlsch->C);
}
#else
// Wait all other threads finish to process
while (nbEncode) {
notifiedFIFO_elt_t *res = pullTpool(&respEncode, proc->threadPool);
if (res == NULL)
break; // Tpool has been stopped
delNotifiedFIFO_elt(res);
nbEncode--;
}
#endif
join_task_ans(ans, hadlsch->C);
return(0);
}
......
......@@ -527,10 +527,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
uint8_t UE_id,
uint8_t control_only_flag,
uint8_t Nbundled,
uint8_t llr8_flag
#ifdef TASK_MANAGER_LTE
,thread_info_tm_t* t_info
#endif
uint8_t llr8_flag,
thread_info_tm_t* t_info
);
void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
......
......@@ -240,9 +240,8 @@ void processULSegment(void * arg) {
1,
r,
&E)==-1) {
#ifdef TASK_MANAGER_LTE
// Task completed in parallel
completed_task_ans(rdata->ans);
#endif
LOG_E(PHY,"ulsch_decoding.c: Problem in rate matching\n");
return;
}
......@@ -289,9 +288,9 @@ void processULSegment(void * arg) {
&eNB->ulsch_tc_intl2_stats,
&ulsch_harq->abort_decode);
#ifdef TASK_MANAGER_LTE
completed_task_ans(rdata->ans);
#endif
// Task completed in parallel
completed_task_ans(rdata->ans);
}
/*!
......@@ -303,11 +302,7 @@ void processULSegment(void * arg) {
@returns 0 on success
*/
#ifdef TASK_MANAGER_LTE
static int ulsch_decoding_data(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, int UE_id, int harq_pid, int llr8_flag, thread_info_tm_t* t_info)
#else
static int ulsch_decoding_data(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, int UE_id, int harq_pid, int llr8_flag)
#endif
{
unsigned int r_offset=0;
int offset = 0;
......@@ -343,19 +338,11 @@ static int ulsch_decoding_data(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, int UE_i
else
E = ulsch_harq->Qm * ((GpmodC==0?0:1) + (Gp/ulsch_harq->C));
#ifdef TASK_MANAGER_LTE
turboDecode_t* rdata = &((turboDecode_t*)t_info->buf)[t_info->len];
assert(t_info->len < 64);
rdata->ans = &t_info->ans[t_info->len];
t_info->len += 1;
#else
union turboReqUnion id= {.s={ulsch->rnti,proc->frame_rx,proc->subframe_rx,0,0}};
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(turboDecode_t),
id.p,
proc->respDecode,
processULSegment);
turboDecode_t * rdata=(turboDecode_t *) NotifiedFifoData(req);
#endif
assert(t_info->len < 64);
rdata->ans = &t_info->ans[t_info->len];
t_info->len += 1;
rdata->eNB=eNB;
rdata->frame=proc->frame_rx;
rdata->subframe=proc->subframe_rx;
......@@ -373,12 +360,10 @@ static int ulsch_decoding_data(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, int UE_i
rdata->function=td;
int Fbytes=(r==0) ? rdata->Fbits>>3 : 0;
int sz=Kr_bytes - Fbytes - ((ulsch_harq->C>1)?3:0);
#ifdef TASK_MANAGER_LTE
task_t t = { .args = rdata, .func = &processULSegment };
task_t t = {.func = &processULSegment, .args = rdata};
async_task_manager(proc->man, t);
#else
pushTpool(proc->threadPool,req);
#endif
proc->nbDecode++;
LOG_D(PHY,"Added a block to decode, in pipe: %d\n",proc->nbDecode);
r_offset+=E;
......@@ -419,10 +404,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
uint8_t UE_id,
uint8_t control_only_flag,
uint8_t Nbundled,
uint8_t llr8_flag
#ifdef TASK_MANAGER_LTE
,thread_info_tm_t* t_info
#endif
uint8_t llr8_flag,
thread_info_tm_t* t_info
)
{
int16_t *ulsch_llr = eNB->pusch_vars[UE_id]->llr;
......@@ -1110,11 +1093,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
LOG_D(PHY,"frame %d subframe %d O_ACK:%d o_ACK[]=%d:%d:%d:%d\n",frame,subframe,ulsch_harq->O_ACK,ulsch_harq->o_ACK[0],ulsch_harq->o_ACK[1],ulsch_harq->o_ACK[2],ulsch_harq->o_ACK[3]);
// Do ULSCH Decoding for data portion
#ifdef TASK_MANAGER_LTE
ret = ulsch_decoding_data(eNB, proc, UE_id, harq_pid, llr8_flag, t_info);
#else
ret = ulsch_decoding_data(eNB, proc, UE_id, harq_pid, llr8_flag);
#endif
return(ret);
}
......
......@@ -252,11 +252,7 @@ typedef struct {
pthread_cond_t cond_RUs;
/// mutex for RXn-TXnp4 processing thread
pthread_mutex_t mutex_RUs;
#ifdef TASK_MANAGER_LTE
task_manager_t* man; // non-owning ptr
#else
tpool_t *threadPool;
#endif
int nbDecode;
notifiedFIFO_t *respDecode;
pthread_mutex_t mutex_emulateRF;
......@@ -797,9 +793,7 @@ typedef struct TurboDecode_s {
int offset;
int maxIterations;
int decodeIterations;
#ifdef TASK_MANAGER_LTE
task_ans_t* ans;
#endif
task_ans_t* ans;
} turboDecode_t;
#define TURBO_SIMD_SOFTBITS 96+12+3+3*6144
......@@ -816,9 +810,7 @@ typedef struct turboEncode_s {
time_stats_t *rm_stats;
time_stats_t *te_stats;
time_stats_t *i_stats;
#ifdef TASK_MANAGER_LTE
task_ans_t* ans;
#endif
task_ans_t* ans;
} turboEncode_t;
......
......@@ -1233,13 +1233,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
} // end loop for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) {
}
#ifdef TASK_MANAGER_LTE
void postDecode(L1_rxtx_proc_t *proc, turboDecode_t* rdata){
#else
void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req)
{
turboDecode_t * rdata=(turboDecode_t *) NotifiedFifoData(req);
#endif
LTE_eNB_ULSCH_t *ulsch = rdata->eNB->ulsch[rdata->UEid];
LTE_UL_eNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
PHY_VARS_eNB *eNB=rdata->eNB;
......@@ -1334,11 +1328,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
const int frame = proc->frame_rx;
uint32_t harq_pid0 = subframe2harq_pid(&eNB->frame_parms,frame,subframe);
#ifdef TASK_MANAGER_LTE
turboDecode_t arr[64] = {0};
task_ans_t ans[64] = {0};
thread_info_tm_t t_info = { .ans = ans, .buf = (uint8_t*)arr };
#endif
for (i = 0; i < NUMBER_OF_ULSCH_MAX; i++) {
ulsch = eNB->ulsch[i];
......@@ -1398,9 +1390,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
0, // control_only_flag
ulsch_harq->V_UL_DAI,
ulsch_harq->nb_rb > 20 ? 1 : 0
#ifdef TASK_MANAGER_LTE
,&t_info
#endif
);
}
else if ((ulsch) &&
......@@ -1418,7 +1408,6 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
} // for (i=0; i<NUMBER_OF_ULSCH_MAX; i++)
const bool decode = proc->nbDecode;
#ifdef TASK_MANAGER_LTE
assert(t_info.len == proc->nbDecode);
if (proc->nbDecode > 0) {
join_task_ans(t_info.ans, t_info.len);
......@@ -1426,17 +1415,6 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
postDecode(proc, &arr[i]);
}
}
#else
while (proc->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(proc->respDecode, proc->threadPool);
if (req == NULL)
break; // Tpool has been stopped
postDecode(proc, req);
const time_stats_t ts = exec_time_stats_NotifiedFIFO(req);
merge_meas(&eNB->ulsch_turbo_decoding_stats, &ts);
delNotifiedFIFO_elt(req);
}
#endif
if (decode)
stop_meas(&eNB->ulsch_decoding_stats);
}
......
......@@ -590,9 +590,7 @@ int main(int argc, char **argv) {
nfapi_tx_request_t TX_req;
Sched_Rsp_t sched_resp;
int pa=dB0;
#ifdef TASK_MANAGER_LTE
task_manager_t man = {0};
#endif
cpu_freq_GHz = get_cpu_freq_GHz();
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
memset((void *)&sched_resp,0,sizeof(sched_resp));
......@@ -1260,14 +1258,10 @@ int main(int argc, char **argv) {
L1_rxtx_proc_t *proc_eNB = &eNB->proc.L1_proc;
proc_eNB->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(proc_eNB->respDecode);
#ifdef TASK_MANAGER_LTE
int const n_threads = parse_num_threads("n");
init_task_manager(&man, n_threads);
proc_eNB->man = &man;
#else
proc_eNB->threadPool = (tpool_t *)malloc(sizeof(tpool_t));
initTpool("n", proc_eNB->threadPool, true);
#endif
proc_eNB->frame_tx=0;
......
......@@ -789,15 +789,11 @@ int main(int argc, char **argv) {
proc_rxtx_ue->subframe_tx = proc_rxtx->subframe_rx;
proc_rxtx_ue->subframe_rx = (proc_rxtx->subframe_tx+6)%10;
#ifdef TASK_MANAGER_LTE
int const n_threads = parse_num_threads("n");
proc_rxtx->man = calloc(1, sizeof(task_manager_t));
assert(proc_rxtx->man != NULL && "Memory exhausted");
init_task_manager(proc_rxtx->man, n_threads);
#else
proc_rxtx->threadPool = (tpool_t *)malloc(sizeof(tpool_t));
initTpool("n", proc_rxtx->threadPool, true);
#endif
proc_rxtx->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(proc_rxtx->respDecode);
......
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