Skip to content

Commit

Permalink
Added xrt_smi_config query in the edge side
Browse files Browse the repository at this point in the history
Signed-off-by: Manoj Takasi <[email protected]>
  • Loading branch information
Manoj Takasi committed Jan 20, 2025
1 parent aad0a12 commit 5d02ae3
Show file tree
Hide file tree
Showing 3 changed files with 360 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/runtime_src/core/edge/user/device_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (C) 2020-2022 Xilinx, Inc
// Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved.
#include "device_linux.h"
#include "smi.h"
#include "xrt.h"
#include "zynq_dev.h"
#include "aie_sys_parser.h"
Expand Down Expand Up @@ -678,6 +679,29 @@ struct am_counter
}
};

struct xrt_smi_config
{
using result_type = std::any;

static result_type
get(const xrt_core::device* device, key_type key, const std::any& reqType)
{
if (key != key_type::xrt_smi_config)
throw xrt_core::query::no_such_key(key, "Not implemented");
std::string xrt_smi_config;
const auto xrt_smi_config_type = std::any_cast<xrt_core::query::xrt_smi_config::type>(reqType);
switch (xrt_smi_config_type) {
case xrt_core::query::xrt_smi_config::type::options_config:
xrt_smi_config = xrt_core::smi::get_smi_config();
break;
default:
throw xrt_core::query::no_such_key(key, "Not implemented");
}

return xrt_smi_config;
}
};

struct asm_counter
{
using result_type = query::asm_counter::result_type;
Expand Down Expand Up @@ -1057,6 +1081,7 @@ initialize_query_table()

emplace_func4_request<query::aim_counter, aim_counter>();
emplace_func4_request<query::am_counter, am_counter>();
emplace_func4_request<query::xrt_smi_config, xrt_smi_config>();
emplace_func4_request<query::asm_counter, asm_counter>();
emplace_func4_request<query::lapc_status, lapc_status>();
emplace_func4_request<query::spc_status, spc_status>();
Expand Down
324 changes: 324 additions & 0 deletions src/runtime_src/core/edge/user/smi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
#include "smi.h"

namespace xrt_core::smi {

static constexpr std::string_view xrt_smi_config =
R"(
{
"subcommands":
[{
"name" : "validate",
"description" : "Validates the given device by executing the platform's validate executable.",
"tag" : "basic",
"options" :
[
{
"name": "device",
"alias": "d",
"description": "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest",
"tag": "basic",
"default_value": "",
"option_type": "common",
"value_type" : "string"
},
{
"name": "format",
"alias": "f",
"description": "Report output format",
"tag": "basic",
"default_value": "JSON",
"option_type": "common",
"value_type" : "string"
},
{
"name": "output",
"alias": "o",
"description" : "Direct the output to the given file",
"tag": "basic",
"default_value": "",
"option_type": "common",
"value_type" : "string"
},
{
"name": "help",
"alias": "h",
"description" : "Help to use this sub-command",
"tag": "basic",
"default_value": "",
"option_type": "common",
"value_type" : "none"
},
{
"name" : "run",
"alias" : "r",
"description" : "Run a subset of the test suite",
"tag" : "basic",
"option_type": "common",
"value_type" : "array",
"options" : [
{
"name" : "latency",
"tag" : "basic",
"description" : "Run end-to-end latency test"
},
{
"name" : "throughput",
"tag" : "basic",
"description" : "Run end-to-end throughput test"
},
{
"name" : "cmd-chain-latency",
"tag" : "basic",
"description" : "Run command chain latency test"
},
{
"name" : "cmd-chain-throughput",
"tag" : "basic",
"description" : "Run end-to-end throughput test using command chaining"
},
{
"name" : "df-bw",
"tag" : "basic",
"description" : "Run dataflow bandwidth test"
},
{
"name" : "tct-one-col",
"tag" : "basic",
"description" : "Run TCT test with one column"
},
{
"name" : "tct-all-col",
"tag" : "basic",
"description" : "Run TCT test with all columns"
},
{
"name" : "gemm",
"tag" : "basic",
"description" : "Run GEMM test"
},
{
"name" : "aie-reconfig-overhead",
"tag" : "advanced",
"description" : "Run AIE reconfiguration overhead test"
},
{
"name" : "spatial-sharing-overhead",
"tag" : "advanced",
"description" : "Run spatial sharing overhead test"
},
{
"name" : "temporal-sharing-overhead",
"tag" : "advanced",
"description" : "Run temporal sharing overhead test"
}
]
},
{
"name" : "path",
"alias" : "p",
"description" : "Path to the directory containing validate xclbins",
"tag" : "basic",
"default_value": "",
"option_type": "hidden",
"value_type" : "string"
},
{
"name" : "param",
"description" : "Extended parameter for a given test. Format: <test-name>:<key>:<value>",
"tag" : "basic",
"option_type": "hidden",
"default_value": "",
"value_type" : "string"
},
{
"name" : "pmode",
"description" : "Specify which power mode to run the benchmarks in. Note: Some tests might be unavailable for some modes",
"tag" : "basic",
"option_type": "hidden",
"default_value": "",
"value_type" : "string"
}
]
},
{
"name" : "examine",
"tag" : "basic",
"description": "This command will 'examine' the state of the system/device and will generate a report of interest in a text or JSON format.",
"options":
[
{
"name": "device",
"alias": "d",
"description": "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest",
"tag": "basic",
"default_value": "",
"option_type": "common",
"value_type": "string"
},
{
"name": "format",
"alias": "f",
"description": ["Report output format. Valid values are:",
"\n\tJSON - Latest JSON schema",
"\n\tJSON-2020.2 - JSON 2020.2 schema"
],
"tag": "basic",
"default_value": "",
"option_type": "common",
"value_type": "string"
},
{
"name": "output",
"alias": "o",
"description" : "Direct the output to the given file",
"tag": "basic",
"default_value": "",
"option_type": "common",
"value_type" : "string"
},
{
"name": "help",
"alias": "h",
"description" : "Help to use this sub-command",
"tag": "basic",
"default_value": "",
"option_type": "common",
"value_type" : "none"
},
{
"name": "report",
"alias": "r",
"description": ["The type of report to be produced. Reports currently available are:",
"\n\taie - AIE metadata in xclbin",
"\n\taiemem - AIE memory tile information",
"\n\taieshim - AIE shim tile status",
"\n\tdebug-ip-status - Status of Debug IPs present in xclbin loaded on device",
"\n\tdynamic-regions - Information about the xclbin and the compute units",
"\n\telectrical - Electrical and power sensors present on the device",
"\n\terror - Asyncronus Error present on the device",
"\n\tfirewall - Firewall status",
"\n\tmailbox - Mailbox metrics of the device",
"\n\tmechanical - Mechanical sensors on and surrounding the device",
"\n\tmemory - Memory information present on the device",
"\n\tpcie-info - Pcie information of the device",
"\n\tqspi-status - QSPI write protection status",
"\n\tthermal - Thermal sensors present on the device"
],
"tag": "basic",
"option_type": "common",
"value_type": "array",
"options": [
{
"name": "aie",
"tag": "basic",
"description": "AIE metadata in xclbin"
},
{
"name": "aiemem",
"tag": "basic",
"description": "AIE memory tile information"
},
{
"name": "aieshim",
"tag": "basic",
"description": "AIE shim tile status"
},
{
"name": "debug-ip-status",
"tag": "basic",
"description": "Status of Debug IPs present in xclbin loaded on device"
},
{
"name": "dynamic-regions",
"tag": "basic",
"description": "Information about the xclbin and the compute units"
},
{
"name": "electrical",
"tag": "basic",
"description": "Electrical and power sensors present on the device"
},
{
"name": "error",
"tag": "basic",
"description": "Asyncronus Error present on the device"
},
{
"name": "firewall",
"tag": "basic",
"description": "Firewall status"
},
{
"name": "mailbox",
"tag": "basic",
"description": "Mailbox metrics of the device"
},
{
"name": "mechanical",
"tag": "basic",
"description": "Mechanical sensors on and surrounding the device"
},
{
"name": "memory",
"tag": "basic",
"description": "Memory information present on the device"
},
{
"name": "pcie-info",
"tag": "basic",
"description": "Pcie information of the device"
},
{
"name": "qspi-status",
"tag": "basic",
"description": "QSPI write protection status"
},
{
"name": "thermal",
"tag": "basic",
"description": "Thermal sensors present on the device"
}
]
},
{
"name": "element",
"alias": "e",
"description" : "Filters individual elements(s) from the report. Format: '/<key>/<key>/...'",
"tag": "basic",
"option_type": "hidden",
"value_type" : "array"
}
]
},
{
"name" : "configure",
"tag" : "devl",
"description" : "Device and host configuration.",
"options" :
[
{
"name": "device",
"description": "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest",
"tag": "devl",
"value_type" : "string"
},
{
"name": "pmode",
"description": "Modes: default, powersaver, balanced, performance, turbo",
"tag": "basic",
"value_type": "string"
}
]
}]
}
)";


std::string
get_smi_config()
{
return std::string(xrt_smi_config);
}
} // namespace xrt_core::smi
11 changes: 11 additions & 0 deletions src/runtime_src/core/edge/user/smi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.

#include <string>

namespace xrt_core::smi {

std::string
get_smi_config();

} // namespace xrt_core::smi

0 comments on commit 5d02ae3

Please sign in to comment.