Skip to content

Commit 4a4702e

Browse files
jinz2014Jin Z
andauthored
[SYCL][CUDA] Fix the compiler error reported in #8750 (#8765)
Replace the conditional selection of the version of cuDeviceGetUuid with the CUDA_VERSION macro. Co-authored-by: Jin Z <[email protected]>
1 parent a0d0942 commit 4a4702e

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,18 +1948,14 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name,
19481948
}
19491949

19501950
case PI_DEVICE_INFO_UUID: {
1951-
int driver_version = 0;
1952-
cuDriverGetVersion(&driver_version);
1953-
int major = driver_version / 1000;
1954-
int minor = driver_version % 1000 / 10;
19551951
CUuuid uuid;
1956-
if ((major > 11) || (major == 11 && minor >= 4)) {
1957-
sycl::detail::pi::assertion(cuDeviceGetUuid_v2(&uuid, device->get()) ==
1958-
CUDA_SUCCESS);
1959-
} else {
1960-
sycl::detail::pi::assertion(cuDeviceGetUuid(&uuid, device->get()) ==
1961-
CUDA_SUCCESS);
1962-
}
1952+
#if (CUDA_VERSION >= 11040)
1953+
sycl::detail::pi::assertion(cuDeviceGetUuid_v2(&uuid, device->get()) ==
1954+
CUDA_SUCCESS);
1955+
#else
1956+
sycl::detail::pi::assertion(cuDeviceGetUuid(&uuid, device->get()) ==
1957+
CUDA_SUCCESS);
1958+
#endif
19631959
std::array<unsigned char, 16> name;
19641960
std::copy(uuid.bytes, uuid.bytes + 16, name.begin());
19651961
return getInfoArray(16, param_value_size, param_value, param_value_size_ret,

0 commit comments

Comments
 (0)