Compare commits

..

2 Commits

Author SHA1 Message Date
Romain Beurdouche
d6fa878df0 feat(nrL1_stats): Reset every second 2026-04-27 15:08:44 +00:00
Romain Beurdouche
4275cfad2f fix(nrL1_stats): Do not start/stop/merge timers on mixed slots
When timers are started/stopped/merged on mixed slot,
the measured times are not homogeneous as the mixed slots are much
lighter than full UL/DL slots.
Then, to make the analysis of results easier,
we do not measure the mixed slots.
2026-04-27 15:05:59 +00:00
6 changed files with 147 additions and 53 deletions

View File

@@ -1,20 +0,0 @@
repos:
# Clang-Format: Ensures code style is consistent
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v22.1.3'
hooks:
- id: clang-format
# Cppcheck: Static analysis to find bugs
- repo: https://github.com/pocc/pre-commit-hooks
rev: 'v1.3.5'
hooks:
- id: cppcheck
# Basic sanity checks (trailing whitespace, end of file, etc.)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v6.0.0'
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: end-of-file-fixer

View File

@@ -95,7 +95,9 @@ static void tx_func(processingData_L1tx_t *info)
// TODO check for analog_bf_vendor_ext set to 1 is a workaround while no beam API for beam selection is implemented
if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT || get_softmodem_params()->continuous_tx
|| IS_SOFTMODEM_RFSIM || cfg->analog_beamforming_ve.analog_bf_vendor_ext.value) {
start_meas(&info->gNB->phy_proc_tx);
if (tx_slot_type == NR_DOWNLINK_SLOT) {
start_meas(&info->gNB->phy_proc_tx);
}
phy_procedures_gNB_TX(info->gNB, &sched_response.DL_req, &sched_response.TX_req, &sched_response.UL_dci_req, frame_tx,slot_tx);
PHY_VARS_gNB *gNB = info->gNB;
@@ -106,7 +108,9 @@ static void tx_func(processingData_L1tx_t *info)
syncMsgRU.timestamp_tx = info->timestamp_tx;
LOG_D(PHY, "gNB: %d.%d : calling RU TX function\n", syncMsgRU.frame_tx, syncMsgRU.slot_tx);
ru_tx_func((void *)&syncMsgRU);
stop_meas(&info->gNB->phy_proc_tx);
if (tx_slot_type == NR_DOWNLINK_SLOT) {
stop_meas(&info->gNB->phy_proc_tx);
}
}
}
@@ -119,9 +123,14 @@ void *L1_rx_thread(void *arg)
if (res == NULL)
break;
processingData_L1_t *info = (processingData_L1_t *)NotifiedFifoData(res);
start_meas(&gNB->l1_rx_proc);
int slot_type = nr_slot_select(&gNB->gNB_config, info->frame_rx, info->slot_rx);
if (slot_type == NR_UPLINK_SLOT) {
start_meas(&gNB->l1_rx_proc);
}
rx_func(info);
stop_meas(&gNB->l1_rx_proc);
if (slot_type == NR_UPLINK_SLOT) {
stop_meas(&gNB->l1_rx_proc);
}
delNotifiedFIFO_elt(res);
}
return NULL;
@@ -135,9 +144,14 @@ void *L1_tx_thread(void *arg) {
if (res == NULL) // stopping condition, happens only when queue is freed
break;
processingData_L1tx_t *info = (processingData_L1tx_t *)NotifiedFifoData(res);
start_meas(&gNB->l1_tx_proc);
int slot_type = nr_slot_select(&gNB->gNB_config, info->frame, info->slot);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(&gNB->l1_tx_proc);
}
tx_func(info);
stop_meas(&gNB->l1_tx_proc);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(&gNB->l1_tx_proc);
}
delNotifiedFIFO_elt(res);
}
return NULL;
@@ -188,9 +202,13 @@ static void rx_func(processingData_L1_t *info)
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx, &UL_INFO);
// Call the scheduler
start_meas(&gNB->ul_indication_stats);
if (rx_slot_type == NR_UPLINK_SLOT) {
start_meas(&gNB->ul_indication_stats);
}
gNB->if_inst->NR_UL_indication(&UL_INFO);
stop_meas(&gNB->ul_indication_stats);
if (rx_slot_type == NR_UPLINK_SLOT) {
stop_meas(&gNB->ul_indication_stats);
}
notifiedFIFO_elt_t *res = newNotifiedFIFO_elt(sizeof(processingData_L1_t), 0, &gNB->L1_rx_out, NULL);
processingData_L1_t *syncMsg = NotifiedFifoData(res);
@@ -256,6 +274,55 @@ static size_t dump_L1_meas_stats(PHY_VARS_gNB *gNB, RU_t *ru, char *output, size
output += print_meas_log(&ru->compression,"compression",NULL,NULL, output, end - output);
output += print_meas_log(&ru->transport,"transport",NULL,NULL, output, end - output);
}
reset_meas(&gNB->l1_tx_proc);
reset_meas(&gNB->l1_rx_proc);
reset_meas(&gNB->phy_proc_tx);
reset_meas(&gNB->dlsch_encoding_stats);
reset_meas(&gNB->dlsch_segmentation_stats);
reset_meas(&gNB->tinput);
reset_meas(&gNB->tprep);
reset_meas(&gNB->tparity);
reset_meas(&gNB->toutput);
reset_meas(&gNB->dlsch_rate_matching_stats);
reset_meas(&gNB->dlsch_interleaving_stats);
reset_meas(&gNB->dlsch_scrambling_stats);
reset_meas(&gNB->dlsch_modulation_stats);
reset_meas(&gNB->dlsch_resource_mapping_stats);
reset_meas(&gNB->dlsch_pdsch_generation_stats);
reset_meas(&gNB->phy_proc_rx);
reset_meas(&gNB->ulsch_decoding_stats);
reset_meas(&gNB->ts_deinterleave);
reset_meas(&gNB->ts_rate_unmatch);
reset_meas(&gNB->ts_ldpc_decode);
reset_meas(&gNB->ul_indication_stats);
reset_meas(&gNB->slot_indication_stats);
reset_meas(&gNB->rx_pusch_stats);
reset_meas(&gNB->rx_prach);
if (ru->feprx) {
reset_meas(&ru->ofdm_demod_stats);
}
if (ru->feptx_prec) {
reset_meas(&ru->precoding_stats);
}
if (ru->feptx_ofdm) {
reset_meas(&ru->txdataF_copy_stats);
reset_meas(&ru->ofdm_mod_stats);
reset_meas(&ru->ofdm_total_stats);
reset_meas(&ru->txdataF_copy_stats);
}
if (ru->fh_north_asynch_in) {
reset_meas(&ru->rx_fhaul);
}
reset_meas(&ru->tx_fhaul);
if (ru->fh_north_out) {
reset_meas(&ru->compression);
reset_meas(&ru->transport);
}
return output - begin;
}

View File

@@ -549,7 +549,7 @@ static void nr_pdsch_symbol_processing(void *arg)
completed_task_ans(rdata->ans);
}
static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSCH_t *dlsch, int slot)
static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSCH_t *dlsch, int frame, int slot)
{
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
@@ -604,9 +604,12 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
memcpy(dlsch->f, input_ptr, (encoded_length + 7) >> 3);
c16_t mod_symbs[rel15->NrOfCodewords][encoded_length] __attribute__((aligned(64)));
int slot_type = nr_slot_select(&gNB->gNB_config, frame, slot);
for (int codeWord = 0; codeWord < rel15->NrOfCodewords; codeWord++) {
/// scrambling
start_meas(dlsch_scrambling_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(dlsch_scrambling_stats);
}
uint32_t scrambled_output[(encoded_length >> 5) + 4]; // modulator acces by 4 bytes in some cases
memset(scrambled_output, 0, sizeof(scrambled_output));
nr_pdsch_codeword_scrambling(input_ptr, encoded_length, codeWord, rel15->dataScramblingId, rel15->rnti, scrambled_output);
@@ -620,11 +623,17 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
}
#endif
stop_meas(dlsch_scrambling_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(dlsch_scrambling_stats);
}
/// Modulation
start_meas(dlsch_modulation_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(dlsch_modulation_stats);
}
nr_modulation(scrambled_output, encoded_length, Qm, (int16_t *)mod_symbs[codeWord]);
stop_meas(dlsch_modulation_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(dlsch_modulation_stats);
}
#ifdef DEBUG_DLSCH
printf("PDSCH Modulation: Qm %d(%d)\n", Qm, nb_re);
for (int i = 0; i < nb_re; i += 8) {
@@ -636,14 +645,18 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
#endif
}
start_meas(&gNB->dlsch_pdsch_generation_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(&gNB->dlsch_pdsch_generation_stats);
}
/// Resource mapping
// Non interleaved VRB to PRB mapping
AssertFatal(n_dmrs, "n_dmrs can't be 0\n");
// make a large enough tail to process all re with SIMD regardless a garbadge filler
start_meas(&gNB->dlsch_layer_mapping_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(&gNB->dlsch_layer_mapping_stats);
}
int layerSz2 = (layerSz + 63) & ~63;
c16_t tx_layers[rel15->nrOfLayers][layerSz2] __attribute__((aligned(64)));
memset(tx_layers, 0, sizeof(tx_layers));
@@ -665,7 +678,9 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
slot,
frame_parms->symbols_per_slot,
bitmap);
stop_meas(&gNB->dlsch_layer_mapping_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(&gNB->dlsch_layer_mapping_stats);
}
// spawn symbol threads
@@ -729,7 +744,9 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
merge_meas(&gNB->dlsch_resource_mapping_stats, &arr[i].dlsch_resource_mapping_stats);
merge_meas(&gNB->dlsch_precoding_stats, &arr[i].dlsch_precoding_stats);
}
stop_meas(&gNB->dlsch_pdsch_generation_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(&gNB->dlsch_pdsch_generation_stats);
}
/* output and its parts for each dlsch should be aligned on 64 bytes (or 8 * 64 bits)
* should remain a multiple of 8 * 64 with enough offset to fit each dlsch
*/
@@ -791,7 +808,10 @@ void nr_generate_pdsch(PHY_VARS_gNB *gNB, int n_dlsch, NR_gNB_DLSCH_t *dlsch_arr
unsigned char output[size_output >> 3] __attribute__((aligned(64)));
bzero(output, sizeof(output));
start_meas(dlsch_encoding_stats);
int slot_type = nr_slot_select(&gNB->gNB_config, frame, slot);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(dlsch_encoding_stats);
}
if (nr_dlsch_encoding(gNB,
n_dlsch,
dlsch_array,
@@ -808,11 +828,13 @@ void nr_generate_pdsch(PHY_VARS_gNB *gNB, int n_dlsch, NR_gNB_DLSCH_t *dlsch_arr
== -1) {
return;
}
stop_meas(dlsch_encoding_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(dlsch_encoding_stats);
}
unsigned char *output_ptr = output;
for (int i = 0; i < n_dlsch; i++) {
output_ptr += do_one_dlsch(output_ptr, gNB, &dlsch_array[i], slot);
output_ptr += do_one_dlsch(output_ptr, gNB, &dlsch_array[i], frame, slot);
}
}

View File

@@ -103,6 +103,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
int num_segments = 0;
int slot_type = nr_slot_select(&gNB->gNB_config, frame, slot);
for (int i = 0; i < n_dlsch; i++) {
NR_gNB_DLSCH_t *dlsch = &dlsch_array[i];
@@ -168,7 +169,9 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
TB_parameters->harq_unique_pid = i;
TB_parameters->BG = rel15->maintenance_parms_v3.ldpcBaseGraph;
TB_parameters->A = A;
start_meas(dlsch_segmentation_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(dlsch_segmentation_stats);
}
TB_parameters->Kb = nr_segmentation(dlsch->b,
dlsch->c,
B,
@@ -177,7 +180,9 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
&TB_parameters->Z,
&TB_parameters->F,
TB_parameters->BG);
stop_meas(dlsch_segmentation_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(dlsch_segmentation_stats);
}
if (TB_parameters->C > MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER * rel15->nrOfLayers) {
LOG_E(PHY, "nr_segmentation.c: too many segments %d, B %d\n", TB_parameters->C, B);
@@ -264,9 +269,11 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
nrLDPC_TB_encoding_parameters_t *TB_parameters = &TBs[i];
for (int r = 0; r < TB_parameters->C; r++) {
nrLDPC_segment_encoding_parameters_t *segment_parameters = &TB_parameters->segments[r];
merge_meas(dlsch_interleaving_stats, &segment_parameters->ts_interleave);
merge_meas(dlsch_rate_matching_stats, &segment_parameters->ts_rate_match);
// merge_meas(, &segment_parameters->ts_ldpc_encode);
if (slot_type == NR_DOWNLINK_SLOT) {
merge_meas(dlsch_interleaving_stats, &segment_parameters->ts_interleave);
merge_meas(dlsch_rate_matching_stats, &segment_parameters->ts_rate_match);
// merge_meas(, &segment_parameters->ts_ldpc_encode);
}
}
}
return 0;

View File

@@ -269,7 +269,14 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
}
int slot_type = nr_slot_select(&phy_vars_gNB->gNB_config, frame, nr_tti_rx);
// if (slot_type == NR_UPLINK_SLOT) {
// start_meas(&phy_vars_gNB->ulsch_decoding_stats);
// }
int ret_decoder = phy_vars_gNB->nrLDPC_coding_interface.nrLDPC_coding_decoder(&slot_parameters);
// if (slot_type == NR_UPLINK_SLOT) {
// stop_meas(&phy_vars_gNB->ulsch_decoding_stats);
// }
// post decode
for (uint8_t pusch_id = 0; pusch_id < nb_pusch; pusch_id++) {
@@ -293,9 +300,11 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
offset += ((harq_process->K >> 3) - (harq_process->F >> 3) - ((harq_process->C > 1) ? 3 : 0));
merge_meas(&phy_vars_gNB->ts_deinterleave, &nrLDPC_segment_decoding_parameters.ts_deinterleave);
merge_meas(&phy_vars_gNB->ts_rate_unmatch, &nrLDPC_segment_decoding_parameters.ts_rate_unmatch);
merge_meas(&phy_vars_gNB->ts_ldpc_decode, &nrLDPC_segment_decoding_parameters.ts_ldpc_decode);
if (slot_type == NR_UPLINK_SLOT) {
merge_meas(&phy_vars_gNB->ts_deinterleave, &nrLDPC_segment_decoding_parameters.ts_deinterleave);
merge_meas(&phy_vars_gNB->ts_rate_unmatch, &nrLDPC_segment_decoding_parameters.ts_rate_unmatch);
merge_meas(&phy_vars_gNB->ts_ldpc_decode, &nrLDPC_segment_decoding_parameters.ts_ldpc_decode);
}
}
}

View File

@@ -291,7 +291,10 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
}
//apply the OFDM symbol rotation here
start_meas(&gNB->phase_comp_stats);
int slot_type = nr_slot_select(&gNB->gNB_config, frame, slot);
if (slot_type == NR_DOWNLINK_SLOT) {
start_meas(&gNB->phase_comp_stats);
}
for (int i = 0; i < gNB->common_vars.num_beams_period; ++i) {
for (int aa = 0; aa < cfg->carrier_config.num_tx_ant.value; aa++) {
if (gNB->phase_comp) {
@@ -312,7 +315,9 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
T_BUFFER(gNB->common_vars.txdataF[i][aa], fp->samples_per_slot_wCP * sizeof(int32_t)));
}
}
stop_meas(&gNB->phase_comp_stats);
if (slot_type == NR_DOWNLINK_SLOT) {
stop_meas(&gNB->phase_comp_stats);
}
}
static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int *ulsch_to_decode, int nb_pusch, NR_UL_IND_t *UL_INFO)
@@ -1220,8 +1225,10 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
}
gNB_I0_measurements(gNB, slot_rx, first_symb, num_symb, rb_mask_ul);
}
start_meas(&gNB->phy_proc_rx);
int slot_type = nr_slot_select(&gNB->gNB_config, frame_rx, slot_rx);
if (slot_type == NR_UPLINK_SLOT) {
start_meas(&gNB->phy_proc_rx);
}
UL_INFO->uci_ind.uci_list = UL_INFO->uci_pdu_list;
UL_INFO->uci_ind.sfn = frame_rx;
UL_INFO->uci_ind.slot = slot_rx;
@@ -1280,7 +1287,9 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, N
stop_meas(&gNB->rx_srs_stats);
}
stop_meas(&gNB->phy_proc_rx);
if (slot_type == NR_UPLINK_SLOT) {
stop_meas(&gNB->phy_proc_rx);
}
if (n_pucch > 0 || num_pusch > 0) {
UNUSED(ofdm_symbol_size); // only used if T activated