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:
authorXavier Hallade <xavier.hallade@intel.com>2022-06-22 18:27:18 +0300
committerXavier Hallade <xavier.hallade@intel.com>2022-06-22 18:28:44 +0300
commitcf55eb1c8a9aecd54073237d815ee6394a065419 (patch)
tree81580943e8a57b60351fd6b62ba7e0d9c87e7650 /intern/cycles
parentbb82e85fe21df2e530204bdd4f317dfb34778a5b (diff)
Cleanup: use _ suffix for OneapiDevice attributes
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/device/oneapi/device_impl.cpp139
-rw-r--r--intern/cycles/device/oneapi/device_impl.h18
-rw-r--r--intern/cycles/kernel/device/oneapi/kernel.cpp6
3 files changed, 83 insertions, 80 deletions
diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp
index 5a53f1a45be..8c8ab522b47 100644
--- a/intern/cycles/device/oneapi/device_impl.cpp
+++ b/intern/cycles/device/oneapi/device_impl.cpp
@@ -24,60 +24,60 @@ OneapiDevice::OneapiDevice(const DeviceInfo &info,
Stats &stats,
Profiler &profiler)
: Device(info, stats, profiler),
- device_queue(nullptr),
- texture_info(this, "texture_info", MEM_GLOBAL),
- kg_memory(nullptr),
- kg_memory_device(nullptr),
- kg_memory_size(0),
- oneapi_dll(oneapi_dll_object)
+ device_queue_(nullptr),
+ texture_info_(this, "texture_info", MEM_GLOBAL),
+ kg_memory_(nullptr),
+ kg_memory_device_(nullptr),
+ kg_memory_size_(0),
+ oneapi_dll_(oneapi_dll_object)
{
- need_texture_info = false;
+ need_texture_info_ = false;
- oneapi_dll.oneapi_set_error_cb(queue_error_cb, &oneapi_error_string);
+ oneapi_dll_.oneapi_set_error_cb(queue_error_cb, &oneapi_error_string_);
/* Oneapi calls should be initialised on this moment. */
- assert(oneapi_dll.oneapi_create_queue != nullptr);
+ assert(oneapi_dll_.oneapi_create_queue != nullptr);
- bool is_finished_ok = oneapi_dll.oneapi_create_queue(device_queue, info.num);
+ bool is_finished_ok = oneapi_dll_.oneapi_create_queue(device_queue_, info.num);
if (is_finished_ok == false) {
- set_error("oneAPI queue initialization error: got runtime exception \"" + oneapi_error_string +
- "\"");
+ set_error("oneAPI queue initialization error: got runtime exception \"" +
+ oneapi_error_string_ + "\"");
}
else {
VLOG_DEBUG << "oneAPI queue has been successfully created for the device \""
<< info.description << "\"";
- assert(device_queue);
+ assert(device_queue_);
}
size_t globals_segment_size;
- is_finished_ok = oneapi_dll.oneapi_kernel_globals_size(device_queue, globals_segment_size);
+ is_finished_ok = oneapi_dll_.oneapi_kernel_globals_size(device_queue_, globals_segment_size);
if (is_finished_ok == false) {
set_error("oneAPI constant memory initialization got runtime exception \"" +
- oneapi_error_string + "\"");
+ oneapi_error_string_ + "\"");
}
else {
VLOG_DEBUG << "Successfully created global/constant memory segment (kernel globals object)";
}
- kg_memory = oneapi_dll.oneapi_usm_aligned_alloc_host(device_queue, globals_segment_size, 16);
- oneapi_dll.oneapi_usm_memset(device_queue, kg_memory, 0, globals_segment_size);
+ kg_memory_ = oneapi_dll_.oneapi_usm_aligned_alloc_host(device_queue_, globals_segment_size, 16);
+ oneapi_dll_.oneapi_usm_memset(device_queue_, kg_memory_, 0, globals_segment_size);
- kg_memory_device = oneapi_dll.oneapi_usm_alloc_device(device_queue, globals_segment_size);
+ kg_memory_device_ = oneapi_dll_.oneapi_usm_alloc_device(device_queue_, globals_segment_size);
- kg_memory_size = globals_segment_size;
+ kg_memory_size_ = globals_segment_size;
}
OneapiDevice::~OneapiDevice()
{
- texture_info.free();
- oneapi_dll.oneapi_usm_free(device_queue, kg_memory);
- oneapi_dll.oneapi_usm_free(device_queue, kg_memory_device);
+ texture_info_.free();
+ oneapi_dll_.oneapi_usm_free(device_queue_, kg_memory_);
+ oneapi_dll_.oneapi_usm_free(device_queue_, kg_memory_device_);
- for (ConstMemMap::iterator mt = m_const_mem_map.begin(); mt != m_const_mem_map.end(); mt++)
+ for (ConstMemMap::iterator mt = const_mem_map_.begin(); mt != const_mem_map_.end(); mt++)
delete mt->second;
- if (device_queue)
- oneapi_dll.oneapi_free_queue(device_queue);
+ if (device_queue_)
+ oneapi_dll_.oneapi_free_queue(device_queue_);
}
bool OneapiDevice::check_peer_access(Device * /*peer_device*/)
@@ -92,27 +92,27 @@ BVHLayoutMask OneapiDevice::get_bvh_layout_mask() const
bool OneapiDevice::load_kernels(const uint requested_features)
{
- assert(device_queue);
+ assert(device_queue_);
/* NOTE(@nsirgien): oneAPI can support compilation of kernel code with sertain feature set
* with specialization constants, but it hasn't been implemented yet. */
(void)requested_features;
- bool is_finished_ok = oneapi_dll.oneapi_run_test_kernel(device_queue);
+ bool is_finished_ok = oneapi_dll_.oneapi_run_test_kernel(device_queue_);
if (is_finished_ok == false) {
- set_error("oneAPI kernel load: got runtime exception \"" + oneapi_error_string + "\"");
+ set_error("oneAPI kernel load: got runtime exception \"" + oneapi_error_string_ + "\"");
}
else {
VLOG_INFO << "Runtime compilation done for \"" << info.description << "\"";
- assert(device_queue);
+ assert(device_queue_);
}
return is_finished_ok;
}
void OneapiDevice::load_texture_info()
{
- if (need_texture_info) {
- need_texture_info = false;
- texture_info.copy_to_device();
+ if (need_texture_info_) {
+ need_texture_info_ = false;
+ texture_info_.copy_to_device();
}
}
@@ -125,7 +125,7 @@ void OneapiDevice::generic_alloc(device_memory &mem)
* Because of the expected performance impact, implementation of this has had a low priority
* and is not implemented yet. */
- assert(device_queue);
+ assert(device_queue_);
/* NOTE(@nsirgien): There are three types of Unified Shared Memory (USM) in oneAPI: host, device
* and shared. For new project it maybe more beneficial to use USM shared memory, because it
* provides automatic migration mechanism in order to allow to use the same pointer on host and
@@ -134,9 +134,9 @@ void OneapiDevice::generic_alloc(device_memory &mem)
* because Cycles already uses two different pointer for host activity and device activity, and
* also has to perform all needed memory transfer operations. So, USM device memory
* type has been used for oneAPI device in order to better fit in Cycles architecture. */
- void *device_pointer = oneapi_dll.oneapi_usm_alloc_device(device_queue, memory_size);
+ void *device_pointer = oneapi_dll_.oneapi_usm_alloc_device(device_queue_, memory_size);
if (device_pointer == nullptr) {
- size_t max_memory_on_device = oneapi_dll.oneapi_get_memcapacity(device_queue);
+ size_t max_memory_on_device = oneapi_dll_.oneapi_get_memcapacity(device_queue_);
set_error("oneAPI kernel - device memory allocation error for " +
string_human_readable_size(mem.memory_size()) +
", possibly caused by lack of available memory space on the device: " +
@@ -158,30 +158,30 @@ void OneapiDevice::generic_copy_to(device_memory &mem)
/* Copy operation from host shouldn't be requested if there is no memory allocated on host. */
assert(mem.host_pointer);
- assert(device_queue);
- oneapi_dll.oneapi_usm_memcpy(
- device_queue, (void *)mem.device_pointer, (void *)mem.host_pointer, memory_size);
+ assert(device_queue_);
+ oneapi_dll_.oneapi_usm_memcpy(
+ device_queue_, (void *)mem.device_pointer, (void *)mem.host_pointer, memory_size);
}
/* TODO: Make sycl::queue part of OneapiQueue and avoid using pointers to sycl::queue. */
SyclQueue *OneapiDevice::sycl_queue()
{
- return device_queue;
+ return device_queue_;
}
string OneapiDevice::oneapi_error_message()
{
- return string(oneapi_error_string);
+ return string(oneapi_error_string_);
}
OneAPIDLLInterface OneapiDevice::oneapi_dll_object()
{
- return oneapi_dll;
+ return oneapi_dll_;
}
void *OneapiDevice::kernel_globals_device_pointer()
{
- return kg_memory_device;
+ return kg_memory_device_;
}
void OneapiDevice::generic_free(device_memory &mem)
@@ -190,8 +190,8 @@ void OneapiDevice::generic_free(device_memory &mem)
stats.mem_free(mem.device_size);
mem.device_size = 0;
- assert(device_queue);
- oneapi_dll.oneapi_usm_free(device_queue, (void *)mem.device_pointer);
+ assert(device_queue_);
+ oneapi_dll_.oneapi_usm_free(device_queue_, (void *)mem.device_pointer);
mem.device_pointer = 0;
}
@@ -253,16 +253,16 @@ void OneapiDevice::mem_copy_from(device_memory &mem, size_t y, size_t w, size_t
<< " data " << size << " bytes";
}
- assert(device_queue);
+ assert(device_queue_);
assert(size != 0);
assert(mem.device_pointer);
char *shifted_host = reinterpret_cast<char *>(mem.host_pointer) + offset;
char *shifted_device = reinterpret_cast<char *>(mem.device_pointer) + offset;
- bool is_finished_ok = oneapi_dll.oneapi_usm_memcpy(
- device_queue, shifted_host, shifted_device, size);
+ bool is_finished_ok = oneapi_dll_.oneapi_usm_memcpy(
+ device_queue_, shifted_host, shifted_device, size);
if (is_finished_ok == false) {
- set_error("oneAPI memory operation error: got runtime exception \"" + oneapi_error_string +
+ set_error("oneAPI memory operation error: got runtime exception \"" + oneapi_error_string_ +
"\"");
}
}
@@ -283,11 +283,11 @@ void OneapiDevice::mem_zero(device_memory &mem)
return;
}
- assert(device_queue);
- bool is_finished_ok = oneapi_dll.oneapi_usm_memset(
- device_queue, (void *)mem.device_pointer, 0, mem.memory_size());
+ assert(device_queue_);
+ bool is_finished_ok = oneapi_dll_.oneapi_usm_memset(
+ device_queue_, (void *)mem.device_pointer, 0, mem.memory_size());
if (is_finished_ok == false) {
- set_error("oneAPI memory operation error: got runtime exception \"" + oneapi_error_string +
+ set_error("oneAPI memory operation error: got runtime exception \"" + oneapi_error_string_ +
"\"");
}
}
@@ -325,13 +325,13 @@ void OneapiDevice::const_copy_to(const char *name, void *host, size_t size)
<< string_human_readable_number(size) << " bytes. ("
<< string_human_readable_size(size) << ")";
- ConstMemMap::iterator i = m_const_mem_map.find(name);
+ ConstMemMap::iterator i = const_mem_map_.find(name);
device_vector<uchar> *data;
- if (i == m_const_mem_map.end()) {
+ if (i == const_mem_map_.end()) {
data = new device_vector<uchar>(this, name, MEM_READ_ONLY);
data->alloc(size);
- m_const_mem_map.insert(ConstMemMap::value_type(name, data));
+ const_mem_map_.insert(ConstMemMap::value_type(name, data));
}
else {
data = i->second;
@@ -341,9 +341,10 @@ void OneapiDevice::const_copy_to(const char *name, void *host, size_t size)
memcpy(data->data(), host, size);
data->copy_to_device();
- oneapi_dll.oneapi_set_global_memory(device_queue, kg_memory, name, (void *)data->device_pointer);
+ oneapi_dll_.oneapi_set_global_memory(
+ device_queue_, kg_memory_, name, (void *)data->device_pointer);
- oneapi_dll.oneapi_usm_memcpy(device_queue, kg_memory_device, kg_memory, kg_memory_size);
+ oneapi_dll_.oneapi_usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
}
void OneapiDevice::global_alloc(device_memory &mem)
@@ -358,10 +359,10 @@ void OneapiDevice::global_alloc(device_memory &mem)
generic_alloc(mem);
generic_copy_to(mem);
- oneapi_dll.oneapi_set_global_memory(
- device_queue, kg_memory, mem.name, (void *)mem.device_pointer);
+ oneapi_dll_.oneapi_set_global_memory(
+ device_queue_, kg_memory_, mem.name, (void *)mem.device_pointer);
- oneapi_dll.oneapi_usm_memcpy(device_queue, kg_memory_device, kg_memory, kg_memory_size);
+ oneapi_dll_.oneapi_usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
}
void OneapiDevice::global_free(device_memory &mem)
@@ -378,14 +379,14 @@ void OneapiDevice::tex_alloc(device_texture &mem)
/* Resize if needed. Also, in case of resize - allocate in advance for future allocs. */
const uint slot = mem.slot;
- if (slot >= texture_info.size()) {
- texture_info.resize(slot + 128);
+ if (slot >= texture_info_.size()) {
+ texture_info_.resize(slot + 128);
}
- texture_info[slot] = mem.info;
- need_texture_info = true;
+ texture_info_[slot] = mem.info;
+ need_texture_info_ = true;
- texture_info[slot].data = (uint64_t)mem.device_pointer;
+ texture_info_[slot].data = (uint64_t)mem.device_pointer;
}
void OneapiDevice::tex_free(device_texture &mem)
@@ -410,14 +411,14 @@ bool OneapiDevice::should_use_graphics_interop()
void *OneapiDevice::usm_aligned_alloc_host(size_t memory_size, size_t alignment)
{
- assert(device_queue);
- return oneapi_dll.oneapi_usm_aligned_alloc_host(device_queue, memory_size, alignment);
+ assert(device_queue_);
+ return oneapi_dll_.oneapi_usm_aligned_alloc_host(device_queue_, memory_size, alignment);
}
void OneapiDevice::usm_free(void *usm_ptr)
{
- assert(device_queue);
- return oneapi_dll.oneapi_usm_free(device_queue, usm_ptr);
+ assert(device_queue_);
+ return oneapi_dll_.oneapi_usm_free(device_queue_, usm_ptr);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/device/oneapi/device_impl.h b/intern/cycles/device/oneapi/device_impl.h
index af5cbce4332..f925687ebe9 100644
--- a/intern/cycles/device/oneapi/device_impl.h
+++ b/intern/cycles/device/oneapi/device_impl.h
@@ -15,17 +15,17 @@ class DeviceQueue;
class OneapiDevice : public Device {
private:
- SyclQueue *device_queue;
+ SyclQueue *device_queue_;
using ConstMemMap = map<string, device_vector<uchar> *>;
- ConstMemMap m_const_mem_map;
- device_vector<TextureInfo> texture_info;
- bool need_texture_info;
- void *kg_memory;
- void *kg_memory_device;
- size_t kg_memory_size = (size_t)0;
- OneAPIDLLInterface oneapi_dll;
- std::string oneapi_error_string;
+ ConstMemMap const_mem_map_;
+ device_vector<TextureInfo> texture_info_;
+ bool need_texture_info_;
+ void *kg_memory_;
+ void *kg_memory_device_;
+ size_t kg_memory_size_ = (size_t)0;
+ OneAPIDLLInterface oneapi_dll_;
+ std::string oneapi_error_string_;
public:
virtual BVHLayoutMask get_bvh_layout_mask() const override;
diff --git a/intern/cycles/kernel/device/oneapi/kernel.cpp b/intern/cycles/kernel/device/oneapi/kernel.cpp
index 8681b00a26d..da676ec92b2 100644
--- a/intern/cycles/kernel/device/oneapi/kernel.cpp
+++ b/intern/cycles/kernel/device/oneapi/kernel.cpp
@@ -718,7 +718,8 @@ static std::vector<sycl::device> oneapi_available_devices()
std::vector<sycl::device> available_devices;
for (const sycl::platform &platform : oneapi_platforms) {
- /* ignore OpenCL platforms to avoid using the same devices through both Level-Zero and OpenCL. */
+ /* ignore OpenCL platforms to avoid using the same devices through both Level-Zero and OpenCL.
+ */
if (platform.get_backend() == sycl::backend::opencl) {
continue;
}
@@ -837,7 +838,8 @@ char *oneapi_device_capabilities()
GET_NUM_ATTR(max_mem_alloc_size)
/* NOTE(@nsirgien): Implementation doesn't use image support as bindless images aren't
- * supported so we always return false, even if device supports HW texture usage acceleration. */
+ * supported so we always return false, even if device supports HW texture usage acceleration.
+ */
bool image_support = false;
WRITE_ATTR("image_support", (size_t)image_support)