Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/runtime_src/core/common/query_requests.h
Original file line number Diff line number Diff line change
Expand Up @@ -4116,10 +4116,14 @@ struct archive_path : request

struct auto_coredump : request
{
using result_type = uint32_t;
using value_type = uint32_t;

static const key_type key = key_type::auto_coredump;

std::any
get(const device*) const override = 0;

void
put(const device*, const std::any&) const override = 0;
};
Expand Down
6 changes: 4 additions & 2 deletions src/runtime_src/core/common/smi/smi_ryzen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ config_gen_ryzen()
{"platform", "Platforms flashed on the device", "common"},
{"telemetry", "Telemetry data for the device", "hidden"},
{"preemption", "Preemption telemetry data for the device", "hidden"},
{"clocks", "Clock frequency information", "hidden"}
{"clocks", "Clock frequency information", "hidden"},
{"debug", "Debug configuration settings for the device", "hidden"}
};

validate_test_desc = {
Expand Down Expand Up @@ -118,7 +119,8 @@ config_gen_npu3()
{"platform", "Platforms flashed on the device", "common"},
{"telemetry", "Telemetry data for the device", "common"},
{"preemption", "Preemption telemetry data for the device", "common"},
{"clocks", "Clock frequency information", "hidden"}
{"clocks", "Clock frequency information", "hidden"},
{"debug", "Debug configuration settings for the device", "hidden"}
};

validate_test_desc = {
Expand Down
99 changes: 99 additions & 0 deletions src/runtime_src/core/tools/common/reports/ReportDebug.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved.

#include "ReportDebug.h"

#include "core/common/query_requests.h"

#include <boost/format.hpp>
#include <functional>

namespace xq = xrt_core::query;

namespace {

std::string
enabled_status(uint32_t value)
{
return value == 1 ? "enabled" : "disabled";
}

std::string
format_line(const boost::property_tree::ptree& setting)
{
const auto status = setting.get<std::string>("status");
const auto detail = setting.get<std::string>("detail", "");
if (detail.empty())
return status;
return boost::str(boost::format("%s (%s)") % status % detail);
}

void
add_setting(boost::property_tree::ptree& parent, const std::string& name,
const std::function<void(boost::property_tree::ptree&)>& populate)
{
boost::property_tree::ptree node;
try {
populate(node);
}
catch (const std::exception&) {
node.put("status", "not supported");
}
parent.add_child(name, node);
}

void
populate_debug(const xrt_core::device* dev, boost::property_tree::ptree& debug_pt)
{
add_setting(debug_pt, "firmware_log", [&](boost::property_tree::ptree& node) {
const auto fw = xrt_core::device_query<xq::firmware_log_state>(dev);
node.put("status", enabled_status(fw.action));
if (fw.action == 1)
node.put("detail", boost::str(boost::format("log level %u") % fw.log_level));
});

add_setting(debug_pt, "event_trace", [&](boost::property_tree::ptree& node) {
const auto et = xrt_core::device_query<xq::event_trace_state>(dev);
node.put("status", enabled_status(et.action));
if (et.action == 1 && et.categories != 0)
node.put("detail", boost::str(boost::format("categories 0x%x") % et.categories));
});

add_setting(debug_pt, "auto_coredump", [&](boost::property_tree::ptree& node) {
const auto coredump = xrt_core::device_query<xq::auto_coredump>(dev);
node.put("status", enabled_status(coredump));
});
}

} // namespace

void
ReportDebug::getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const
{
getPropertyTree20202(dev, pt);
}

void
ReportDebug::getPropertyTree20202(const xrt_core::device* dev, boost::property_tree::ptree& pt) const
{
boost::property_tree::ptree debug_pt;
populate_debug(dev, debug_pt);
pt.add_child("debug", debug_pt);
}

void
ReportDebug::writeReport(const xrt_core::device* /*dev*/, const boost::property_tree::ptree& pt,
const std::vector<std::string>& /*elementsFilter*/,
std::ostream& output) const
{
const auto& debug_pt = pt.get_child("debug");

output << "Debug Configurations\n";
output << boost::format(" %-20s: %s\n") % "Firmware Log"
% format_line(debug_pt.get_child("firmware_log"));
output << boost::format(" %-20s: %s\n") % "Event Trace"
% format_line(debug_pt.get_child("event_trace"));
output << boost::format(" %-20s: %s\n") % "Auto Coredump"
% format_line(debug_pt.get_child("auto_coredump"));
output << "\n";
}
21 changes: 21 additions & 0 deletions src/runtime_src/core/tools/common/reports/ReportDebug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved.

#ifndef ReportDebug_h
#define ReportDebug_h

#include "tools/common/Report.h"

class ReportDebug : public Report {
public:
ReportDebug()
: Report("debug", "Debug configuration settings for the device", true /*deviceRequired*/, true /*isHidden*/)
{}

void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const override;
void getPropertyTree20202(const xrt_core::device* dev, boost::property_tree::ptree& pt) const override;
void writeReport(const xrt_core::device* dev, const boost::property_tree::ptree& pt,
const std::vector<std::string>& elementsFilter, std::ostream& output) const override;
};

#endif
2 changes: 2 additions & 0 deletions src/runtime_src/core/tools/xbutil2/SubCmdExamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "tools/common/reports/ReportClocks.h"
#include "tools/common/reports/ReportCmcStatus.h"
#include "tools/common/reports/ReportDynamicRegion.h"
#include "tools/common/reports/ReportDebug.h"
#include "tools/common/reports/ReportDebugIpStatus.h"
#include "tools/common/reports/ReportElectrical.h"
#include "tools/common/reports/ReportFirewall.h"
Expand Down Expand Up @@ -71,6 +72,7 @@ SubCmdExamine::SubCmdExamine(bool _isHidden, bool _isDepricated, bool _isPrelimi
std::make_shared<ReportAsyncError>(),
std::make_shared<ReportBOStats>(),
std::make_shared<ReportClocks>(),
std::make_shared<ReportDebug>(),
std::make_shared<ReportDebugIpStatus>(),
std::make_shared<ReportDynamicRegion>(),
std::make_shared<ReportHost>(),
Expand Down
Loading