Commit 1a42fa53 authored by Tsung-Yu Chan's avatar Tsung-Yu Chan Committed by Tsung Yu Chan

feat / parallelize LLR by symbol

parent 9127258a
...@@ -76,3 +76,22 @@ void nr_codeword_unscrambling(int16_t* llr, uint32_t size, uint8_t q, uint32_t N ...@@ -76,3 +76,22 @@ void nr_codeword_unscrambling(int16_t* llr, uint32_t size, uint8_t q, uint32_t N
} }
#endif #endif
} }
void nr_codeword_unscrambling_init(int16_t *s2, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI)
{
uint32_t x1;
uint32_t x2 = (n_RNTI << 15) + (q << 14) + Nid;
uint32_t s = 0;
uint8_t *s8=(uint8_t *)&s;
s = lte_gold_generic(&x1, &x2, 1);
simde__m128i *s128=(simde__m128i *)s2;
for (int i = 0, j = 0; i < ((size >> 5) + ((size & 0x1f) > 0 ? 1 : 0)); i++, j += 4) {
s128[j] = byte2m128i[s8[0]];
s128[j+1] = byte2m128i[s8[1]];
s128[j+2] = byte2m128i[s8[2]];
s128[j+3] = byte2m128i[s8[3]];
s = lte_gold_generic(&x1, &x2, 0);
}
}
...@@ -73,6 +73,7 @@ void nr_codeword_scrambling(uint8_t *in, ...@@ -73,6 +73,7 @@ void nr_codeword_scrambling(uint8_t *in,
uint32_t* out); uint32_t* out);
void nr_codeword_unscrambling(int16_t* llr, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI); void nr_codeword_unscrambling(int16_t* llr, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI);
void nr_codeword_unscrambling_init(int16_t *s, uint32_t size, uint8_t q, uint32_t Nid, uint32_t n_RNTI);
/**@}*/ /**@}*/
......
...@@ -131,6 +131,12 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -131,6 +131,12 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
uint8_t slot, uint8_t slot,
unsigned char harq_pid); unsigned char harq_pid);
int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
uint8_t ulsch_id,
uint32_t frame,
uint8_t slot,
unsigned char harq_pid);
/** \brief This function performs RB extraction (signal and channel estimates) (currently signal only until channel estimation and compensation are implemented) /** \brief This function performs RB extraction (signal and channel estimates) (currently signal only until channel estimation and compensation are implemented)
@param rxdataF pointer to the received frequency domain signal @param rxdataF pointer to the received frequency domain signal
@param rxdataF_ext pointer to the extracted frequency domain signal @param rxdataF_ext pointer to the extracted frequency domain signal
...@@ -209,6 +215,24 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, ...@@ -209,6 +215,24 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
*/ */
void nr_idft(int32_t *z, uint32_t Msc_PUSCH); void nr_idft(int32_t *z, uint32_t Msc_PUSCH);
void nr_ulsch_qpsk_qpsk(c16_t *stream0_in, c16_t *stream1_in, c16_t *stream0_out, c16_t *rho01, uint32_t length);
void nr_ulsch_qam16_qam16(c16_t *stream0_in,
c16_t *stream1_in,
c16_t *ch_mag,
c16_t *ch_mag_i,
c16_t *stream0_out,
c16_t *rho01,
uint32_t length);
void nr_ulsch_qam64_qam64(c16_t *stream0_in,
c16_t *stream1_in,
c16_t *ch_mag,
c16_t *ch_mag_i,
c16_t *stream0_out,
c16_t *rho01,
uint32_t length);
/** \brief This function generates log-likelihood ratios (decoder input) for single-stream QPSK received waveforms. /** \brief This function generates log-likelihood ratios (decoder input) for single-stream QPSK received waveforms.
@param rxdataF_comp Compensated channel output @param rxdataF_comp Compensated channel output
@param ulsch_llr llr output @param ulsch_llr llr output
......
...@@ -409,8 +409,12 @@ typedef struct { ...@@ -409,8 +409,12 @@ typedef struct {
/// \brief Total RE count after DMRS/PTRS RE's are extracted from respective symbol. /// \brief Total RE count after DMRS/PTRS RE's are extracted from respective symbol.
/// - first index: ? [0...14] smybol per slot /// - first index: ? [0...14] smybol per slot
int16_t *ul_valid_re_per_slot; int16_t *ul_valid_re_per_slot;
/// \brief offset for llr corresponding to each symbol
int llr_offset[14];
/// flag to verify if channel level computation is done /// flag to verify if channel level computation is done
uint8_t cl_done; uint8_t cl_done;
/// flag to indicate if channel extraction is done
int extraction_done[14];
/// flag to indicate DTX on reception /// flag to indicate DTX on reception
int DTX; int DTX;
} NR_gNB_PUSCH; } NR_gNB_PUSCH;
...@@ -728,6 +732,8 @@ typedef struct PHY_VARS_gNB_s { ...@@ -728,6 +732,8 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t dlsch_segmentation_stats; time_stats_t dlsch_segmentation_stats;
time_stats_t rx_pusch_stats; time_stats_t rx_pusch_stats;
time_stats_t rx_pusch_init_stats;
time_stats_t rx_pusch_symbol_processing_stats;
time_stats_t ul_indication_stats; time_stats_t ul_indication_stats;
time_stats_t schedule_response_stats; time_stats_t schedule_response_stats;
time_stats_t ulsch_decoding_stats; time_stats_t ulsch_decoding_stats;
...@@ -754,6 +760,7 @@ typedef struct PHY_VARS_gNB_s { ...@@ -754,6 +760,7 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t rx_dft_stats; time_stats_t rx_dft_stats;
time_stats_t ulsch_freq_offset_estimation_stats; time_stats_t ulsch_freq_offset_estimation_stats;
*/ */
notifiedFIFO_t *respPuschSymb;
notifiedFIFO_t respDecode; notifiedFIFO_t respDecode;
notifiedFIFO_t resp_L1; notifiedFIFO_t resp_L1;
notifiedFIFO_t L1_tx_free; notifiedFIFO_t L1_tx_free;
...@@ -761,6 +768,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -761,6 +768,9 @@ typedef struct PHY_VARS_gNB_s {
notifiedFIFO_t L1_tx_out; notifiedFIFO_t L1_tx_out;
notifiedFIFO_t resp_RU_tx; notifiedFIFO_t resp_RU_tx;
tpool_t threadPool; tpool_t threadPool;
int nbSymb;
int use_pusch_tp;
int num_pusch_symbols_per_thread;
pthread_t L1_rx_thread; pthread_t L1_rx_thread;
int L1_rx_thread_core; int L1_rx_thread_core;
pthread_t L1_tx_thread; pthread_t L1_tx_thread;
...@@ -771,6 +781,31 @@ typedef struct PHY_VARS_gNB_s { ...@@ -771,6 +781,31 @@ typedef struct PHY_VARS_gNB_s {
rt_L1_profiling_t rt_L1_profiling; rt_L1_profiling_t rt_L1_profiling;
} PHY_VARS_gNB; } PHY_VARS_gNB;
typedef struct puschSymbolProc_s {
PHY_VARS_gNB *gNB;
NR_DL_FRAME_PARMS *frame_parms;
nfapi_nr_pusch_pdu_t *rel15_ul;
int ulsch_id;
int slot;
int startSymbol;
int numSymbols;
int16_t *llr;
int16_t **llr_layers;
int16_t *s;
} puschSymbolProc_t;
struct puschSymbolReqId {
uint16_t ulsch_id;
uint16_t frame;
uint8_t slot;
uint16_t spare;
} __attribute__((packed));
union puschSymbolReqUnion {
struct puschSymbolReqId s;
uint64_t p;
};
typedef struct LDPCDecode_s { typedef struct LDPCDecode_s {
PHY_VARS_gNB *gNB; PHY_VARS_gNB *gNB;
NR_UL_gNB_HARQ_t *ulsch_harq; NR_UL_gNB_HARQ_t *ulsch_harq;
......
...@@ -398,18 +398,21 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ...@@ -398,18 +398,21 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int
pusch_pdu->qam_mod_order, pusch_pdu->qam_mod_order,
pusch_pdu->nrOfLayers); pusch_pdu->nrOfLayers);
nr_ulsch_layer_demapping(gNB->pusch_vars[ULSCH_id].llr, if (gNB->use_pusch_tp == 0 )
pusch_pdu->nrOfLayers, {
pusch_pdu->qam_mod_order, nr_ulsch_layer_demapping(gNB->pusch_vars[ULSCH_id].llr,
G, pusch_pdu->nrOfLayers,
gNB->pusch_vars[ULSCH_id].llr_layers); pusch_pdu->qam_mod_order,
G,
//---------------------------------------------------------- gNB->pusch_vars[ULSCH_id].llr_layers);
//------------------- ULSCH unscrambling ------------------- //----------------------------------------------------------
//---------------------------------------------------------- //------------------- ULSCH unscrambling -------------------
start_meas(&gNB->ulsch_unscrambling_stats); //----------------------------------------------------------
nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id].llr, G, pusch_pdu->data_scrambling_id, pusch_pdu->rnti); start_meas(&gNB->ulsch_unscrambling_stats);
stop_meas(&gNB->ulsch_unscrambling_stats); nr_ulsch_unscrambling(gNB->pusch_vars[ULSCH_id].llr, G, pusch_pdu->data_scrambling_id, pusch_pdu->rnti);
stop_meas(&gNB->ulsch_unscrambling_stats);
}
//---------------------------------------------------------- //----------------------------------------------------------
//--------------------- ULSCH decoding --------------------- //--------------------- ULSCH decoding ---------------------
//---------------------------------------------------------- //----------------------------------------------------------
...@@ -417,7 +420,7 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ...@@ -417,7 +420,7 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int
start_meas(&gNB->ulsch_decoding_stats); start_meas(&gNB->ulsch_decoding_stats);
int nbDecode = int nbDecode =
nr_ulsch_decoding(gNB, ULSCH_id, gNB->pusch_vars[ULSCH_id].llr, frame_parms, pusch_pdu, frame_rx, slot_rx, harq_pid, G); nr_ulsch_decoding(gNB, ULSCH_id, gNB->pusch_vars[ULSCH_id].llr, frame_parms, pusch_pdu, frame_rx, slot_rx, harq_pid, G);
stop_meas(&gNB->ulsch_decoding_stats);
return nbDecode; return nbDecode;
} }
...@@ -899,7 +902,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -899,7 +902,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH, 1);
start_meas(&gNB->rx_pusch_stats); start_meas(&gNB->rx_pusch_stats);
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid); if (gNB->use_pusch_tp) nr_rx_pusch_tp(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid);
else nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid);
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ULSCH_id]; NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ULSCH_id];
pusch_vars->ulsch_power_tot = 0; pusch_vars->ulsch_power_tot = 0;
pusch_vars->ulsch_noise_power_tot = 0; pusch_vars->ulsch_noise_power_tot = 0;
...@@ -962,6 +966,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -962,6 +966,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
totalDecode--; totalDecode--;
} }
stop_meas(&gNB->ulsch_decoding_stats);
} }
for (int i = 0; i < gNB->max_nb_srs; i++) { for (int i = 0; i < gNB->max_nb_srs; i++) {
NR_gNB_SRS_t *srs = &gNB->srs[i]; NR_gNB_SRS_t *srs = &gNB->srs[i];
......
...@@ -222,6 +222,7 @@ int main(int argc, char *argv[]) ...@@ -222,6 +222,7 @@ int main(int argc, char *argv[])
int ibwp_rboffset=41; int ibwp_rboffset=41;
int params_from_file = 0; int params_from_file = 0;
int threadCnt=0; int threadCnt=0;
int use_tpool = 0;
int max_ldpc_iterations = 5; int max_ldpc_iterations = 5;
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) { if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) {
exit_fun("[NR_ULSIM] Error, configuration module init failed\n"); exit_fun("[NR_ULSIM] Error, configuration module init failed\n");
...@@ -363,6 +364,7 @@ int main(int argc, char *argv[]) ...@@ -363,6 +364,7 @@ int main(int argc, char *argv[])
case 'C': case 'C':
threadCnt = atoi(optarg); threadCnt = atoi(optarg);
use_tpool = 1;
break; break;
case 'u': case 'u':
...@@ -562,9 +564,13 @@ int main(int argc, char *argv[]) ...@@ -562,9 +564,13 @@ int main(int argc, char *argv[])
gNB = RC.gNB[0]; gNB = RC.gNB[0];
gNB->ofdm_offset_divisor = UINT_MAX; gNB->ofdm_offset_divisor = UINT_MAX;
initNotifiedFIFO(&gNB->respDecode); initNotifiedFIFO(&gNB->respDecode);
gNB->use_pusch_tp = use_tpool;
gNB->num_pusch_symbols_per_thread = 1;
initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool"); initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool");
initNotifiedFIFO(&gNB->respDecode); initNotifiedFIFO(&gNB->respDecode);
gNB->respPuschSymb = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(gNB->respPuschSymb);
initNotifiedFIFO(&gNB->L1_tx_free); initNotifiedFIFO(&gNB->L1_tx_free);
initNotifiedFIFO(&gNB->L1_tx_filled); initNotifiedFIFO(&gNB->L1_tx_filled);
initNotifiedFIFO(&gNB->L1_tx_out); initNotifiedFIFO(&gNB->L1_tx_out);
...@@ -927,6 +933,8 @@ int main(int argc, char *argv[]) ...@@ -927,6 +933,8 @@ int main(int argc, char *argv[])
roundStats = 0; roundStats = 0;
reset_meas(&gNB->phy_proc_rx); reset_meas(&gNB->phy_proc_rx);
reset_meas(&gNB->rx_pusch_stats); reset_meas(&gNB->rx_pusch_stats);
reset_meas(&gNB->rx_pusch_init_stats);
reset_meas(&gNB->rx_pusch_symbol_processing_stats);
reset_meas(&gNB->ulsch_decoding_stats); reset_meas(&gNB->ulsch_decoding_stats);
reset_meas(&gNB->ulsch_deinterleaving_stats); reset_meas(&gNB->ulsch_deinterleaving_stats);
reset_meas(&gNB->ulsch_rate_unmatching_stats); reset_meas(&gNB->ulsch_rate_unmatching_stats);
...@@ -1588,25 +1596,36 @@ int main(int argc, char *argv[]) ...@@ -1588,25 +1596,36 @@ int main(int argc, char *argv[])
dump_pusch_stats(fd,gNB); dump_pusch_stats(fd,gNB);
fclose(fd); fclose(fd);
if (print_perf==1) { if (print_perf==1)
{
printf("gNB RX\n");
printDistribution(&gNB->phy_proc_rx,table_rx,"Total PHY proc rx"); printDistribution(&gNB->phy_proc_rx,table_rx,"Total PHY proc rx");
printStatIndent(&gNB->rx_pusch_stats,"RX PUSCH time"); printStatIndent(&gNB->rx_pusch_stats,"RX PUSCH time");
printStatIndent2(&gNB->ulsch_channel_estimation_stats,"ULSCH channel estimation time"); printStatIndent2(&gNB->ulsch_channel_estimation_stats,"ULSCH channel estimation time");
printStatIndent2(&gNB->ulsch_ptrs_processing_stats,"ULSCH PTRS Processing time"); if (use_tpool == 1)
printStatIndent2(&gNB->ulsch_rbs_extraction_stats,"ULSCH rbs extraction time"); {
printStatIndent2(&gNB->ulsch_channel_compensation_stats,"ULSCH channel compensation time"); printStatIndent2(&gNB->rx_pusch_init_stats,"RX PUSCH Initialization time");
printStatIndent2(&gNB->ulsch_mrc_stats,"ULSCH mrc computation"); printStatIndent2(&gNB->rx_pusch_symbol_processing_stats,"RX PUSCH Symbol Processing time");
printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation"); }
printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling"); else
{
printStatIndent2(&gNB->ulsch_ptrs_processing_stats,"ULSCH PTRS Processing time");
printStatIndent2(&gNB->ulsch_rbs_extraction_stats,"ULSCH rbs extraction time");
printStatIndent2(&gNB->ulsch_channel_compensation_stats,"ULSCH channel compensation time");
printStatIndent2(&gNB->ulsch_mrc_stats,"ULSCH mrc computation");
printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation");
printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling");
}
printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time"); printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time");
// printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving");
// printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx");
// printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding");
printf("\nUE TX\n");
printStatIndent(&UE->ulsch_encoding_stats,"ULSCH total encoding time"); printStatIndent(&UE->ulsch_encoding_stats,"ULSCH total encoding time");
printStatIndent2(&UE->ulsch_segmentation_stats,"ULSCH segmentation time"); printStatIndent2(&UE->ulsch_segmentation_stats,"ULSCH segmentation time");
printStatIndent2(&UE->ulsch_ldpc_encoding_stats,"ULSCH LDPC encoder time"); printStatIndent2(&UE->ulsch_ldpc_encoding_stats,"ULSCH LDPC encoder time");
printStatIndent2(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time"); printStatIndent2(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time");
printStatIndent2(&UE->ulsch_interleaving_stats,"ULSCH interleaving time"); printStatIndent2(&UE->ulsch_interleaving_stats,"ULSCH interleaving time");
//printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving");
//printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx");
//printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding");
printStatIndent(&gNB->rx_srs_stats,"RX SRS time"); printStatIndent(&gNB->rx_srs_stats,"RX SRS time");
printStatIndent2(&gNB->generate_srs_stats,"Generate SRS sequence time"); printStatIndent2(&gNB->generate_srs_stats,"Generate SRS sequence time");
printStatIndent2(&gNB->get_srs_signal_stats,"Get SRS signal time"); printStatIndent2(&gNB->get_srs_signal_stats,"Get SRS signal time");
......
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