Commit d8eed492 authored by mir's avatar mir

TASK_MANAGER_UE_DECODING RF Sim decoding working

parent b031fd3f
...@@ -590,7 +590,7 @@ void completed_task_ans(task_ans_t* task) ...@@ -590,7 +590,7 @@ void completed_task_ans(task_ans_t* task)
// //
void join_task_ans(task_ans_t* arr, size_t len) void join_task_ans(task_ans_t* arr, size_t len)
{ {
assert(len > 0); //assert(len > 0);
assert(arr != NULL); assert(arr != NULL);
// We are believing Fedor // We are believing Fedor
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#define TASK_MANAGER_RU #define TASK_MANAGER_RU
//#define TASK_MANAGER_UE //#define TASK_MANAGER_UE
//#define TASK_MANAGER_UE_DECODING #define TASK_MANAGER_UE_DECODING
//#define TASK_MANAGER_SIM //#define TASK_MANAGER_SIM
//#define TASK_MANAGER_LTE //#define TASK_MANAGER_LTE
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "common/ran_context.h" #include "common/ran_context.h"
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
//#include "common/utils/threadPool/thread-pool.h" //#include "common/utils/threadPool/thread-pool.h"
#include "common/utils/thread_pool/task_manager.h"
#include "common/utils/load_module_shlib.h" #include "common/utils/load_module_shlib.h"
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
...@@ -89,6 +90,8 @@ unsigned short config_frames[4] = {2,9,11,13}; ...@@ -89,6 +90,8 @@ unsigned short config_frames[4] = {2,9,11,13};
extern const char *duplex_mode[]; extern const char *duplex_mode[];
THREAD_STRUCT thread_struct; THREAD_STRUCT thread_struct;
static
nrUE_params_t nrUE_params; nrUE_params_t nrUE_params;
// Thread variables // Thread variables
...@@ -485,6 +488,11 @@ int main(int argc, char **argv) ...@@ -485,6 +488,11 @@ int main(int argc, char **argv)
#if T_TRACER #if T_TRACER
T_Config_Init(); T_Config_Init();
#endif #endif
#if defined TASK_MANAGER_UE_DECODING
int const num_threads = parse_num_threads(get_softmodem_params()->threadPoolConfig);
init_task_manager(&nrUE_params.man, num_threads);
#endif
initTpool(get_softmodem_params()->threadPoolConfig, &(nrUE_params.Tpool), cpumeas(CPUMEAS_GETSTATE)); initTpool(get_softmodem_params()->threadPoolConfig, &(nrUE_params.Tpool), cpumeas(CPUMEAS_GETSTATE));
//randominit (0); //randominit (0);
set_taus_seed (0); set_taus_seed (0);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <executables/softmodem-common.h> #include <executables/softmodem-common.h>
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h" #include "SIMULATION/ETH_TRANSPORT/proto.h"
#include "common/utils/thread_pool/task_manager.h"
#define CONFIG_HLP_IF_FREQ "IF frequency for RF, if needed\n" #define CONFIG_HLP_IF_FREQ "IF frequency for RF, if needed\n"
...@@ -70,6 +70,9 @@ typedef struct { ...@@ -70,6 +70,9 @@ typedef struct {
uint64_t optmask; //mask to store boolean config options uint64_t optmask; //mask to store boolean config options
uint32_t ofdm_offset_divisor; // Divisor for sample offset computation for each OFDM symbol uint32_t ofdm_offset_divisor; // Divisor for sample offset computation for each OFDM symbol
int max_ldpc_iterations; // number of maximum LDPC iterations int max_ldpc_iterations; // number of maximum LDPC iterations
#ifdef TASK_MANAGER_UE_DECODING
task_manager_t man;
#endif
tpool_t Tpool; // thread pool tpool_t Tpool; // thread pool
int UE_scan_carrier; int UE_scan_carrier;
int UE_fo_compensation; int UE_fo_compensation;
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#include "PHY/CODING/nrLDPC_extern.h" #include "PHY/CODING/nrLDPC_extern.h"
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
#include "openair1/PHY/TOOLS/phy_scope_interface.h" #include "openair1/PHY/TOOLS/phy_scope_interface.h"
#include "common/utils/thread_pool/task_manager.h"
//#define ENABLE_PHY_PAYLOAD_DEBUG 1 //#define ENABLE_PHY_PAYLOAD_DEBUG 1
...@@ -70,6 +72,18 @@ void nr_dlsch_unscrambling(int16_t *llr, uint32_t size, uint8_t q, uint32_t Nid, ...@@ -70,6 +72,18 @@ void nr_dlsch_unscrambling(int16_t *llr, uint32_t size, uint8_t q, uint32_t Nid,
nr_codeword_unscrambling(llr, size, q, Nid, n_RNTI); nr_codeword_unscrambling(llr, size, q, Nid, n_RNTI);
} }
#ifdef TASK_MANAGER_UE_DECODING
static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue,
ldpcDecode_ue_t *rdata,
bool last,
int b_size,
uint8_t b[b_size],
int *num_seg_ok,
UE_nr_rxtx_proc_t *proc)
{
#else
static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue,
notifiedFIFO_elt_t *req, notifiedFIFO_elt_t *req,
notifiedFIFO_t *nf_p, notifiedFIFO_t *nf_p,
...@@ -80,6 +94,7 @@ static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -80,6 +94,7 @@ static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue,
const UE_nr_rxtx_proc_t *proc) const UE_nr_rxtx_proc_t *proc)
{ {
ldpcDecode_ue_t *rdata = (ldpcDecode_ue_t*) NotifiedFifoData(req); ldpcDecode_ue_t *rdata = (ldpcDecode_ue_t*) NotifiedFifoData(req);
#endif
NR_DL_UE_HARQ_t *harq_process = rdata->harq_process; NR_DL_UE_HARQ_t *harq_process = rdata->harq_process;
NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch; NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch;
int r = rdata->segment_r; int r = rdata->segment_r;
...@@ -220,6 +235,10 @@ static void nr_processDLSegment(void *arg) ...@@ -220,6 +235,10 @@ static void nr_processDLSegment(void *arg)
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
stop_meas(&rdata->ts_rate_unmatch); stop_meas(&rdata->ts_rate_unmatch);
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n"); LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
#ifdef TASK_MANAGER_UE_DECODING
completed_task_ans(rdata->ans);
#endif
return; return;
} }
stop_meas(&rdata->ts_rate_unmatch); stop_meas(&rdata->ts_rate_unmatch);
...@@ -261,6 +280,9 @@ static void nr_processDLSegment(void *arg) ...@@ -261,6 +280,9 @@ static void nr_processDLSegment(void *arg)
memcpy(harq_process->c[r], LDPCoutput, Kr >> 3); memcpy(harq_process->c[r], LDPCoutput, Kr >> 3);
stop_meas(&rdata->ts_ldpc_decode); stop_meas(&rdata->ts_ldpc_decode);
} }
#ifdef TASK_MANAGER_UE_DECODING
completed_task_ans(rdata->ans);
#endif
} }
uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
...@@ -399,14 +421,26 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -399,14 +421,26 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
notifiedFIFO_t nf; notifiedFIFO_t nf;
initNotifiedFIFO(&nf); initNotifiedFIFO(&nf);
set_abort(&harq_process->abort_decode, false); set_abort(&harq_process->abort_decode, false);
#ifdef TASK_MANAGER_UE_DECODING
assert(harq_process->C < 64 && "Increase values of the arrays that follow");
ldpcDecode_ue_t arr[64] = {0};
task_ans_t ans[64] = {0};
//memset(ans, 0, harq_process->C*sizeof(task_ans_t));
#endif
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
//printf("start rx segment %d\n",r); //printf("start rx segment %d\n",r);
uint32_t E = nr_get_E(G, harq_process->C, dlsch->dlsch_config.qamModOrder, dlsch->Nl, r); uint32_t E = nr_get_E(G, harq_process->C, dlsch->dlsch_config.qamModOrder, dlsch->Nl, r);
decParams.R = nr_get_R_ldpc_decoder(dlsch->dlsch_config.rv, E, decParams.BG, decParams.Z, &harq_process->llrLen, harq_process->DLround); decParams.R = nr_get_R_ldpc_decoder(dlsch->dlsch_config.rv, E, decParams.BG, decParams.Z, &harq_process->llrLen, harq_process->DLround);
#ifdef TASK_MANAGER_UE_DECODING
ldpcDecode_ue_t* rdata = &arr[r];
rdata->ans = &ans[r];
#else
union ldpcReqUnion id = {.s={dlsch->rnti,frame,nr_slot_rx,0,0}}; union ldpcReqUnion id = {.s={dlsch->rnti,frame,nr_slot_rx,0,0}};
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_ue_t), id.p, &nf, &nr_processDLSegment); notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_ue_t), id.p, &nf, &nr_processDLSegment);
ldpcDecode_ue_t * rdata=(ldpcDecode_ue_t *) NotifiedFifoData(req); ldpcDecode_ue_t * rdata=(ldpcDecode_ue_t *) NotifiedFifoData(req);
#endif
rdata->phy_vars_ue = phy_vars_ue; rdata->phy_vars_ue = phy_vars_ue;
rdata->harq_process = harq_process; rdata->harq_process = harq_process;
rdata->decoderParms = decParams; rdata->decoderParms = decParams;
...@@ -429,7 +463,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -429,7 +463,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
reset_meas(&rdata->ts_deinterleave); reset_meas(&rdata->ts_deinterleave);
reset_meas(&rdata->ts_rate_unmatch); reset_meas(&rdata->ts_rate_unmatch);
reset_meas(&rdata->ts_ldpc_decode); reset_meas(&rdata->ts_ldpc_decode);
#ifdef TASK_MANAGER_UE_DECODING
task_t t = {.args = rdata, .func = nr_processDLSegment };
async_task_manager(&get_nrUE_params()->man, t);
#else
pushTpool(&get_nrUE_params()->Tpool,req); pushTpool(&get_nrUE_params()->Tpool,req);
#endif
LOG_D(PHY, "Added a block to decode, in pipe: %d\n", r); LOG_D(PHY, "Added a block to decode, in pipe: %d\n", r);
r_offset += E; r_offset += E;
offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0));
...@@ -437,6 +476,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -437,6 +476,14 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
} }
int num_seg_ok = 0; int num_seg_ok = 0;
int nbDecode = harq_process->C; int nbDecode = harq_process->C;
#ifdef TASK_MANAGER_UE_DECODING
if(nbDecode > 0){
join_task_ans(ans, nbDecode);
for(size_t i = 0; i < nbDecode; ++i){
nr_ue_postDecode(phy_vars_ue, &arr[i], nbDecode == 1, b_size, b, &num_seg_ok, proc);
}
}
#else
while (nbDecode) { while (nbDecode) {
notifiedFIFO_elt_t *req=pullTpool(&nf, &get_nrUE_params()->Tpool); notifiedFIFO_elt_t *req=pullTpool(&nf, &get_nrUE_params()->Tpool);
if (req == NULL) if (req == NULL)
...@@ -445,6 +492,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -445,6 +492,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
nbDecode--; nbDecode--;
} }
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_COMBINE_SEG, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_COMBINE_SEG, VCD_FUNCTION_OUT);
ret = dlsch->last_iteration_cnt; ret = dlsch->last_iteration_cnt;
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "common_lib.h" #include "common_lib.h"
#include "fapi_nr_ue_interface.h" #include "fapi_nr_ue_interface.h"
#include "assertions.h" #include "assertions.h"
#include "common/utils/thread_pool/task_manager.h"
#ifdef MEX #ifdef MEX
#define msg mexPrintf #define msg mexPrintf
...@@ -674,6 +675,9 @@ typedef struct LDPCDecode_ue_s { ...@@ -674,6 +675,9 @@ typedef struct LDPCDecode_ue_s {
time_stats_t ts_rate_unmatch; time_stats_t ts_rate_unmatch;
time_stats_t ts_ldpc_decode; time_stats_t ts_ldpc_decode;
UE_nr_rxtx_proc_t proc; UE_nr_rxtx_proc_t proc;
#ifdef TASK_MANAGER_UE_DECODING
task_ans_t* ans;
#endif
} ldpcDecode_ue_t; } ldpcDecode_ue_t;
#include "SIMULATION/ETH_TRANSPORT/defs.h" #include "SIMULATION/ETH_TRANSPORT/defs.h"
......
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