Skip to content

Commit 307a964

Browse files
Add trace points in functions that depends on user input (Xilinx#9823)
Signed-off-by: rahul <rbramand@amd.com>
1 parent 73611ef commit 307a964

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

src/runtime_src/core/common/api/xrt_elf.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "core/common/config_reader.h"
1313
#include "core/common/error.h"
1414
#include "core/common/message.h"
15+
#include "core/common/trace.h"
1516
#include "core/common/xclbin_parser.h"
1617

1718
#include <boost/interprocess/streams/bufferstream.hpp>
@@ -917,6 +918,7 @@ class elf_aie_gen2 : public elf_impl
917918
elf_aie_gen2(ELFIO::elfio&& elfio, elf::platform platform, std::string path)
918919
: elf_impl{std::move(elfio), platform, std::move(path)}
919920
{
921+
XRT_TRACE_POINT_SCOPE(xrt_elf_aie_gen2);
920922
// Parse ELF sections to populate kernel and section maps
921923
parse_sections();
922924
// Initialize all section buffer maps
@@ -1362,6 +1364,7 @@ class elf_aie_gen2_plus : public elf_impl
13621364
elf_aie_gen2_plus(ELFIO::elfio&& elfio, elf::platform platform, std::string path)
13631365
: elf_impl{std::move(elfio), platform, std::move(path)}
13641366
{
1367+
XRT_TRACE_POINT_SCOPE(xrt_elf_aie_gen2_plus);
13651368
// Parse ELF sections to populate kernel and section maps
13661369
parse_sections();
13671370
// Initialize all section buffer maps

src/runtime_src/core/common/api/xrt_kernel.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ ctx_error_type_to_string(uint32_t ctx_error_type)
289289

290290
if (ctx_error_type >= ctx_error_type_names.size())
291291
return "UNKNOWN";
292-
292+
293293
return ctx_error_type_names[ctx_error_type];
294294
}
295295

@@ -299,7 +299,7 @@ flags_to_string(uint32_t value, const std::array<std::pair<uint32_t, const char*
299299
{
300300
if (value == 0)
301301
return "NONE";
302-
302+
303303
std::string result;
304304
uint32_t unknown = value;
305305
for (const auto& entry : flags) {
@@ -320,7 +320,7 @@ flags_to_string(uint32_t value, const std::array<std::pair<uint32_t, const char*
320320
}
321321
return result;
322322
}
323-
323+
324324
// misc_status is a bit mask (ert_uc_health_info); OR known flags and report unknown bits.
325325
static std::string
326326
uc_misc_status_flags_to_string(uint32_t misc_status)
@@ -2584,6 +2584,7 @@ class run_impl : public std::enable_shared_from_this<run_impl>
25842584
void
25852585
set_dtrace_control_file(const std::string& path)
25862586
{
2587+
XRT_TRACE_POINT_SCOPE(xrt_run_set_dtrace_control_file);
25872588
std::lock_guard<std::mutex> lock(m_mutex);
25882589
if (!m_module) {
25892590
throw xrt_core::error(
@@ -2597,12 +2598,13 @@ class run_impl : public std::enable_shared_from_this<run_impl>
25972598
"Cannot set dtrace control file: run has already been started and is "
25982599
"still in progress");
25992600

2601+
xrt_core::module_int::set_dtrace_control_file(m_module, path);
2602+
if (m_dpu_payload)
2603+
xrt_core::module_int::fill_ert_dpu_data(m_module, m_dpu_payload);
2604+
2605+
// Store only after module and command payload are updated
2606+
// clone inherits this
26002607
m_dtrace_control_file = path;
2601-
if (m_module) {
2602-
xrt_core::module_int::set_dtrace_control_file(m_module, path);
2603-
if (m_dpu_payload)
2604-
xrt_core::module_int::fill_ert_dpu_data(m_module, m_dpu_payload);
2605-
}
26062608
}
26072609

26082610
// run_type() - constructor
@@ -3067,7 +3069,7 @@ class run_impl : public std::enable_shared_from_this<run_impl>
30673069
{
30683070
if (state != ERT_CMD_STATE_TIMEOUT)
30693071
return;
3070-
3072+
30713073
auto file = xrt_core::config::get_aie_coredump_file();
30723074
if (file.empty())
30733075
return;
@@ -4908,10 +4910,10 @@ aie_error_message_v1(const ert_packet* epkt, const std::string& msg,
49084910
// (e.g. ELF loaded from a buffer rather than a file path).
49094911
if (!kernel_instance.empty())
49104912
oss << "Kernel Instance: " << kernel_instance;
4911-
4913+
49124914
if (!elf_filename.empty())
49134915
oss << "\nELF File: " << elf_filename;
4914-
4916+
49154917
if (!elf_uuid.empty())
49164918
oss << "\nELF UUID: " << elf_uuid;
49174919

src/runtime_src/core/common/api/xrt_module.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#define XRT_CORE_COMMON_SOURCE // in same dll as core_common
66
#include "core/common/config_reader.h"
77
#include "core/common/message.h"
8+
#include "core/common/trace.h"
9+
810
#include "xrt/experimental/xrt_module.h"
911
#include "xrt/experimental/xrt_aie.h"
1012
#include "xrt/experimental/xrt_elf.h"
@@ -555,6 +557,7 @@ class module_run_aie_gen2 : public module_run
555557
: module_run(elf, hw_context, id)
556558
, m_config(std::get<xrt::module_config_aie_gen2>(m_elf_impl->get_module_config(id)))
557559
{
560+
XRT_TRACE_POINT_SCOPE(xrt_module_run_aie_gen2);
558561
create_ctrlpkt_buf(ctrlpkt_bo);
559562
create_ctrlpkt_pm_bufs();
560563
create_instruction_buf();
@@ -1026,6 +1029,7 @@ class module_run_aie_gen2_plus : public module_run
10261029
: module_run(elf, hw_context, id)
10271030
, m_config(std::get<xrt::module_config_aie_gen2_plus>(m_elf_impl->get_module_config(id)))
10281031
{
1032+
XRT_TRACE_POINT_SCOPE(xrt_module_run_aie_gen2_plus);
10291033
initialize_dtrace_buf(""); // use config path by default
10301034
create_ctrlpkt_bufs();
10311035
create_instruction_buffer();

0 commit comments

Comments
 (0)