From 6e3759f2debec64274d1431cca2035832aa83849 Mon Sep 17 00:00:00 2001 From: Jin Z <5zj@equinox.ftpn.ornl.gov> Date: Fri, 24 Mar 2023 07:47:18 -0400 Subject: [PATCH] [SYCL][CUDA] This PR tries to fix the issue reported in https://github.com/intel/llvm/issues/8750 --- sycl/plugins/cuda/pi_cuda.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sycl/plugins/cuda/pi_cuda.cpp b/sycl/plugins/cuda/pi_cuda.cpp index 21298cedf026c..0709b04582c80 100644 --- a/sycl/plugins/cuda/pi_cuda.cpp +++ b/sycl/plugins/cuda/pi_cuda.cpp @@ -1948,18 +1948,14 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name, } case PI_DEVICE_INFO_UUID: { - int driver_version = 0; - cuDriverGetVersion(&driver_version); - int major = driver_version / 1000; - int minor = driver_version % 1000 / 10; CUuuid uuid; - if ((major > 11) || (major == 11 && minor >= 4)) { - sycl::detail::pi::assertion(cuDeviceGetUuid_v2(&uuid, device->get()) == - CUDA_SUCCESS); - } else { - sycl::detail::pi::assertion(cuDeviceGetUuid(&uuid, device->get()) == - CUDA_SUCCESS); - } +#if (CUDA_VERSION >= 11040) + sycl::detail::pi::assertion(cuDeviceGetUuid_v2(&uuid, device->get()) == + CUDA_SUCCESS); +#else + sycl::detail::pi::assertion(cuDeviceGetUuid(&uuid, device->get()) == + CUDA_SUCCESS); +#endif std::array name; std::copy(uuid.bytes, uuid.bytes + 16, name.begin()); return getInfoArray(16, param_value_size, param_value, param_value_size_ret,