Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion projects/hipblaslt/clients/bench/src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,8 @@ try
set_device(device_id);

auto perf_monitor = EfficiencyMonitor::create();
perf_monitor->setDeviceId(device_id);
if(perf_monitor->enabled())
perf_monitor->setDeviceId(device_id);

if(datafile)
return hipblaslt_bench_datafile(filter, any_stride, props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
#include <vector>
#include <memory>

#ifndef _WIN32
#include <amd_smi/amdsmi.h>
Comment thread
tony-davis marked this conversation as resolved.
Resolved

// True when `status` means AMD-SMI is answering correctly but the requested
// telemetry (e.g. PCI BDF) is not exposed by the platform - e.g. WSL2/DXG's
// paravirtualized GPU access, which does not expose a real PCI BDF to the
// guest (ROCM-30983). Such platforms should disable the affected monitoring
// gracefully rather than aborting the whole client.
inline bool isAmdsmiTelemetryUnavailable(amdsmi_status_t status)
{
return status == AMDSMI_STATUS_NOT_SUPPORTED;
}
#endif

class EfficiencyMonitor
{
public:
Expand Down
26 changes: 24 additions & 2 deletions projects/hipblaslt/clients/common/src/efficiency_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include "efficiency_monitor.hpp"
#include "hipblaslt/hipblaslt-ext-op.h"
#include "hipblaslt_ostream.hpp"

#ifndef _WIN32

Expand Down Expand Up @@ -491,8 +492,29 @@ class EfficiencyMonitorImp : public EfficiencyMonitor
m_socketHandles[device], &deviceCount, &m_processorHandles[0]));
for(uint32_t smiIndex = 0; smiIndex < deviceCount; smiIndex++)
{
uint64_t amdSMIPCIID{};
AMDSMI_CHECK_EXC(amdsmi_get_gpu_bdf_id(m_processorHandles[smiIndex], &amdSMIPCIID));
uint64_t amdSMIPCIID{};
amdsmi_status_t bdfStatus
= amdsmi_get_gpu_bdf_id(m_processorHandles[smiIndex], &amdSMIPCIID);
if(isAmdsmiTelemetryUnavailable(bdfStatus))
{
// WSL2/DXG's paravirtualized GPU access does not expose a PCI BDF
// to the guest, so AMD-SMI correctly reports NOT_SUPPORTED here
// (ROCM-30983). There's no BDF to match against on this platform;
// warn once and fall back to processor 0 instead of aborting.
static bool warned = false;
if(!warned)
{
hipblaslt_cerr
<< "Warning: AMD-SMI does not support PCI BDF queries on "
"this platform (e.g. WSL/DXG); disabling BDF-based "
"device matching for efficiency monitoring and using "
"processor 0."
<< std::endl;
warned = true;
}
return 0;
}
AMDSMI_CHECK_EXC(bdfStatus);

msg << smiIndex << ": " << amdSMIPCIID << std::endl;

Expand Down
1 change: 1 addition & 0 deletions projects/hipblaslt/clients/tests/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_sources(hipblaslt-test
${CMAKE_CURRENT_SOURCE_DIR}/caching_library_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/secure_env_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/arch_revision_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/efficiency_monitor_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/matmul_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/auxiliary_gtest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_stats_gtest.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright Advanced Micro Devices, Inc., or its affiliates.
// SPDX-License-Identifier: MIT

// Host-only smoke test: AMD-SMI status classification for optional telemetry
// (ROCM-30983). Pure logic, no HIP/AMDSMI device calls.

#include "efficiency_monitor.hpp"

#include <gtest/gtest.h>

// isAmdsmiTelemetryUnavailable() and the AMD-SMI status enum it classifies are
// only declared under !_WIN32 (efficiency_monitor.hpp mirrors the platform
// split already in efficiency_monitor.cpp; AMD-SMI is not used on Windows).
#ifndef _WIN32
namespace
{
TEST(EfficiencyMonitorSmoke, NotSupportedIsTolerated)
{
EXPECT_TRUE(isAmdsmiTelemetryUnavailable(AMDSMI_STATUS_NOT_SUPPORTED));
Comment thread
tony-davis marked this conversation as resolved.
Resolved
}

TEST(EfficiencyMonitorSmoke, SuccessIsNotTelemetryUnavailable)
{
EXPECT_FALSE(isAmdsmiTelemetryUnavailable(AMDSMI_STATUS_SUCCESS));
}

TEST(EfficiencyMonitorSmoke, OtherFailuresStayFatal)
{
EXPECT_FALSE(isAmdsmiTelemetryUnavailable(AMDSMI_STATUS_UNKNOWN_ERROR));
}
} // namespace
#endif // !_WIN32
Loading