From 904b380589e394e0d3ae3d24672b90b7c9aa7670 Mon Sep 17 00:00:00 2001 From: "Taylor, Raymond" Date: Mon, 1 Jun 2026 18:22:38 -0700 Subject: [PATCH 1/2] fix nvml structure definition --- .../CommonUtilities/ref/gen/GeneratedReflection.h | 2 +- .../ControlLib/nvml/NvmlTelemetryProvider.cpp | 10 +++++----- .../ControlLib/nvml/NvmlTelemetryProvider.h | 2 +- IntelPresentMon/ControlLib/nvml/nvml.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/IntelPresentMon/CommonUtilities/ref/gen/GeneratedReflection.h b/IntelPresentMon/CommonUtilities/ref/gen/GeneratedReflection.h index 292f9893..722a85ce 100644 --- a/IntelPresentMon/CommonUtilities/ref/gen/GeneratedReflection.h +++ b/IntelPresentMon/CommonUtilities/ref/gen/GeneratedReflection.h @@ -326,8 +326,8 @@ namespace pmon::util::ref::gen const auto& s = *static_cast(pStruct); std::ostringstream oss; oss << std::boolalpha << "struct nvmlMemory_t {" - << " .free = " << s.free << " .total = " << s.total + << " .free = " << s.free << " .used = " << s.used << " }"; return oss.str(); diff --git a/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.cpp b/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.cpp index 87c38753..7a5a4d27 100644 --- a/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.cpp +++ b/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.cpp @@ -122,7 +122,7 @@ namespace pmon::tel::nvml if (pMemoryInfo == nullptr) { return (uint64_t)0; } - return GetLegacyTotalMemoryBytes_(*pMemoryInfo); + return GetTotalMemoryBytes_(*pMemoryInfo); } case PM_METRIC_GPU_MEM_USED: { @@ -141,7 +141,7 @@ namespace pmon::tel::nvml return 0.0; } - const auto totalBytes = GetLegacyTotalMemoryBytes_(*pMemoryInfo); + const auto totalBytes = GetTotalMemoryBytes_(*pMemoryInfo); if (totalBytes == 0) { return 0.0; } @@ -160,9 +160,9 @@ namespace pmon::tel::nvml (void)metricId; } - uint64_t NvmlTelemetryProvider::GetLegacyTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept + uint64_t NvmlTelemetryProvider::GetTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept { - return (uint64_t)memoryInfo.free; + return (uint64_t)memoryInfo.total; } bool NvmlTelemetryProvider::TryInitializeDevice_(DeviceState_& device, nvmlDevice_t handle) const @@ -232,7 +232,7 @@ namespace pmon::tel::nvml } if (const auto* pMemoryInfo = PollMemoryInfoEndpoint_(device, requestQpc)) { - const auto totalBytes = GetLegacyTotalMemoryBytes_(*pMemoryInfo); + const auto totalBytes = GetTotalMemoryBytes_(*pMemoryInfo); if (totalBytes != 0) { caps.Set(PM_METRIC_GPU_MEM_SIZE, 1); caps.Set(PM_METRIC_GPU_MEM_USED, 1); diff --git a/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.h b/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.h index 80a110a1..ab309c78 100644 --- a/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.h +++ b/IntelPresentMon/ControlLib/nvml/NvmlTelemetryProvider.h @@ -39,7 +39,7 @@ namespace pmon::tel::nvml }; static void ValidateScalarMetricIndex_(PM_METRIC metricId, uint32_t arrayIndex); - static uint64_t GetLegacyTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept; + static uint64_t GetTotalMemoryBytes_(const nvmlMemory_t& memoryInfo) noexcept; bool TryInitializeDevice_(DeviceState_& device, nvmlDevice_t handle) const; ipc::MetricCapabilities BuildCapsForDevice_(DeviceState_& device) const; diff --git a/IntelPresentMon/ControlLib/nvml/nvml.h b/IntelPresentMon/ControlLib/nvml/nvml.h index ada7517b..955d88b5 100644 --- a/IntelPresentMon/ControlLib/nvml/nvml.h +++ b/IntelPresentMon/ControlLib/nvml/nvml.h @@ -111,8 +111,8 @@ struct nvmlPciInfo_t { }; struct nvmlMemory_t { - unsigned long long free; unsigned long long total; + unsigned long long free; unsigned long long used; }; From d0cab3b683bd514a93df779e34c7ec533baffb15 Mon Sep 17 00:00:00 2001 From: "Taylor, Raymond" Date: Mon, 1 Jun 2026 18:30:34 -0700 Subject: [PATCH 2/2] explicit inclusion of headers --- .../CommonUtilities/ref/GeneratedReflectionHelpers.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/IntelPresentMon/CommonUtilities/ref/GeneratedReflectionHelpers.h b/IntelPresentMon/CommonUtilities/ref/GeneratedReflectionHelpers.h index 55e0a09f..fa59b936 100644 --- a/IntelPresentMon/CommonUtilities/ref/GeneratedReflectionHelpers.h +++ b/IntelPresentMon/CommonUtilities/ref/GeneratedReflectionHelpers.h @@ -1,6 +1,11 @@ #pragma once -#include #include +#include +#include +#include +#include +#include +#include #include "GeneratedReflection.h" namespace pmon::util::ref::gen