mirror of
https://projects.blender.org/blender/blender.git
synced 2025-01-22 07:22:12 -05:00
Cycles: Make OIDN on GPU use the existing SYCL queue
There's already a queue from the Cycles rendering device, so let OIDN use the same instead of creating a new one. Co-authored-by: Werner, Stefan <stefan.werner@intel.com> Pull Request: https://projects.blender.org/blender/blender/pulls/115650
This commit is contained in:
parent
3e7b8381cc
commit
8a6f7640d6
3 changed files with 17 additions and 14 deletions
|
@ -4,6 +4,10 @@
|
|||
|
||||
#ifdef WITH_ONEAPI
|
||||
|
||||
/* <algorithm> is needed until included upstream in sycl/detail/property_list_base.hpp */
|
||||
# include <algorithm>
|
||||
# include <sycl/sycl.hpp>
|
||||
|
||||
# include "device/oneapi/device_impl.h"
|
||||
|
||||
# include "util/debug.h"
|
||||
|
@ -25,6 +29,9 @@ extern "C" bool rtcIsSYCLDeviceSupported(const sycl::device sycl_device);
|
|||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
static std::vector<sycl::device> available_sycl_devices();
|
||||
static int parse_driver_build_version(const sycl::device &device);
|
||||
|
||||
static void queue_error_cb(const char *message, void *user_ptr)
|
||||
{
|
||||
if (user_ptr) {
|
||||
|
@ -574,7 +581,7 @@ bool OneapiDevice::create_queue(SyclQueue *&external_queue,
|
|||
{
|
||||
bool finished_correct = true;
|
||||
try {
|
||||
std::vector<sycl::device> devices = OneapiDevice::available_devices();
|
||||
std::vector<sycl::device> devices = available_sycl_devices();
|
||||
if (device_index < 0 || device_index >= devices.size()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -862,7 +869,7 @@ static const int lowest_supported_driver_version_neo = 26957;
|
|||
static const int lowest_supported_driver_version_neo = 26918;
|
||||
# endif
|
||||
|
||||
int OneapiDevice::parse_driver_build_version(const sycl::device &device)
|
||||
int parse_driver_build_version(const sycl::device &device)
|
||||
{
|
||||
const std::string &driver_version = device.get_info<sycl::info::device::driver_version>();
|
||||
int driver_build_version = 0;
|
||||
|
@ -901,7 +908,7 @@ int OneapiDevice::parse_driver_build_version(const sycl::device &device)
|
|||
return driver_build_version;
|
||||
}
|
||||
|
||||
std::vector<sycl::device> OneapiDevice::available_devices()
|
||||
std::vector<sycl::device> available_sycl_devices()
|
||||
{
|
||||
bool allow_all_devices = false;
|
||||
if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr) {
|
||||
|
@ -971,7 +978,7 @@ char *OneapiDevice::device_capabilities()
|
|||
{
|
||||
std::stringstream capabilities;
|
||||
|
||||
const std::vector<sycl::device> &oneapi_devices = available_devices();
|
||||
const std::vector<sycl::device> &oneapi_devices = available_sycl_devices();
|
||||
for (const sycl::device &device : oneapi_devices) {
|
||||
# ifndef WITH_ONEAPI_SYCL_HOST_TASK
|
||||
const std::string &name = device.get_info<sycl::info::device::name>();
|
||||
|
@ -1080,7 +1087,7 @@ char *OneapiDevice::device_capabilities()
|
|||
void OneapiDevice::iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr)
|
||||
{
|
||||
int num = 0;
|
||||
std::vector<sycl::device> devices = OneapiDevice::available_devices();
|
||||
std::vector<sycl::device> devices = available_sycl_devices();
|
||||
for (sycl::device &device : devices) {
|
||||
const std::string &platform_name =
|
||||
device.get_platform().get_info<sycl::info::platform::name>();
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#ifdef WITH_ONEAPI
|
||||
|
||||
/* <algorithm> is needed until included upstream in sycl/detail/property_list_base.hpp */
|
||||
# include <algorithm>
|
||||
# include <sycl/sycl.hpp>
|
||||
|
||||
# include "device/device.h"
|
||||
# include "device/oneapi/device.h"
|
||||
# include "device/oneapi/queue.h"
|
||||
|
@ -106,9 +101,7 @@ class OneapiDevice : public Device {
|
|||
void *usm_aligned_alloc_host(size_t memory_size, size_t alignment);
|
||||
void usm_free(void *usm_ptr);
|
||||
|
||||
static std::vector<sycl::device> available_devices();
|
||||
static char *device_capabilities();
|
||||
static int parse_driver_build_version(const sycl::device &device);
|
||||
static void iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr);
|
||||
|
||||
size_t get_memcapacity();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
# include <array>
|
||||
|
||||
# include "device/device.h"
|
||||
# include "device/oneapi/device_impl.h"
|
||||
# include "device/queue.h"
|
||||
# include "integrator/pass_accessor_cpu.h"
|
||||
# include "session/buffers.h"
|
||||
|
@ -114,9 +115,11 @@ bool OIDNDenoiserGPU::denoise_create_if_needed(DenoiseContext &context)
|
|||
}
|
||||
|
||||
switch (denoiser_device_->info.type) {
|
||||
# if defined(OIDN_DEVICE_SYCL)
|
||||
# if defined(OIDN_DEVICE_SYCL) && defined(WITH_ONEAPI)
|
||||
case DEVICE_ONEAPI:
|
||||
oidn_device_ = oidnNewDevice(OIDN_DEVICE_TYPE_SYCL);
|
||||
oidn_device_ = oidnNewSYCLDevice(
|
||||
(const sycl::queue *)reinterpret_cast<OneapiDevice *>(denoiser_device_)->sycl_queue(),
|
||||
1);
|
||||
denoiser_queue_->init_execution();
|
||||
break;
|
||||
# endif
|
||||
|
|
Loading…
Reference in a new issue