Commit bbc35c7a authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/tracy-profiler' into integration_2024_w48 (!2951)

Integrate Tracy with NR UE

This commit enables the optional use of Tracy for profiling NR UE. See
https://github.com/wolfpld/tracy/releases/tag/v0.11.1 for details.

More instructions are in the commit.
parents 03946cd4 35903f9a
...@@ -271,6 +271,11 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs ...@@ -271,6 +271,11 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs
add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace" ON) add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace" ON)
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace" ON) add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace" ON)
add_boolean_option(TRACY_ENABLE OFF "Enable tracy instrumentation" ON)
if (TRACY_ENABLE)
CPMAddPackage("gh:wolfpld/tracy#v0.11.1")
endif()
set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti)
add_library(ITTI ${OCP_ITTI}/intertask_interface.cpp) add_library(ITTI ${OCP_ITTI}/intertask_interface.cpp)
target_link_libraries(ITTI PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) target_link_libraries(ITTI PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
...@@ -637,6 +642,7 @@ if (cap_FOUND) ...@@ -637,6 +642,7 @@ if (cap_FOUND)
target_compile_definitions(UTIL PRIVATE HAVE_LIB_CAP) target_compile_definitions(UTIL PRIVATE HAVE_LIB_CAP)
endif() endif()
target_link_libraries(UTIL PUBLIC ${T_LIB} pthread LOG thread-pool utils) target_link_libraries(UTIL PUBLIC ${T_LIB} pthread LOG thread-pool utils)
target_link_libraries(UTIL PUBLIC instrumentation)
set(SECURITY_SRC set(SECURITY_SRC
${OPENAIR3_DIR}/SECU/secu_defs.c ${OPENAIR3_DIR}/SECU/secu_defs.c
...@@ -706,7 +712,7 @@ set(SCHED_SRC_NR_UE ...@@ -706,7 +712,7 @@ set(SCHED_SRC_NR_UE
${OPENAIR1_DIR}/SCHED_NR_UE/pucch_uci_ue_nr.c ${OPENAIR1_DIR}/SCHED_NR_UE/pucch_uci_ue_nr.c
) )
add_library(SCHED_NR_UE_LIB ${SCHED_SRC_NR_UE}) add_library(SCHED_NR_UE_LIB ${SCHED_SRC_NR_UE})
target_link_libraries(SCHED_NR_UE_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) target_link_libraries(SCHED_NR_UE_LIB PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs UTIL)
# nFAPI # nFAPI
################################# #################################
...@@ -1144,7 +1150,7 @@ target_link_libraries(PHY_NR_NO_AVX_256 nr_phy_common nr_common) ...@@ -1144,7 +1150,7 @@ target_link_libraries(PHY_NR_NO_AVX_256 nr_phy_common nr_common)
target_compile_definitions(PHY_NR_NO_AVX_256 PUBLIC USE_128BIT) target_compile_definitions(PHY_NR_NO_AVX_256 PUBLIC USE_128BIT)
add_library(PHY_NR_UE ${PHY_NR_UE_SRC}) add_library(PHY_NR_UE ${PHY_NR_UE_SRC})
target_link_libraries(PHY_NR_UE PRIVATE asn1_nr_rrc_hdrs nr_phy_common nr_common) target_link_libraries(PHY_NR_UE PRIVATE asn1_nr_rrc_hdrs nr_phy_common nr_common UTIL)
add_library(PHY_RU ${PHY_SRC_RU}) add_library(PHY_RU ${PHY_SRC_RU})
target_link_libraries(PHY_RU PRIVATE asn1_lte_rrc_hdrs) target_link_libraries(PHY_RU PRIVATE asn1_lte_rrc_hdrs)
......
...@@ -2,3 +2,9 @@ add_subdirectory(utils) ...@@ -2,3 +2,9 @@ add_subdirectory(utils)
add_subdirectory(config/yaml) add_subdirectory(config/yaml)
configure_file(oai_version.h.in oai_version.h @ONLY) configure_file(oai_version.h.in oai_version.h @ONLY)
add_library(instrumentation INTERFACE instrumentation.h)
target_include_directories(instrumentation INTERFACE .)
if (TRACY_ENABLE)
target_link_libraries(instrumentation INTERFACE Tracy::TracyClient)
endif()
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef INSTRUMENTATION_H
#define INSTRUMENTATION_H
#ifdef TRACY_ENABLE
#include "tracy/TracyC.h"
#endif
#ifndef TracyCZone
#define TracyCZone(...)
#endif
#ifndef TracyCZoneEnd
#define TracyCZoneEnd(...)
#endif
#ifndef TracyCFrameMark
#define TracyCFrameMark
#endif
#ifndef TracyCPlot
#define TracyCPlot(...)
#endif
#endif
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "RRC/NR/MESSAGES/asn1_msg.h" #include "RRC/NR/MESSAGES/asn1_msg.h"
#include "openair1/PHY/TOOLS/phy_scope_interface.h" #include "openair1/PHY/TOOLS/phy_scope_interface.h"
#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/nr_modulation.h"
#include "instrumentation.h"
/* /*
* NR SLOT PROCESSING SEQUENCE * NR SLOT PROCESSING SEQUENCE
...@@ -480,6 +481,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action) ...@@ -480,6 +481,7 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action)
void processSlotTX(void *arg) void processSlotTX(void *arg)
{ {
TracyCZone(ctx, true);
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
const UE_nr_rxtx_proc_t *proc = &rxtxD->proc; const UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE; PHY_VARS_NR_UE *UE = rxtxD->UE;
...@@ -592,6 +594,7 @@ void processSlotTX(void *arg) ...@@ -592,6 +594,7 @@ void processSlotTX(void *arg)
*msgData = newslot; *msgData = newslot;
pushNotifiedFIFO(UE->tx_resume_ind_fifo + newslot, newElt); pushNotifiedFIFO(UE->tx_resume_ind_fifo + newslot, newElt);
RU_write(rxtxD, sl_tx_action); RU_write(rxtxD, sl_tx_action);
TracyCZoneEnd(ctx);
} }
static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE, static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE,
...@@ -600,6 +603,7 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE, ...@@ -600,6 +603,7 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE,
nr_phy_data_t *phy_data, nr_phy_data_t *phy_data,
bool *stats_printed) bool *stats_printed)
{ {
TracyCZone(ctx, true);
int sampleShift = INT_MAX; int sampleShift = INT_MAX;
NR_DL_FRAME_PARMS *fp = &UE->frame_parms; NR_DL_FRAME_PARMS *fp = &UE->frame_parms;
if (UE->sl_mode == 2) if (UE->sl_mode == 2)
...@@ -690,10 +694,12 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE, ...@@ -690,10 +694,12 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE,
} else } else
ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx);
TracyCZoneEnd(ctx);
return sampleShift; return sampleShift;
} }
void UE_dl_processing(void *arg) { void UE_dl_processing(void *arg) {
TracyCZone(ctx, true);;
nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc; UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE; PHY_VARS_NR_UE *UE = rxtxD->UE;
...@@ -701,6 +707,8 @@ void UE_dl_processing(void *arg) { ...@@ -701,6 +707,8 @@ void UE_dl_processing(void *arg) {
if (!UE->sl_mode) if (!UE->sl_mode)
pdsch_processing(UE, proc, phy_data); pdsch_processing(UE, proc, phy_data);
TracyCZoneEnd(ctx);
} }
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
...@@ -965,6 +973,7 @@ void *UE_thread(void *arg) ...@@ -965,6 +973,7 @@ void *UE_thread(void *arg)
// start of normal case, the UE is in sync // start of normal case, the UE is in sync
absolute_slot++; absolute_slot++;
TracyCFrameMark;
int slot_nr = absolute_slot % nb_slot_frame; int slot_nr = absolute_slot % nb_slot_frame;
nr_rxtx_thread_data_t curMsg = {0}; nr_rxtx_thread_data_t curMsg = {0};
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "T.h" #include "T.h"
#include <openair1/PHY/TOOLS/phy_scope_interface.h> #include <openair1/PHY/TOOLS/phy_scope_interface.h>
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h" #include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h"
#include "instrumentation.h"
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
...@@ -658,6 +659,7 @@ int nr_pbch_channel_estimation(const NR_DL_FRAME_PARMS *fp, ...@@ -658,6 +659,7 @@ int nr_pbch_channel_estimation(const NR_DL_FRAME_PARMS *fp,
bool sidelink, bool sidelink,
uint Nid) uint Nid)
{ {
TracyCZone(ctx, true);
int Ns = proc->nr_slot_rx; int Ns = proc->nr_slot_rx;
c16_t pilot[200] __attribute__((aligned(16))); c16_t pilot[200] __attribute__((aligned(16)));
//int slot_pbch; //int slot_pbch;
...@@ -830,6 +832,7 @@ int nr_pbch_channel_estimation(const NR_DL_FRAME_PARMS *fp, ...@@ -830,6 +832,7 @@ int nr_pbch_channel_estimation(const NR_DL_FRAME_PARMS *fp,
} }
} }
TracyCZoneEnd(ctx);
return(0); return(0);
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h> #include <openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h>
#include <openair1/PHY/TOOLS/phy_scope_interface.h> #include <openair1/PHY/TOOLS/phy_scope_interface.h>
#include "openair1/PHY/NR_REFSIG/nr_refsig_common.h" #include "openair1/PHY/NR_REFSIG/nr_refsig_common.h"
#include "instrumentation.h"
//#define DEBUG_PBCH //#define DEBUG_PBCH
//#define DEBUG_PBCH_ENCODING //#define DEBUG_PBCH_ENCODING
...@@ -365,6 +366,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -365,6 +366,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
int rxdataFSize, int rxdataFSize,
const struct complex16 rxdataF[][rxdataFSize]) const struct complex16 rxdataF[][rxdataFSize])
{ {
TracyCZone(ctx, true);
int max_h=0; int max_h=0;
int symbol; int symbol;
uint8_t Lmax=frame_parms->Lmax; uint8_t Lmax=frame_parms->Lmax;
...@@ -539,5 +541,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -539,5 +541,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
ue->if_inst->dl_indication(&dl_indication); ue->if_inst->dl_indication(&dl_indication);
} }
TracyCZoneEnd(ctx);
return 0; return 0;
} }
...@@ -75,6 +75,7 @@ fifo_dump_emos_UE emos_dump_UE; ...@@ -75,6 +75,7 @@ fifo_dump_emos_UE emos_dump_UE;
#include "UTIL/OPT/opt.h" #include "UTIL/OPT/opt.h"
#include "intertask_interface.h" #include "intertask_interface.h"
#include "T.h" #include "T.h"
#include "instrumentation.h"
static const unsigned int gain_table[31] = {100, 112, 126, 141, 158, 178, 200, 224, 251, 282, 316, static const unsigned int gain_table[31] = {100, 112, 126, 141, 158, 178, 200, 224, 251, 282, 316,
359, 398, 447, 501, 562, 631, 708, 794, 891, 1000, 1122, 359, 398, 447, 501, 562, 631, 708, 794, 891, 1000, 1122,
...@@ -378,6 +379,7 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue, ...@@ -378,6 +379,7 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
struct complex16 dl_ch_estimates[][estimateSz], struct complex16 dl_ch_estimates[][estimateSz],
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
{ {
TracyCZone(ctx, true);
int ret = 0; int ret = 0;
DevAssert(ue); DevAssert(ue);
...@@ -422,6 +424,7 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue, ...@@ -422,6 +424,7 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
LOG_E(PHY, "[UE %d] frame %d, nr_slot_rx %d, Error decoding PBCH!\n", ue->Mod_id, frame_rx, nr_slot_rx); LOG_E(PHY, "[UE %d] frame %d, nr_slot_rx %d, Error decoding PBCH!\n", ue->Mod_id, frame_rx, nr_slot_rx);
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT);
TracyCZoneEnd(ctx);
return ret; return ret;
} }
...@@ -894,6 +897,7 @@ static bool is_ssb_index_transmitted(const PHY_VARS_NR_UE *ue, const int index) ...@@ -894,6 +897,7 @@ static bool is_ssb_index_transmitted(const PHY_VARS_NR_UE *ue, const int index)
int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_t *phy_data) int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_t *phy_data)
{ {
TracyCZone(ctx, true);
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
int gNB_id = proc->gNB_id; int gNB_id = proc->gNB_id;
...@@ -1044,6 +1048,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_ ...@@ -1044,6 +1048,7 @@ int pbch_pdcch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_
LOG_D(PHY, "[UE %d] Frame %d, nr_slot_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_slot_rx, dci_cnt); LOG_D(PHY, "[UE %d] Frame %d, nr_slot_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_slot_rx, dci_cnt);
phy_pdcch_config->nb_search_space = 0; phy_pdcch_config->nb_search_space = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_OUT);
TracyCZoneEnd(ctx);
return sampleShift; return sampleShift;
} }
...@@ -1138,6 +1143,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_ ...@@ -1138,6 +1143,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN);
// it returns -1 in case of internal failure, or 0 in case of normal result // it returns -1 in case of internal failure, or 0 in case of normal result
int ret_pdsch = nr_ue_pdsch_procedures(ue, proc, dlsch, llr, rxdataF, G); int ret_pdsch = nr_ue_pdsch_procedures(ue, proc, dlsch, llr, rxdataF, G);
TracyCPlot("pdsch mcs", dlsch->dlsch_config.mcs);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT);
......
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