[Bf-blender-cvs] [abaf8004aa9] cycles_oneapi: Cleanup: Move OneAPI DLL interface struct to own header

Sergey Sharybin noreply at git.blender.org
Tue Apr 19 17:01:22 CEST 2022


Commit: abaf8004aa90f540dacd6d1c6cff66ff8678fa04
Author: Sergey Sharybin
Date:   Tue Apr 19 15:38:53 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rBabaf8004aa90f540dacd6d1c6cff66ff8678fa04

Cleanup: Move OneAPI DLL interface struct to own header

There is no need for it to be a part of public device header.

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

M	intern/cycles/device/oneapi/device.cpp
M	intern/cycles/device/oneapi/device.h
M	intern/cycles/device/oneapi/device_impl.cpp
M	intern/cycles/device/oneapi/device_impl.h
A	intern/cycles/device/oneapi/dll_interface.h
M	intern/cycles/device/oneapi/queue.h

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

diff --git a/intern/cycles/device/oneapi/device.cpp b/intern/cycles/device/oneapi/device.cpp
index 9677a631815..78a58a2f538 100644
--- a/intern/cycles/device/oneapi/device.cpp
+++ b/intern/cycles/device/oneapi/device.cpp
@@ -20,7 +20,7 @@
 CCL_NAMESPACE_BEGIN
 
 #ifdef WITH_ONEAPI
-static oneAPIDLLInterface oneapi_dll;
+static OneAPIDLLInterface oneapi_dll;
 #endif
 
 #ifdef _WIN32
diff --git a/intern/cycles/device/oneapi/device.h b/intern/cycles/device/oneapi/device.h
index 41de1968290..db8c985d4d5 100644
--- a/intern/cycles/device/oneapi/device.h
+++ b/intern/cycles/device/oneapi/device.h
@@ -6,17 +6,6 @@
 #include "util/string.h"
 #include "util/vector.h"
 
-#include "kernel/device/oneapi/kernel.h"
-
-#ifdef WITH_ONEAPI
-struct oneAPIDLLInterface {
-#  define DLL_INTERFACE_CALL(function, return_type, ...) \
-    return_type (*function)(__VA_ARGS__) = nullptr;
-#  include "kernel/device/oneapi/dll_interface_template.h"
-#  undef DLL_INTERFACE_CALL
-};
-#endif
-
 CCL_NAMESPACE_BEGIN
 
 class Device;
diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp
index 5aed2fabcdb..b7ded8dc3b0 100644
--- a/intern/cycles/device/oneapi/device_impl.cpp
+++ b/intern/cycles/device/oneapi/device_impl.cpp
@@ -20,7 +20,7 @@ static void queue_error_cb(const char *message, void *user_ptr)
 }
 
 OneapiDevice::OneapiDevice(const DeviceInfo &info,
-                           oneAPIDLLInterface &oneapi_dll_object,
+                           OneAPIDLLInterface &oneapi_dll_object,
                            Stats &stats,
                            Profiler &profiler)
     : Device(info, stats, profiler),
@@ -179,7 +179,7 @@ string OneapiDevice::oneapi_error_message()
   return string(oneapi_error_string.c_str());
 }
 
-oneAPIDLLInterface OneapiDevice::oneapi_dll_object()
+OneAPIDLLInterface OneapiDevice::oneapi_dll_object()
 {
   return oneapi_dll;
 }
diff --git a/intern/cycles/device/oneapi/device_impl.h b/intern/cycles/device/oneapi/device_impl.h
index ffc3150dac1..3f055cf7fee 100644
--- a/intern/cycles/device/oneapi/device_impl.h
+++ b/intern/cycles/device/oneapi/device_impl.h
@@ -24,7 +24,7 @@ class OneapiDevice : public Device {
   void *kg_memory;
   void *kg_memory_device;
   size_t kg_memory_size = (size_t)0;
-  oneAPIDLLInterface oneapi_dll;
+  OneAPIDLLInterface oneapi_dll;
   std::string oneapi_error_string;
 
  public:
@@ -34,7 +34,7 @@ class OneapiDevice : public Device {
   // void set_error(const string &error) override;
 
   OneapiDevice(const DeviceInfo &info,
-               oneAPIDLLInterface &oneapi_dll_object,
+               OneAPIDLLInterface &oneapi_dll_object,
                Stats &stats,
                Profiler &profiler);
 
@@ -58,7 +58,7 @@ class OneapiDevice : public Device {
 
   string oneapi_error_message();
 
-  oneAPIDLLInterface oneapi_dll_object();
+  OneAPIDLLInterface oneapi_dll_object();
 
   void *kernel_globals_device_pointer();
 
diff --git a/intern/cycles/device/oneapi/dll_interface.h b/intern/cycles/device/oneapi/dll_interface.h
new file mode 100644
index 00000000000..bc681ff8f64
--- /dev/null
+++ b/intern/cycles/device/oneapi/dll_interface.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright 2011-2022 Blender Foundation */
+
+#pragma once
+
+/* Include kernel header to get access to sycl-specific types, like SyclQueue and
+ * OneAPIDeviceIteratorCallback. */
+#include "kernel/device/oneapi/kernel.h"
+
+#ifdef WITH_ONEAPI
+struct OneAPIDLLInterface {
+#  define DLL_INTERFACE_CALL(function, return_type, ...) \
+    return_type (*function)(__VA_ARGS__) = nullptr;
+#  include "kernel/device/oneapi/dll_interface_template.h"
+#  undef DLL_INTERFACE_CALL
+};
+#endif
diff --git a/intern/cycles/device/oneapi/queue.h b/intern/cycles/device/oneapi/queue.h
index b8c28d0d0d9..42d9ac074b1 100644
--- a/intern/cycles/device/oneapi/queue.h
+++ b/intern/cycles/device/oneapi/queue.h
@@ -11,6 +11,7 @@
 #  include <set>
 
 #  include "device/oneapi/device.h"
+#  include "device/oneapi/dll_interface.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -41,7 +42,7 @@ class OneapiDeviceQueue : public DeviceQueue {
 
  protected:
   OneapiDevice *oneapi_device;
-  oneAPIDLLInterface oneapi_dll;
+  OneAPIDLLInterface oneapi_dll;
   KernelContext *kernel_context;
   bool with_kernel_statistics;
 };



More information about the Bf-blender-cvs mailing list