diff options
author | Xavier Hallade <xavier.hallade@intel.com> | 2022-10-28 00:09:14 +0300 |
---|---|---|
committer | Xavier Hallade <xavier.hallade@intel.com> | 2022-10-28 00:09:14 +0300 |
commit | 454dd3f7f0a30837c58cece3740754e2fdd7a6c4 (patch) | |
tree | 2f286598c303dc4b5c462062609fd369b42a2ed6 /intern/cycles | |
parent | 7c3cd63f95f8cb54aece57b4a4788abd10a11253 (diff) |
Cycles: fix up logic in oneAPI devices filtering
CYCLES_ONEAPI_ALL_DEVICES environment variable wasn't working as
intended after 305b92e05f748a0fd9cb62b9829791d717ba2d57.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/device/oneapi/device_impl.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp index 3588b75713b..d0ddd69289c 100644 --- a/intern/cycles/device/oneapi/device_impl.cpp +++ b/intern/cycles/device/oneapi/device_impl.cpp @@ -668,8 +668,9 @@ int OneapiDevice::parse_driver_build_version(const sycl::device &device) std::vector<sycl::device> OneapiDevice::available_devices() { bool allow_all_devices = false; - if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr) + if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr) { allow_all_devices = true; + } const std::vector<sycl::platform> &oneapi_platforms = sycl::platform::get_platforms(); @@ -686,15 +687,16 @@ std::vector<sycl::device> OneapiDevice::available_devices() platform.get_devices(sycl::info::device_type::gpu); for (const sycl::device &device : oneapi_devices) { + bool filter_out = false; if (!allow_all_devices) { - bool filter_out = false; - /* 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) { - /* Filtered-out defaults in-case these values aren't available through too old L0 - * runtime. */ + if (!device.is_gpu() || platform.get_backend() != sycl::backend::ext_oneapi_level_zero) { + filter_out = true; + } + else { + /* Filtered-out defaults in-case these values aren't available. */ int number_of_eus = 96; int threads_per_eu = 7; if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) { @@ -718,13 +720,9 @@ std::vector<sycl::device> OneapiDevice::available_devices() } } } - else if (!allow_all_devices) { - filter_out = true; - } - - if (!filter_out) { - available_devices.push_back(device); - } + } + if (!filter_out) { + available_devices.push_back(device); } } } |