Skip to content

Commit 0b6da74

Browse files
aarongreigkbenzie
authored andcommitted
Fix some minor bugs in L0 urDeviceGetInfo revealed by PI->UR port
1 parent 23b8630 commit 0b6da74

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

source/adapters/level_zero/device.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
188188
}
189189
case UR_DEVICE_INFO_ATOMIC_64:
190190
return ReturnValue(
191-
static_cast<uint32_t>(Device->ZeDeviceModuleProperties->flags &
192-
ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS));
191+
static_cast<ur_bool_t>(Device->ZeDeviceModuleProperties->flags &
192+
ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS));
193193
case UR_DEVICE_INFO_EXTENSIONS: {
194194
// Convention adopted from OpenCL:
195195
// "Returns a space separated list of extension names (the extension
@@ -258,9 +258,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
258258
case UR_DEVICE_INFO_BUILD_ON_SUBDEVICE:
259259
return ReturnValue(uint32_t{0});
260260
case UR_DEVICE_INFO_COMPILER_AVAILABLE:
261-
return ReturnValue(static_cast<uint32_t>(true));
261+
return ReturnValue(static_cast<ur_bool_t>(true));
262262
case UR_DEVICE_INFO_LINKER_AVAILABLE:
263-
return ReturnValue(static_cast<uint32_t>(true));
263+
return ReturnValue(static_cast<ur_bool_t>(true));
264264
case UR_DEVICE_INFO_MAX_COMPUTE_UNITS: {
265265
uint32_t MaxComputeUnits =
266266
Device->ZeDeviceProperties->numEUsPerSubslice *
@@ -410,7 +410,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
410410
case UR_EXT_DEVICE_INFO_OPENCL_C_VERSION:
411411
return ReturnValue("");
412412
case UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC:
413-
return ReturnValue(static_cast<uint32_t>(true));
413+
return ReturnValue(static_cast<ur_bool_t>(true));
414414
case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE:
415415
return ReturnValue(
416416
size_t{Device->ZeDeviceModuleProperties->printfBufferSize});
@@ -427,7 +427,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
427427
return ReturnValue(ur_device_exec_capability_flag_t{
428428
UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL});
429429
case UR_DEVICE_INFO_ENDIAN_LITTLE:
430-
return ReturnValue(static_cast<uint32_t>(true));
430+
return ReturnValue(static_cast<ur_bool_t>(true));
431431
case UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT:
432432
return ReturnValue(static_cast<uint32_t>(Device->ZeDeviceProperties->flags &
433433
ZE_DEVICE_PROPERTY_FLAG_ECC));
@@ -604,7 +604,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
604604
}
605605
case UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: {
606606
// TODO: Not supported yet. Needs to be updated after support is added.
607-
return ReturnValue(static_cast<uint32_t>(false));
607+
return ReturnValue(static_cast<ur_bool_t>(false));
608608
}
609609
case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: {
610610
// ze_device_compute_properties.subGroupSizes is in uint32_t whereas the
@@ -790,7 +790,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
790790
return UR_RESULT_ERROR_INVALID_VALUE;
791791
case UR_DEVICE_INFO_BFLOAT16: {
792792
// bfloat16 math functions are not yet supported on Intel GPUs.
793-
return ReturnValue(bool{false});
793+
return ReturnValue(ur_bool_t{false});
794794
}
795795
case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
796796
// There are no explicit restrictions in L0 programming guide, so assume all
@@ -839,9 +839,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
839839
return ReturnValue(capabilities);
840840
}
841841
case UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT:
842-
return ReturnValue(uint32_t{false});
842+
return ReturnValue(ur_bool_t{false});
843843
case UR_DEVICE_INFO_IMAGE_SRGB:
844-
return ReturnValue(uint32_t{false});
844+
return ReturnValue(ur_bool_t{false});
845845

846846
case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES:
847847
case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES: {
@@ -853,7 +853,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
853853
0)); //__read_write attribute currently undefinde in opencl
854854
}
855855
case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: {
856-
return ReturnValue(static_cast<uint32_t>(true));
856+
return ReturnValue(static_cast<ur_bool_t>(true));
857857
}
858858

859859
case UR_DEVICE_INFO_ESIMD_SUPPORT: {
@@ -893,9 +893,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
893893
// can know if we are in (a) or (b) by checking if a tile is root device
894894
// or not.
895895
ur_device_handle_t URDev = Device->Platform->getDeviceFromNativeHandle(d);
896-
if (URDev->isSubDevice())
896+
if (URDev->isSubDevice()) {
897897
// We are in COMPOSITE mode, return an empty list.
898-
return ReturnValue(0);
898+
if (pSize) {
899+
*pSize = 0;
900+
}
901+
return UR_RESULT_SUCCESS;
902+
}
899903

900904
Res.push_back(URDev);
901905
}

0 commit comments

Comments
 (0)