Cycles: oneAPI: migrate from deprecated APIs, require libSYCL 6.0+
sycl::info::device::ext_intel_* descriptors are deprecated, replaced with sycl::ext::intel::info::device:: that are available from 6.0+, for which we now check version in CMake.
This commit is contained in:
parent
305b92e05f
commit
0cfac5b043
|
@ -88,9 +88,23 @@ FIND_PATH(SYCL_INCLUDE_DIR
|
|||
include
|
||||
)
|
||||
|
||||
IF(EXISTS "${SYCL_INCLUDE_DIR}/sycl/version.hpp")
|
||||
FILE(STRINGS "${SYCL_INCLUDE_DIR}/sycl/version.hpp" _libsycl_major_version REGEX "^#define __LIBSYCL_MAJOR_VERSION[ \t].*$")
|
||||
STRING(REGEX MATCHALL "[0-9]+" _libsycl_major_version ${_libsycl_major_version})
|
||||
FILE(STRINGS "${SYCL_INCLUDE_DIR}/sycl/version.hpp" _libsycl_minor_version REGEX "^#define __LIBSYCL_MINOR_VERSION[ \t].*$")
|
||||
STRING(REGEX MATCHALL "[0-9]+" _libsycl_minor_version ${_libsycl_minor_version})
|
||||
FILE(STRINGS "${SYCL_INCLUDE_DIR}/sycl/version.hpp" _libsycl_patch_version REGEX "^#define __LIBSYCL_PATCH_VERSION[ \t].*$")
|
||||
STRING(REGEX MATCHALL "[0-9]+" _libsycl_patch_version ${_libsycl_patch_version})
|
||||
|
||||
SET(SYCL_VERSION "${_libsycl_major_version}.${_libsycl_minor_version}.${_libsycl_patch_version}")
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SYCL DEFAULT_MSG SYCL_LIBRARY SYCL_INCLUDE_DIR)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SYCL
|
||||
REQUIRED_VARS SYCL_LIBRARY SYCL_INCLUDE_DIR
|
||||
VERSION_VAR SYCL_VERSION
|
||||
)
|
||||
|
||||
IF(SYCL_FOUND)
|
||||
SET(SYCL_INCLUDE_DIR ${SYCL_INCLUDE_DIR} ${SYCL_INCLUDE_DIR}/sycl)
|
||||
|
|
|
@ -663,8 +663,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
find_package(SYCL)
|
||||
find_package(LevelZero)
|
||||
|
||||
if(SYCL_FOUND AND LEVEL_ZERO_FOUND)
|
||||
message(STATUS "Found oneAPI: ${SYCL_LIBRARY}")
|
||||
if(SYCL_FOUND AND SYCL_VERSION VERSION_GREATER_EQUAL 6.0 AND LEVEL_ZERO_FOUND)
|
||||
message(STATUS "Found Level Zero: ${LEVEL_ZERO_LIBRARY}")
|
||||
|
||||
if(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
|
@ -681,7 +680,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "oneAPI or Level Zero not found, disabling WITH_CYCLES_DEVICE_ONEAPI")
|
||||
message(STATUS "SYCL 6.0+ or Level Zero not found, disabling WITH_CYCLES_DEVICE_ONEAPI")
|
||||
set(WITH_CYCLES_DEVICE_ONEAPI OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -698,11 +698,11 @@ std::vector<sycl::device> OneapiDevice::available_devices()
|
|||
int number_of_eus = 96;
|
||||
int threads_per_eu = 7;
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
||||
number_of_eus = device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
||||
number_of_eus = device.get_info<sycl::ext::intel::info::device::gpu_eu_count>();
|
||||
}
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
||||
threads_per_eu =
|
||||
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
||||
device.get_info<sycl::ext::intel::info::device::gpu_hw_threads_per_eu>();
|
||||
}
|
||||
/* This filters out all Level-Zero supported GPUs from older generation than Arc. */
|
||||
if (number_of_eus <= 96 && threads_per_eu == 7) {
|
||||
|
@ -818,7 +818,7 @@ void OneapiDevice::iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_p
|
|||
std::string name = device.get_info<sycl::info::device::name>();
|
||||
std::string id = "ONEAPI_" + platform_name + "_" + name;
|
||||
if (device.has(sycl::aspect::ext_intel_pci_address)) {
|
||||
id.append("_" + device.get_info<sycl::info::device::ext_intel_pci_address>());
|
||||
id.append("_" + device.get_info<sycl::ext::intel::info::device::pci_address>());
|
||||
}
|
||||
(cb)(id.c_str(), name.c_str(), num, user_ptr);
|
||||
num++;
|
||||
|
@ -836,7 +836,7 @@ int OneapiDevice::get_num_multiprocessors()
|
|||
{
|
||||
const sycl::device &device = reinterpret_cast<sycl::queue *>(device_queue_)->get_device();
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
||||
return device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
||||
return device.get_info<sycl::ext::intel::info::device::gpu_eu_count>();
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
@ -847,8 +847,8 @@ int OneapiDevice::get_max_num_threads_per_multiprocessor()
|
|||
const sycl::device &device = reinterpret_cast<sycl::queue *>(device_queue_)->get_device();
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_simd_width) &&
|
||||
device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
||||
return device.get_info<sycl::info::device::ext_intel_gpu_eu_simd_width>() *
|
||||
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
||||
return device.get_info<sycl::ext::intel::info::device::gpu_eu_simd_width>() *
|
||||
device.get_info<sycl::ext::intel::info::device::gpu_hw_threads_per_eu>();
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue