Skip to content

Commit 1d13e59

Browse files
author
Georgi Mirazchiyski
committed
[UR][Cuda] Implement intel device info extensions for HW_THREADS_PER_EU and EU_SIMD_WIDTH on Cuda
1 parent 5b57041 commit 1d13e59

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

source/adapters/cuda/device.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,13 +1082,32 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10821082
case UR_DEVICE_INFO_COMPOSITE_DEVICE:
10831083
case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS:
10841084
case UR_DEVICE_INFO_GPU_EU_COUNT:
1085-
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:
10861085
case UR_DEVICE_INFO_GPU_EU_SLICES:
10871086
case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE:
10881087
case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
1089-
case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
10901088
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
10911089

1090+
case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU: {
1091+
int MaxHwThreads{0}; // TODO: Cache this as a ur_device_handle_t_ member
1092+
UR_CHECK_ERROR(cuDeviceGetAttribute(
1093+
&MaxHwThreads, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR,
1094+
hDevice->get()));
1095+
detail::ur::assertion(MaxHwThreads >= 0);
1096+
return ReturnValue(static_cast<size_t>(MaxHwThreads));
1097+
}
1098+
case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH: {
1099+
int MaxHwThreads{0}; // TODO: Cache this as a ur_device_handle_t_ member
1100+
UR_CHECK_ERROR(cuDeviceGetAttribute(
1101+
&MaxHwThreads, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR,
1102+
hDevice->get()));
1103+
detail::ur::assertion(MaxHwThreads >= 0);
1104+
int WarpSize{0}; // TODO: Cache this as a ur_device_handle_t_ member
1105+
UR_CHECK_ERROR(cuDeviceGetAttribute(
1106+
&WarpSize, CU_DEVICE_ATTRIBUTE_WARP_SIZE, hDevice->get()));
1107+
detail::ur::assertion(WarpSize >= 0);
1108+
return ReturnValue(static_cast<uint32_t>(MaxHwThreads) / WarpSize);
1109+
}
1110+
10921111
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP:
10931112
case UR_DEVICE_INFO_COMMAND_BUFFER_EVENT_SUPPORT_EXP:
10941113
return ReturnValue(true);

0 commit comments

Comments
 (0)