From ec773e6c70ebbd92f69bfe6f44d82f68eb0a18b4 Mon Sep 17 00:00:00 2001 From: "Neil R. Spruit" Date: Fri, 29 Mar 2024 11:56:18 -0700 Subject: [PATCH] [L0] Fix DeviceInfo global mem free to report unsupported given MemCount==0 - If there are no memory modules from zesDeviceEnumMemoryModules, then we cannot query the free memory from level zero and we do not support reporting free memory thru this api on this platform/os. Signed-off-by: Neil R. Spruit --- source/adapters/level_zero/device.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/adapters/level_zero/device.cpp b/source/adapters/level_zero/device.cpp index f4d7f95e0b..b1eb1a7b1b 100644 --- a/source/adapters/level_zero/device.cpp +++ b/source/adapters/level_zero/device.cpp @@ -718,7 +718,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( } } } - return ReturnValue(std::min(GlobalMemSize, FreeMemory)); + if (MemCount > 0) { + return ReturnValue(std::min(GlobalMemSize, FreeMemory)); + } else { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } } case UR_DEVICE_INFO_MEMORY_CLOCK_RATE: { // If there are not any memory modules then return 0.