diff options
author | Xavier Hallade <xavier.hallade@intel.com> | 2022-07-06 19:39:47 +0300 |
---|---|---|
committer | Xavier Hallade <xavier.hallade@intel.com> | 2022-07-06 19:55:38 +0300 |
commit | 190ad735903f7e952629ddce9ceb12b5dcf8ecdc (patch) | |
tree | 55e4770b69f6115fb9e8c83a0705efff3862c06b | |
parent | debb2337877ae333b6cf3e4dc3876a6ded4f08c3 (diff) |
Cycles oneAPI: Remove direct dependency on Level-Zero
We used it only to access device id for explicitly allowing Arc GPUs.
It made the backend require ze_loader.dll which could be problematic if
we end up using direct linking.
I've replaced filtering based on PCI device id by using other HW properties
instead (EUs, threads per EU), that are now available through Level-Zero.
-rw-r--r-- | intern/cycles/kernel/CMakeLists.txt | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/device/oneapi/device_id.h | 11 | ||||
-rw-r--r-- | intern/cycles/kernel/device/oneapi/kernel.cpp | 33 |
3 files changed, 17 insertions, 30 deletions
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index ccd694dfdfd..b893ff6ef24 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -86,7 +86,6 @@ set(SRC_KERNEL_DEVICE_ONEAPI_HEADERS device/oneapi/compat.h device/oneapi/context_begin.h device/oneapi/context_end.h - device/oneapi/device_id.h device/oneapi/globals.h device/oneapi/image.h device/oneapi/kernel.h @@ -732,8 +731,6 @@ if(WITH_CYCLES_DEVICE_ONEAPI) -O2 -o ${cycles_kernel_oneapi_lib} -I${CMAKE_CURRENT_SOURCE_DIR}/.. - -I${LEVEL_ZERO_INCLUDE_DIR} - ${LEVEL_ZERO_LIBRARY} ${SYCL_CPP_FLAGS} ) diff --git a/intern/cycles/kernel/device/oneapi/device_id.h b/intern/cycles/kernel/device/oneapi/device_id.h deleted file mode 100644 index b4c94ac27a2..00000000000 --- a/intern/cycles/kernel/device/oneapi/device_id.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 - * Copyright 2021-2022 Intel Corporation */ - -#pragma once - -/* from public source : - * https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/include/pci_ids/iris_pci_ids.h */ -const static std::set<uint32_t> intel_arc_alchemist_device_ids = { - 0x4f80, 0x4f81, 0x4f82, 0x4f83, 0x4f84, 0x4f87, 0x4f88, 0x5690, 0x5691, - 0x5692, 0x5693, 0x5694, 0x5695, 0x5696, 0x5697, 0x56a0, 0x56a1, 0x56a2, - 0x56a3, 0x56a4, 0x56a5, 0x56a6, 0x56b0, 0x56b1, 0x56b2, 0x56b3}; diff --git a/intern/cycles/kernel/device/oneapi/kernel.cpp b/intern/cycles/kernel/device/oneapi/kernel.cpp index 329d8c032f7..9b9c046de4c 100644 --- a/intern/cycles/kernel/device/oneapi/kernel.cpp +++ b/intern/cycles/kernel/device/oneapi/kernel.cpp @@ -9,12 +9,9 @@ # include <map> # include <set> -# include <level_zero/ze_api.h> # include <CL/sycl.hpp> -# include <ext/oneapi/backend/level_zero.hpp> # include "kernel/device/oneapi/compat.h" -# include "kernel/device/oneapi/device_id.h" # include "kernel/device/oneapi/globals.h" # include "kernel/device/oneapi/kernel_templates.h" @@ -752,21 +749,25 @@ static std::vector<sycl::device> oneapi_available_devices() else { bool filter_out = false; - /* For now we support all Intel(R) Arc(TM) devices - * and any future GPU with more than 128 execution units - * official support can be broaden to older and smaller GPUs once ready. */ + /* For now we support all Intel(R) Arc(TM) devices and likely any future GPU, + * assuming they have either more than 96 Execution Units or not 7 threads per EU. + * Official support can be broaden to older and smaller GPUs once ready. */ if (device.is_gpu() && platform.get_backend() == sycl::backend::ext_oneapi_level_zero) { - ze_device_handle_t ze_device = sycl::get_native<sycl::backend::ext_oneapi_level_zero>( - device); - ze_device_properties_t props = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES}; - zeDeviceGetProperties(ze_device, &props); - bool is_dg2 = (intel_arc_alchemist_device_ids.find(props.deviceId) != - intel_arc_alchemist_device_ids.end()); - int number_of_eus = props.numEUsPerSubslice * props.numSubslicesPerSlice * - props.numSlices; - if (!is_dg2 || number_of_eus < 128) + /* Filtered-out defaults in-case these values aren't available through too old L0 + * runtime. */ + 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>(); + } + 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>(); + } + /* This filters out all Level-Zero supported GPUs from older generation than Arc. */ + if (number_of_eus <= 96 && threads_per_eu == 7) { filter_out = true; - + } /* if not already filtered out, check driver version. */ if (!filter_out) { int driver_build_version = parse_driver_build_version(device); |