Commit f260ab7d authored by Robert Schmidt's avatar Robert Schmidt

Avoid memcpy for txdataF_BF if no precoding

In order to speed up processing if precoding is disabled, we just copy
the pointer from txdataF to txdataF_BF, as opposed to do a full memcpy()
to duplicate the data. The same happens if we cannot have precoding,
i.e., in SISO.

Handle the case of precoding in allocation of the txdataF_BF structure
accordingly.
parent ee6e19b0
...@@ -192,8 +192,14 @@ void nr_phy_free_RU(RU_t *ru) ...@@ -192,8 +192,14 @@ void nr_phy_free_RU(RU_t *ru)
free_and_zero(ru->common.txdataF); free_and_zero(ru->common.txdataF);
// free IFFT input buffers (TX) // free IFFT input buffers (TX)
// nr_feptx_prec(): if no precoding, it just copies pointers instead of memory
// note that we still allocate that memory in nr_phy_init_RU(), otherwise
// we cannot execute in the first iteration because XYZ
bool no_precoding = ru->do_precoding == 0 || (ru->nb_tx == 1 && ru->nb_log_antennas == 1);
if (!no_precoding) {
for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF_BF[i]); for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF_BF[i]);
free_and_zero(ru->common.txdataF_BF); free_and_zero(ru->common.txdataF_BF);
}
// free FFT output buffers (RX) // free FFT output buffers (RX)
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdataF[i]); for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdataF[i]);
......
...@@ -188,27 +188,19 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -188,27 +188,19 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) {
if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT) return; if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT) return;
if (ru->do_precoding == 0 || (ru->nb_tx == 1 && ru->nb_log_antennas == 1)) {
for (i = 0; i < ru->nb_log_antennas; ++i)
ru->common.txdataF_BF[i] = (int32_t *)&gNB->common_vars.txdataF[i][txdataF_offset];
}
else {
for(i=0; i<ru->nb_log_antennas; ++i) { for(i=0; i<ru->nb_log_antennas; ++i) {
memcpy((void*)ru->common.txdataF[i], memcpy((void*)ru->common.txdataF[i],
(void*)&gNB->common_vars.txdataF[i][txdataF_offset], (void*)&gNB->common_vars.txdataF[i][txdataF_offset],
fp->samples_per_slot_wCP*sizeof(int32_t)); fp->samples_per_slot_wCP*sizeof(int32_t));
if (ru->do_precoding == 1)
memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot], memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot],
(void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot], (void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot],
fp->symbols_per_slot*sizeof(uint8_t)); fp->symbols_per_slot*sizeof(uint8_t));
} }
if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1);
memcpy((void*)ru->common.txdataF_BF[0],
(void*)ru->common.txdataF[0],
fp->samples_per_slot_wCP*sizeof(int32_t));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0);
}// if (ru->nb_tx == 1)
else {
bw = ru->beam_weights[0]; bw = ru->beam_weights[0];
for (l=0;l<fp->symbols_per_slot;l++) { for (l=0;l<fp->symbols_per_slot;l++) {
for (aa=0;aa<ru->nb_tx;aa++) { for (aa=0;aa<ru->nb_tx;aa++) {
...@@ -223,7 +215,7 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { ...@@ -223,7 +215,7 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) {
0); 0);
}// for (aa=0;aa<ru->nb_tx;aa++) }// for (aa=0;aa<ru->nb_tx;aa++)
}// for (l=0;l<fp->symbols_per_slot;l++) }// for (l=0;l<fp->symbols_per_slot;l++)
}// if (ru->nb_tx == 1) }// ru->do_precoding
}// if (ru->num_gNB == 1) }// if (ru->num_gNB == 1)
stop_meas(&ru->precoding_stats); stop_meas(&ru->precoding_stats);
} }
......
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