Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/device/device.cpp')
-rw-r--r--intern/cycles/device/device.cpp46
1 files changed, 43 insertions, 3 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index ea5b3c6dc8c..ace6ed517f5 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -16,6 +16,7 @@
#include "device/hip/device.h"
#include "device/metal/device.h"
#include "device/multi/device.h"
+#include "device/oneapi/device.h"
#include "device/optix/device.h"
#include "util/foreach.h"
@@ -39,6 +40,7 @@ vector<DeviceInfo> Device::optix_devices;
vector<DeviceInfo> Device::cpu_devices;
vector<DeviceInfo> Device::hip_devices;
vector<DeviceInfo> Device::metal_devices;
+vector<DeviceInfo> Device::oneapi_devices;
uint Device::devices_initialized_mask = 0;
/* Device */
@@ -101,6 +103,13 @@ Device *Device::create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
device = device_metal_create(info, stats, profiler);
break;
#endif
+
+#ifdef WITH_ONEAPI
+ case DEVICE_ONEAPI:
+ device = device_oneapi_create(info, stats, profiler);
+ break;
+#endif
+
default:
break;
}
@@ -126,6 +135,8 @@ DeviceType Device::type_from_string(const char *name)
return DEVICE_HIP;
else if (strcmp(name, "METAL") == 0)
return DEVICE_METAL;
+ else if (strcmp(name, "ONEAPI") == 0)
+ return DEVICE_ONEAPI;
return DEVICE_NONE;
}
@@ -144,6 +155,8 @@ string Device::string_from_type(DeviceType type)
return "HIP";
else if (type == DEVICE_METAL)
return "METAL";
+ else if (type == DEVICE_ONEAPI)
+ return "ONEAPI";
return "";
}
@@ -164,6 +177,9 @@ vector<DeviceType> Device::available_types()
#ifdef WITH_METAL
types.push_back(DEVICE_METAL);
#endif
+#ifdef WITH_ONEAPI
+ types.push_back(DEVICE_ONEAPI);
+#endif
return types;
}
@@ -219,6 +235,20 @@ vector<DeviceInfo> Device::available_devices(uint mask)
}
#endif
+#ifdef WITH_ONEAPI
+ if (mask & DEVICE_MASK_ONEAPI) {
+ if (!(devices_initialized_mask & DEVICE_MASK_ONEAPI)) {
+ if (device_oneapi_init()) {
+ device_oneapi_info(oneapi_devices);
+ }
+ devices_initialized_mask |= DEVICE_MASK_ONEAPI;
+ }
+ foreach (DeviceInfo &info, oneapi_devices) {
+ devices.push_back(info);
+ }
+ }
+#endif
+
if (mask & DEVICE_MASK_CPU) {
if (!(devices_initialized_mask & DEVICE_MASK_CPU)) {
device_cpu_info(cpu_devices);
@@ -282,6 +312,15 @@ string Device::device_capabilities(uint mask)
}
#endif
+#ifdef WITH_ONEAPI
+ if (mask & DEVICE_MASK_ONEAPI) {
+ if (device_oneapi_init()) {
+ capabilities += "\noneAPI device capabilities:\n";
+ capabilities += device_oneapi_capabilities();
+ }
+ }
+#endif
+
#ifdef WITH_METAL
if (mask & DEVICE_MASK_METAL) {
if (device_metal_init()) {
@@ -325,8 +364,8 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
int orig_cpu_threads = (threads) ? threads : TaskScheduler::max_concurrency();
int cpu_threads = max(orig_cpu_threads - (subdevices.size() - 1), size_t(0));
- VLOG(1) << "CPU render threads reduced from " << orig_cpu_threads << " to " << cpu_threads
- << ", to dedicate to GPU.";
+ VLOG_INFO << "CPU render threads reduced from " << orig_cpu_threads << " to "
+ << cpu_threads << ", to dedicate to GPU.";
if (cpu_threads >= 1) {
DeviceInfo cpu_device = device;
@@ -338,7 +377,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
}
}
else {
- VLOG(1) << "CPU render threads disabled for interactive render.";
+ VLOG_INFO << "CPU render threads disabled for interactive render.";
continue;
}
}
@@ -380,6 +419,7 @@ void Device::free_memory()
cuda_devices.free_memory();
optix_devices.free_memory();
hip_devices.free_memory();
+ oneapi_devices.free_memory();
cpu_devices.free_memory();
metal_devices.free_memory();
}