Skip to content

Commit

Permalink
[UR][Cuda] Implement intel device info extensions for HW_THREADS_PER_…
Browse files Browse the repository at this point in the history
…EU and EU_SIMD_WIDTH on Cuda
  • Loading branch information
GeorgeWeb committed Nov 20, 2024
1 parent 5b57041 commit 1d13e59
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,13 +1082,32 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
case UR_DEVICE_INFO_COMPOSITE_DEVICE:
case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS:
case UR_DEVICE_INFO_GPU_EU_COUNT:
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:
case UR_DEVICE_INFO_GPU_EU_SLICES:
case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE:
case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;

case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU: {
int MaxHwThreads{0}; // TODO: Cache this as a ur_device_handle_t_ member
UR_CHECK_ERROR(cuDeviceGetAttribute(
&MaxHwThreads, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR,
hDevice->get()));
detail::ur::assertion(MaxHwThreads >= 0);
return ReturnValue(static_cast<size_t>(MaxHwThreads));
}
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH: {
int MaxHwThreads{0}; // TODO: Cache this as a ur_device_handle_t_ member
UR_CHECK_ERROR(cuDeviceGetAttribute(
&MaxHwThreads, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR,
hDevice->get()));
detail::ur::assertion(MaxHwThreads >= 0);
int WarpSize{0}; // TODO: Cache this as a ur_device_handle_t_ member
UR_CHECK_ERROR(cuDeviceGetAttribute(
&WarpSize, CU_DEVICE_ATTRIBUTE_WARP_SIZE, hDevice->get()));
detail::ur::assertion(WarpSize >= 0);
return ReturnValue(static_cast<uint32_t>(MaxHwThreads) / WarpSize);
}

case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP:
case UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP:
return ReturnValue(true);
Expand Down

0 comments on commit 1d13e59

Please sign in to comment.