[Bf-blender-cvs] [85af543f000] cycles_oneapi: Cycles: Detect SYCL backends by enum, not string

Stefan Werner noreply at git.blender.org
Thu May 19 10:34:42 CEST 2022


Commit: 85af543f000d9ffc59f35b41d84d307f20aacd8f
Author: Stefan Werner
Date:   Thu May 19 10:31:51 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB85af543f000d9ffc59f35b41d84d307f20aacd8f

Cycles: Detect SYCL backends by enum, not string

Determining the SYCL backend by string parsing isn't robust,
not all OpenCL implementations use OpenCL in their name.

Use the enums in sycl::backend instead to tell opencl from L0.

===================================================================

M	intern/cycles/kernel/device/oneapi/kernel.cpp

===================================================================

diff --git a/intern/cycles/kernel/device/oneapi/kernel.cpp b/intern/cycles/kernel/device/oneapi/kernel.cpp
index 2f8608da819..cb85bc458cb 100644
--- a/intern/cycles/kernel/device/oneapi/kernel.cpp
+++ b/intern/cycles/kernel/device/oneapi/kernel.cpp
@@ -730,10 +730,10 @@ static std::vector<sycl::device> oneapi_available_devices()
 
   std::vector<sycl::device> available_devices;
   for (const sycl::platform &platform : oneapi_platforms) {
-    const std::string &platform_name = platform.get_info<sycl::info::platform::name>();
     // ignore OpenCL platforms to avoid using the same devices through both Level-Zero and OpenCL
-    if (platform_name.find("OpenCL") != std::string::npos)
+    if (platform.get_backend() == sycl::backend::opencl) {
       continue;
+    }
 
     const std::vector<sycl::device> &oneapi_devices =
         (allow_all_devices || allow_host) ? platform.get_devices(sycl::info::device_type::all) :
@@ -749,7 +749,7 @@ static std::vector<sycl::device> oneapi_available_devices()
         // 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
-        if (device.is_gpu()) {
+        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};



More information about the Bf-blender-cvs mailing list