3131#include <string.h>
3232
3333#define NVML_SUCCESS 0
34+ #define NVML_ERROR_NOT_SUPPORTED 3
3435#define NVML_ERROR_INSUFFICIENT_SIZE 7
3536
3637typedef struct nvmlDevice * nvmlDevice_t ;
@@ -624,8 +625,10 @@ static void gpuinfo_nvidia_refresh_dynamic_info(struct gpu_info *_gpu_info) {
624625 SET_GPUINFO_DYNAMIC (dynamic_info , free_memory , memory_info .free );
625626 SET_GPUINFO_DYNAMIC (dynamic_info , mem_util_rate , memory_info .used * 100 / memory_info .total );
626627 }
627- } else {
628- // Memory query failed - likely unified memory GPU (error code 13 = NOT_SUPPORTED)
628+ } else if (last_nvml_return_status == NVML_ERROR_NOT_SUPPORTED ) {
629+ // From the NVM: documentation:
630+ // On certain SOC platforms, the integrated GPU (iGPU) does not use a dedicated framebuffer but instead shares
631+ // memory with the system. As a result, NVML_ERROR_NOT_SUPPORTED will be returned in this case.
629632 has_unified_memory = true;
630633 }
631634 }
@@ -642,8 +645,10 @@ static void gpuinfo_nvidia_refresh_dynamic_info(struct gpu_info *_gpu_info) {
642645 SET_GPUINFO_DYNAMIC (dynamic_info , free_memory , memory_info .free );
643646 SET_GPUINFO_DYNAMIC (dynamic_info , mem_util_rate , memory_info .used * 100 / memory_info .total );
644647 }
645- } else {
646- // Memory query failed - likely unified memory GPU
648+ } else if (last_nvml_return_status == NVML_ERROR_NOT_SUPPORTED ) {
649+ // From the NVM: documentation:
650+ // On certain SOC platforms, the integrated GPU (iGPU) does not use a dedicated framebuffer but instead shares
651+ // memory with the system. As a result, NVML_ERROR_NOT_SUPPORTED will be returned in this case.
647652 has_unified_memory = true;
648653 }
649654 }
0 commit comments