Skip to content

Commit

Permalink
Fix some minor bugs in L0 urDeviceGetInfo revealed by PI->UR port
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongreig authored and kbenzie committed May 3, 2024
1 parent 23b8630 commit 0b6da74
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions source/adapters/level_zero/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
}
case UR_DEVICE_INFO_ATOMIC_64:
return ReturnValue(
static_cast<uint32_t>(Device->ZeDeviceModuleProperties->flags &
ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS));
static_cast<ur_bool_t>(Device->ZeDeviceModuleProperties->flags &
ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS));
case UR_DEVICE_INFO_EXTENSIONS: {
// Convention adopted from OpenCL:
// "Returns a space separated list of extension names (the extension
Expand Down Expand Up @@ -258,9 +258,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
case UR_DEVICE_INFO_BUILD_ON_SUBDEVICE:
return ReturnValue(uint32_t{0});
case UR_DEVICE_INFO_COMPILER_AVAILABLE:
return ReturnValue(static_cast<uint32_t>(true));
return ReturnValue(static_cast<ur_bool_t>(true));
case UR_DEVICE_INFO_LINKER_AVAILABLE:
return ReturnValue(static_cast<uint32_t>(true));
return ReturnValue(static_cast<ur_bool_t>(true));
case UR_DEVICE_INFO_MAX_COMPUTE_UNITS: {
uint32_t MaxComputeUnits =
Device->ZeDeviceProperties->numEUsPerSubslice *
Expand Down Expand Up @@ -410,7 +410,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
case UR_EXT_DEVICE_INFO_OPENCL_C_VERSION:
return ReturnValue("");
case UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC:
return ReturnValue(static_cast<uint32_t>(true));
return ReturnValue(static_cast<ur_bool_t>(true));
case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE:
return ReturnValue(
size_t{Device->ZeDeviceModuleProperties->printfBufferSize});
Expand All @@ -427,7 +427,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
return ReturnValue(ur_device_exec_capability_flag_t{
UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL});
case UR_DEVICE_INFO_ENDIAN_LITTLE:
return ReturnValue(static_cast<uint32_t>(true));
return ReturnValue(static_cast<ur_bool_t>(true));
case UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT:
return ReturnValue(static_cast<uint32_t>(Device->ZeDeviceProperties->flags &
ZE_DEVICE_PROPERTY_FLAG_ECC));
Expand Down Expand Up @@ -604,7 +604,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
}
case UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: {
// TODO: Not supported yet. Needs to be updated after support is added.
return ReturnValue(static_cast<uint32_t>(false));
return ReturnValue(static_cast<ur_bool_t>(false));
}
case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: {
// ze_device_compute_properties.subGroupSizes is in uint32_t whereas the
Expand Down Expand Up @@ -790,7 +790,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
return UR_RESULT_ERROR_INVALID_VALUE;
case UR_DEVICE_INFO_BFLOAT16: {
// bfloat16 math functions are not yet supported on Intel GPUs.
return ReturnValue(bool{false});
return ReturnValue(ur_bool_t{false});
}
case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: {
// There are no explicit restrictions in L0 programming guide, so assume all
Expand Down Expand Up @@ -839,9 +839,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
return ReturnValue(capabilities);
}
case UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT:
return ReturnValue(uint32_t{false});
return ReturnValue(ur_bool_t{false});
case UR_DEVICE_INFO_IMAGE_SRGB:
return ReturnValue(uint32_t{false});
return ReturnValue(ur_bool_t{false});

case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES:
case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES: {
Expand All @@ -853,7 +853,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
0)); //__read_write attribute currently undefinde in opencl
}
case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: {
return ReturnValue(static_cast<uint32_t>(true));
return ReturnValue(static_cast<ur_bool_t>(true));
}

case UR_DEVICE_INFO_ESIMD_SUPPORT: {
Expand Down Expand Up @@ -893,9 +893,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
// can know if we are in (a) or (b) by checking if a tile is root device
// or not.
ur_device_handle_t URDev = Device->Platform->getDeviceFromNativeHandle(d);
if (URDev->isSubDevice())
if (URDev->isSubDevice()) {
// We are in COMPOSITE mode, return an empty list.
return ReturnValue(0);
if (pSize) {
*pSize = 0;
}
return UR_RESULT_SUCCESS;
}

Res.push_back(URDev);
}
Expand Down

0 comments on commit 0b6da74

Please sign in to comment.