Skip to content

Commit 9d44d80

Browse files
author
Jaime Arteaga
authored
[SYCL][UR][L0] Correct global_mem_size reported (#8624)
When reporting memory for integrated devices, report memory from totalSize instead of physicalSize, as L0 GPU Driver reports zero for physicalSize on integrated devices. --------- Signed-off-by: Jaime Arteaga <[email protected]>
1 parent eab762b commit 9d44d80

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,19 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
693693
return ReturnValue(uint64_t{Device->ZeDeviceProperties->maxMemAllocSize});
694694
case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: {
695695
uint64_t GlobalMemSize = 0;
696+
// Support to read physicalSize depends on kernel,
697+
// so fallback into reading totalSize if physicalSize
698+
// is not available.
696699
for (const auto &ZeDeviceMemoryExtProperty :
697700
Device->ZeDeviceMemoryProperties->second) {
698701
GlobalMemSize += ZeDeviceMemoryExtProperty.physicalSize;
699702
}
703+
if (GlobalMemSize == 0) {
704+
for (const auto &ZeDeviceMemoryProperty :
705+
Device->ZeDeviceMemoryProperties->first) {
706+
GlobalMemSize += ZeDeviceMemoryProperty.totalSize;
707+
}
708+
}
700709
return ReturnValue(uint64_t{GlobalMemSize});
701710
}
702711
case UR_DEVICE_INFO_LOCAL_MEM_SIZE:

0 commit comments

Comments
 (0)