diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 43e86ad71c..2a683147df 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1193,9 +1193,9 @@ void *ru_stats_thread(void *param) { if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx (all ports)",NULL,NULL); if (ru->feptx_ofdm) { - print_meas(&ru->precoding_stats,"feptx_prec (per port)",NULL,NULL); + print_meas(&ru->precoding_stats,(ru->half_slot_parallelization==0)?"feptx_prec (per port)":"feptx_prec (per port, half_slot)",NULL,NULL); + print_meas(&ru->ofdm_mod_stats,(ru->half_slot_parallelization==0)?"feptx_ofdm (per port)":"feptx_ofdm (per port, half_slot)",NULL,NULL); print_meas(&ru->txdataF_copy_stats,"txdataF_copy",NULL,NULL); - print_meas(&ru->ofdm_mod_stats,"feptx_ofdm (per port)",NULL,NULL); print_meas(&ru->ofdm_total_stats,"feptx_total",NULL,NULL); } print_meas(&ru->rx_fhaul,"rx_fhaul",NULL,NULL); @@ -1560,7 +1560,6 @@ void init_RU_proc(RU_t *ru) { proc->frame_offset = 0; proc->num_slaves = 0; proc->frame_tx_unwrap = 0; - proc->feptx_mask = 0; for (i=0; i<10; i++) proc->symbol_mask[i]=0; @@ -2177,6 +2176,8 @@ static void NRRCconfig_RU(void) { RC.ru[j]->openair0_cfg.rxfh_cores[0] = *(RUParamList.paramarray[j][RU_RXFH_CORE_ID].iptr); RC.ru[j]->openair0_cfg.txfh_cores[0] = *(RUParamList.paramarray[j][RU_TXFH_CORE_ID].iptr); RC.ru[j]->num_tpcores = *(RUParamList.paramarray[j][RU_NUM_TP_CORES].iptr); + RC.ru[j]->half_slot_parallelization = *(RUParamList.paramarray[j][RU_HALF_SLOT_PARALLELIZATION].iptr); + printf("[RU %d] Setting half-slot parallelization to %d\n",j,RC.ru[j]->half_slot_parallelization); AssertFatal(RC.ru[j]->num_tpcores <= RUParamList.paramarray[j][RU_TP_CORES].numelt, "Number of TP cores should be <=16\n"); for (i=0; inum_tpcores; i++) RC.ru[j]->tpcores[i] = RUParamList.paramarray[j][RU_TP_CORES].iptr[i]; if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) { diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 86016288ed..627ad7d27f 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -170,31 +170,11 @@ typedef struct RU_prec_t_s{ int index; } RU_prec_t; -typedef struct RU_feptx_t_s{ - /// \internal This variable is protected by \ref mutex_feptx_prec - int instance_cnt_feptx; - /// pthread struct for RU TX FEP PREC worker thread - pthread_t pthread_feptx; - /// pthread attributes for worker feptx prec thread - pthread_attr_t attr_feptx; - /// condition varible for RU TX FEP PREC thread - pthread_cond_t cond_feptx; - /// mutex for fep PREC TX worker thread - pthread_mutex_t mutex_feptx; - struct RU_t_s *ru; - int aa;//physical MAX nb_tx - int half_slot;//first or second half of a slot - int slot;//current slot - int symbol;//current symbol - int nb_antenna_ports;//number of logical port - int index; -}RU_feptx_t; - typedef struct { int aid; struct RU_t_s *ru; - int start_symbol; - int end_symbol; + int startSymbol; + int endSymbol; int slot; } feprx_cmd_t; @@ -202,6 +182,8 @@ typedef struct { int aid; struct RU_t_s *ru; int slot; + int startSymbol; + int numSymbols; } feptx_cmd_t; typedef struct { @@ -411,10 +393,6 @@ typedef struct RU_proc_t_s { /// structure for precoding thread RU_prec_t prec[16]; - /// structure for feptx thread - RU_feptx_t feptx[16]; - /// mask for checking process finished - int feptx_mask; } RU_proc_t; typedef enum { @@ -525,8 +503,10 @@ typedef struct RU_t_s { int sf_ahead; /// TX processing advance in slots (for NR) int sl_ahead; - /// flag to indicated TX FH is embedded in TX FEP + /// flag to indicate TX FH is embedded in TX FEP int txfh_in_fep; + /// flag to indicate half-slot parallelization + int half_slot_parallelization; /// FAPI confiuration nfapi_nr_config_request_scf_t config; /// Frame parameters diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 7648d3781c..d485238bc0 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -274,9 +274,13 @@ void nr_feptx(void *arg) { RU_t *ru = feptx->ru; int slot = feptx->slot; int aa = feptx->aid; + int startSymbol = feptx->startSymbol; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; + int numSymbols = feptx->numSymbols; + int numSamples = feptx->numSymbols*fp->ofdm_symbol_size; + int txdataF_offset = (slot*fp->samples_per_slot_wCP) + startSymbol*fp->ofdm_symbol_size; + int txdataF_BF_offset = startSymbol*fp->ofdm_symbol_size; - int txdataF_offset = (slot*fp->samples_per_slot_wCP); ////////////precoding//////////// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 1); @@ -291,17 +295,18 @@ void nr_feptx(void *arg) { } if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { - memcpy((void*)&ru->common.txdataF_BF[0][0], + memcpy((void*)&ru->common.txdataF_BF[0][txdataF_BF_offset], (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset], - (fp->samples_per_slot_wCP)*sizeof(int32_t)); + numSamples*sizeof(int32_t)); } else if (ru->do_precoding == 0) { int gNB_tx = ru->gNB_list[0]->frame_parms.nb_antennas_tx; - memcpy((void*)&ru->common.txdataF_BF[aa][0], + memcpy((void*)&ru->common.txdataF_BF[aa][txdataF_BF_offset], (void*)&ru->gNB_list[0]->common_vars.txdataF[aa%gNB_tx][txdataF_offset], - (fp->samples_per_slot_wCP)*sizeof(int32_t)); + numSamples*sizeof(int32_t)); } else { + AssertFatal(1==0,"This needs to be fixed, do not use beamforming.\n"); int32_t ***bw = ru->beam_weights[0]; for(int i=0; isymbols_per_slot; ++i){ nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, @@ -319,7 +324,7 @@ void nr_feptx(void *arg) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 0); ////////////FEPTX//////////// - nr_feptx0(ru,slot,0,fp->symbols_per_slot,aa); + nr_feptx0(ru,slot,startSymbol,numSymbols,aa); } // RU FEP TX using thread-pool @@ -338,8 +343,21 @@ void nr_feptx_tp(RU_t *ru, int frame_tx, int slot) { 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; pushTpool(ru->threadPool,req); 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); + feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req); + 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; + pushTpool(ru->threadPool,req); + nbfeptx++; + } } while (nbfeptx>0) { notifiedFIFO_elt_t *req=pullTpool(ru->respfeptx, ru->threadPool); @@ -358,15 +376,16 @@ void nr_fep(void* arg) { RU_t *ru = feprx_cmd->ru; int aid = feprx_cmd->aid; int tti_rx = feprx_cmd->slot; - + int startSymbol = feprx_cmd->startSymbol; + int endSymbol = feprx_cmd->endSymbol; NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - LOG_D(PHY,"In nr_fep for aid %d, slot = %d\n", aid, tti_rx); + LOG_D(PHY,"In nr_fep for aid %d, slot = %d, startSymbol %d, endSymbol %d\n", aid, tti_rx,startSymbol,endSymbol); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+aid, 1); int offset = (tti_rx&3) * fp->symbols_per_slot * fp->ofdm_symbol_size; - for (int l = 0; l < fp->symbols_per_slot; l++) + for (int l = startSymbol; l <= endSymbol; l++) nr_slot_fep_ul(fp, ru->common.rxdata[aid], &ru->common.rxdataF[aid][offset], @@ -388,8 +407,21 @@ void nr_fep_tp(RU_t *ru, int slot) { 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); pushTpool(ru->threadPool,req); nbfeprx++; + if (ru->half_slot_parallelization>0) { + 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); + 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; + pushTpool(ru->threadPool,req); + nbfeprx++; + } } while (nbfeprx>0) { notifiedFIFO_elt_t *req=pullTpool(ru->respfeprx, ru->threadPool); diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 456417e02c..1e04d03548 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -108,6 +108,7 @@ typedef enum { #define CONFIG_STRING_RU_TP_CORES "tp_cores" #define CONFIG_STRING_RU_NUM_TP_CORES "num_tp_cores" #define CONFIG_STRING_RU_NUM_INTERFACES "num_interfaces" +#define CONFIG_STRING_RU_HALF_SLOT_PARALLELIZATION "half_slot_parallelization" #define HLP_RU_SF_AHEAD "LTE TX processing advance" #define HLP_RU_SL_AHEAD "NR TX processing advance" @@ -118,6 +119,7 @@ typedef enum { #define HLP_RU_TP_CORES "List of cores for RU ThreadPool" #define HLP_RU_NUM_TP_CORES "Number of cores for RU ThreadPool" #define HLP_RU_NUM_INTERFACES "Number of network interfaces for RU" +#define HLP_RU_HALF_SLOT_PARALLELIZATION "run half slots in parallel in RU FEP" #define RU_LOCAL_IF_NAME_IDX 0 #define RU_LOCAL_ADDRESS_IDX 1 @@ -157,6 +159,7 @@ typedef enum { #define RU_TP_CORES 35 #define RU_NUM_TP_CORES 36 #define RU_NUM_INTERFACES 37 +#define RU_HALF_SLOT_PARALLELIZATION 38 /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* RU configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -199,7 +202,8 @@ typedef enum { {CONFIG_STRING_RU_TXFH_CORE_ID, HLP_RU_TXFH_CORE_ID, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ {CONFIG_STRING_RU_TP_CORES, HLP_RU_TP_CORES, 0, uptr:NULL, defintarrayval:DEFRUTPCORES, TYPE_INTARRAY, 8}, \ {CONFIG_STRING_RU_NUM_TP_CORES, HLP_RU_NUM_TP_CORES, 0, uptr:NULL, defintval:4, TYPE_UINT, 0}, \ - {CONFIG_STRING_RU_NUM_INTERFACES HLP_RU_NUM_INTERFACES, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ + {CONFIG_STRING_RU_NUM_INTERFACES, HLP_RU_NUM_INTERFACES, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ + {CONFIG_STRING_RU_HALF_SLOT_PARALLELIZATION, HLP_RU_HALF_SLOT_PARALLELIZATION, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ } /*---------------------------------------------------------------------------------------------------------------------------------------*/