From b9a216d79a70ea100773cf3ac008d00abb09bbc6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 16 Dec 2021 13:54:00 +0100 Subject: [PATCH] Take timing measurements for UL DLSCH decoding steps - Measure time of deinterleaving, rate unmatching, and LDPC decoding of DLSCH decoding - Add merge_meas() function to merge measurements into one - Rename time meas variables with "turbo" to "ldpc" --- .../utils/telnetsrv/telnetsrv_cpumeasur_def.h | 6 +-- executables/nr-ue.c | 3 ++ .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 45 +++++++------------ openair1/PHY/TOOLS/time_meas.h | 10 +++++ openair1/PHY/defs_nr_UE.h | 8 ++-- 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h index 7dd643ef08..ed8b5e2301 100644 --- a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h +++ b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h @@ -112,7 +112,7 @@ {"ulsch_modulation_stats", &(UE->ulsch_modulation_stats),0,1},\ {"ulsch_segmentation_stats", &(UE->ulsch_segmentation_stats),0,1},\ {"ulsch_rate_matching_stats", &(UE->ulsch_rate_matching_stats),0,1},\ - {"ulsch_turbo_encoding_stats", &(UE->ulsch_turbo_encoding_stats),0,1},\ + {"ulsch_ldpc_encoding_stats", &(UE->ulsch_ldpc_encoding_stats),0,1},\ {"ulsch_interleaving_stats", &(UE->ulsch_interleaving_stats),0,1},\ {"ulsch_multiplexing_stats", &(UE->ulsch_multiplexing_stats),0,1},\ {"generic_stat", &(UE->generic_stat),0,1},\ @@ -124,12 +124,12 @@ {"dlsch_f...timation_stats", &(UE->dlsch_freq_offset_estimation_stats),0,1},\ {"dlsch_demodulation_stats", &(UE->dlsch_demodulation_stats),0,1},\ {"dlsch_rate_unmatching_stats", &(UE->dlsch_rate_unmatching_stats),0,1},\ - {"dlsch_turbo_decoding_stats", &(UE->dlsch_turbo_decoding_stats),0,1},\ + {"dlsch_ldpc_decoding_stats", &(UE->dlsch_ldpc_decoding_stats),0,1},\ {"dlsch_deinterleaving_stats", &(UE->dlsch_deinterleaving_stats),0,1},\ {"dlsch_llr_stats", &(UE->dlsch_llr_stats),0,1},\ {"dlsch_unscrambling_stats", &(UE->dlsch_unscrambling_stats),0,1},\ {"dlsch_rate_matching_stats", &(UE->dlsch_rate_matching_stats),0,1},\ - {"dlsch_turbo_encoding_stats", &(UE->dlsch_turbo_encoding_stats),0,1},\ + {"dlsch_ldpc_encoding_stats", &(UE->dlsch_ldpc_encoding_stats),0,1},\ {"dlsch_interleaving_stats", &(UE->dlsch_interleaving_stats),0,1},\ {"dlsch_tc_init_stats", &(UE->dlsch_tc_init_stats),0,1},\ {"dlsch_tc_alpha_stats", &(UE->dlsch_tc_alpha_stats),0,1},\ diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 00076887a5..959b00db97 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -115,6 +115,9 @@ static int dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, int max_len) stroff += print_meas_log(&ue->rx_pdsch_stats, "PDSCH receiver", NULL, NULL, output + stroff); stroff += print_meas_log(&ue->dlsch_decoding_stats[0], "PDSCH decoding t0", NULL, NULL, output + stroff); stroff += print_meas_log(&ue->dlsch_decoding_stats[1], "PDSCH decoding t1", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_deinterleaving_stats, " -> Deinterleive", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_rate_unmatching_stats, " -> Rate Unmatch", NULL, NULL, output + stroff); + stroff += print_meas_log(&ue->dlsch_ldpc_decoding_stats, " -> LDPC Decode", NULL, NULL, output + stroff); stroff += print_meas_log(&ue->dlsch_unscrambling_stats, "PDSCH unscrambling", NULL, NULL, output + stroff); stroff += print_meas_log(&ue->dlsch_rx_pdcch_stats, "PDCCH handling", NULL, NULL, output + stroff); return stroff; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 95c451fa1a..bdac7dab8a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -233,6 +233,10 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch; int r = rdata->segment_r; + merge_meas(&phy_vars_ue->dlsch_deinterleaving_stats, &rdata->ts_deinterleave); + merge_meas(&phy_vars_ue->dlsch_rate_unmatching_stats, &rdata->ts_rate_unmatch); + merge_meas(&phy_vars_ue->dlsch_ldpc_decoding_stats, &rdata->ts_ldpc_decode); + bool decodeSuccess = (rdata->decodeIterations < (1+dlsch->max_ldpc_iterations)); if (decodeSuccess) { @@ -296,12 +300,6 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool void nr_processDLSegment(void* arg) { ldpcDecode_ue_t *rdata = (ldpcDecode_ue_t*) arg; NR_UE_DLSCH_t *dlsch = rdata->dlsch; -#if UE_TIMING_TRACE //TBD - PHY_VARS_NR_UE *phy_vars_ue = rdata->phy_vars_ue; - time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats; - time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats; - time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats; -#endif NR_DL_UE_HARQ_t *harq_process= rdata->harq_process; t_nrLDPC_dec_params *p_decoderParms = &rdata->decoderParms; int length_dec; @@ -341,21 +339,16 @@ void nr_processDLSegment(void* arg) { t_nrLDPC_procBuf **p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; -#if UE_TIMING_TRACE - start_meas(dlsch_deinterleaving_stats); -#endif + start_meas(&rdata->ts_deinterleave); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); nr_deinterleaving_ldpc(E, Qm, harq_process->w[r], // [hna] w is e dlsch_llr+r_offset); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT); -#if UE_TIMING_TRACE - stop_meas(dlsch_deinterleaving_stats); -#endif -#if UE_TIMING_TRACE - start_meas(dlsch_rate_unmatching_stats); -#endif + stop_meas(&rdata->ts_deinterleave); + + start_meas(&rdata->ts_rate_unmatch); /* LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,E %d, F %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", harq_pid,r, G,E,harq_process->F, Kr*3, @@ -380,17 +373,12 @@ void nr_processDLSegment(void* arg) { harq_process->F, Kr-harq_process->F-2*(p_decoderParms->Z))==-1) { //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT); -#if UE_TIMING_TRACE - stop_meas(dlsch_rate_unmatching_stats); -#endif + stop_meas(&rdata->ts_rate_unmatch); LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n"); rdata->decodeIterations = dlsch->max_ldpc_iterations + 1; - return; - } else { -#if UE_TIMING_TRACE - stop_meas(dlsch_rate_unmatching_stats); -#endif + return; } + stop_meas(&rdata->ts_rate_unmatch); r_offset += E; @@ -418,9 +406,7 @@ void nr_processDLSegment(void* arg) { } { -#if UE_TIMING_TRACE - start_meas(dlsch_turbo_decoding_stats); -#endif + start_meas(&rdata->ts_ldpc_decode); //set first 2*Z_c bits to zeros memset(&z[0],0,2*harq_process->Z*sizeof(int16_t)); //set Filler bits @@ -470,9 +456,7 @@ void nr_processDLSegment(void* arg) { harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; } -#if UE_TIMING_TRACE - stop_meas(dlsch_turbo_decoding_stats); -#endif + stop_meas(&rdata->ts_ldpc_decode); } } @@ -673,6 +657,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, rdata->offset = offset; rdata->dlsch = dlsch; rdata->dlsch_id = 0; + reset_meas(&rdata->ts_deinterleave); + reset_meas(&rdata->ts_rate_unmatch); + reset_meas(&rdata->ts_ldpc_decode); pushTpool(&(pool_dl),req); nbDecode++; LOG_D(PHY,"Added a block to decode, in pipe: %d\n",nbDecode); diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 56d8299470..77fbf3dbef 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -178,6 +178,16 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) { } } +static inline void merge_meas(time_stats_t *dst_ts, time_stats_t *src_ts) +{ + if (!opp_enabled) + return; + dst_ts->trials += src_ts->trials; + dst_ts->diff += src_ts->diff; + if (src_ts->max > dst_ts->max) + dst_ts->max = src_ts->max; +} + extern notifiedFIFO_t measur_fifo; #define CPUMEASUR_SECTION "cpumeasur" diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 6fd47048fe..8de7086d51 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -1014,7 +1014,6 @@ typedef struct { time_stats_t ulsch_modulation_stats; time_stats_t ulsch_segmentation_stats; time_stats_t ulsch_rate_matching_stats; - time_stats_t ulsch_turbo_encoding_stats; time_stats_t ulsch_interleaving_stats; time_stats_t ulsch_multiplexing_stats; @@ -1036,13 +1035,13 @@ typedef struct { time_stats_t dlsch_decoding_stats[2]; time_stats_t dlsch_demodulation_stats; time_stats_t dlsch_rate_unmatching_stats; - time_stats_t dlsch_turbo_decoding_stats; + time_stats_t dlsch_ldpc_decoding_stats; time_stats_t dlsch_deinterleaving_stats; time_stats_t dlsch_llr_stats; time_stats_t dlsch_llr_stats_parallelization[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; time_stats_t dlsch_unscrambling_stats; time_stats_t dlsch_rate_matching_stats; - time_stats_t dlsch_turbo_encoding_stats; + time_stats_t dlsch_ldpc_encoding_stats; time_stats_t dlsch_interleaving_stats; time_stats_t dlsch_tc_init_stats; time_stats_t dlsch_tc_alpha_stats; @@ -1101,6 +1100,9 @@ typedef struct LDPCDecode_ue_s { int offset; int Tbslbrm; int decodeIterations; + time_stats_t ts_deinterleave; + time_stats_t ts_rate_unmatch; + time_stats_t ts_ldpc_decode; } ldpcDecode_ue_t; #include "SIMULATION/ETH_TRANSPORT/defs.h"