Skip to content

Commit f9033aa

Browse files
Add aie coredump support using hw ctx (#9368)
* Add aie coredump support using hw ctx Signed-off-by: Rahul Bramandlapalli <rbramand@amd.com> * Fix clang-tidy warnings Signed-off-by: Rahul Bramandlapalli <rbramand@amd.com> --------- Signed-off-by: Rahul Bramandlapalli <rbramand@amd.com>
1 parent 20ff27f commit f9033aa

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "core/common/config_reader.h"
1111
#include "core/common/message.h"
12+
#include "core/common/query_requests.h"
1213
#include "core/common/time.h"
1314
#include "core/common/utils.h"
1415
#include "core/include/xrt/xrt_hw_context.h"
@@ -494,6 +495,21 @@ class hw_context_impl : public std::enable_shared_from_this<hw_context_impl>
494495
msg.append(dump_file_name);
495496
xrt_core::message::send(xrt_core::message::severity_level::debug, "xrt_hw_context", msg);
496497
}
498+
499+
std::vector<char>
500+
get_aie_coredump() const
501+
{
502+
try {
503+
return xrt_core::device_query<xrt_core::query::aie_coredump>(m_core_device,
504+
m_hdl->get_slotidx());
505+
}
506+
catch (const xrt_core::query::no_such_key&) {
507+
throw std::runtime_error("AIE coredump is not supported on this platform");
508+
}
509+
catch (const std::exception& e) {
510+
throw std::runtime_error("Failed to get AIE coredump: " + std::string(e.what()));
511+
}
512+
}
497513
};
498514

499515
} // xrt
@@ -693,6 +709,13 @@ hw_context::
693709
~hw_context()
694710
{}
695711

712+
std::vector<char>
713+
hw_context::
714+
get_aie_coredump() const
715+
{
716+
return get_handle()->get_aie_coredump();
717+
}
718+
696719
} // xrt
697720

698721
////////////////////////////////////////////////////////////////

src/runtime_src/core/common/query_requests.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ enum class key_type
348348
noop,
349349

350350
xocl_errors_ex,
351-
xocl_ex_error_code2string
351+
xocl_ex_error_code2string,
352+
353+
aie_coredump
352354
};
353355

354356
struct pcie_vendor : request
@@ -4374,6 +4376,16 @@ struct read_trace_data : request
43744376
virtual std::any
43754377
get(const device*, const std::any&) const override = 0;
43764378
};
4379+
4380+
// Used for getting AIE coredump of all tiles within a ctx
4381+
struct aie_coredump : request
4382+
{
4383+
using result_type = std::vector<char>;
4384+
static const key_type key = key_type::aie_coredump;
4385+
4386+
std::any
4387+
get(const device*, const std::any&) const override = 0;
4388+
};
43774389
} // query
43784390

43794391
} // xrt_core

src/runtime_src/core/include/xrt/xrt_hw_context.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ class hw_context : public detail::pimpl<hw_context_impl>
262262
access_mode
263263
get_mode() const;
264264

265+
/**
266+
* get_aie_coredump() - Returns the coredump of AIE Array if available.
267+
* Coredump represents memory/register dump of AIE tiles in this ctx.
268+
* This function can throw.
269+
*/
270+
XRT_API_EXPORT
271+
std::vector<char>
272+
get_aie_coredump() const;
273+
265274
public:
266275
/// @cond
267276
// Undocumented internal access to low level context handle

0 commit comments

Comments
 (0)