[Bf-blender-cvs] [063055b3a5a] cycles_oneapi: Cleanup: use C-style comments in oneAPI implementation
Xavier Hallade
noreply at git.blender.org
Wed Jun 22 12:22:23 CEST 2022
Commit: 063055b3a5a2b2d6c4b1f6bd8a1c4ef163718321
Author: Xavier Hallade
Date: Wed Jun 22 12:22:15 2022 +0200
Branches: cycles_oneapi
https://developer.blender.org/rB063055b3a5a2b2d6c4b1f6bd8a1c4ef163718321
Cleanup: use C-style comments in oneAPI implementation
===================================================================
M intern/cycles/device/oneapi/device.cpp
M intern/cycles/device/oneapi/device_impl.cpp
M intern/cycles/device/oneapi/device_impl.h
M intern/cycles/device/oneapi/queue.cpp
M intern/cycles/kernel/device/gpu/parallel_active_index.h
M intern/cycles/kernel/device/oneapi/compat.h
M intern/cycles/kernel/device/oneapi/context_begin.h
M intern/cycles/kernel/device/oneapi/device_id.h
M intern/cycles/kernel/device/oneapi/dll_interface_template.h
M intern/cycles/kernel/device/oneapi/kernel.cpp
M intern/cycles/kernel/device/oneapi/kernel.h
===================================================================
diff --git a/intern/cycles/device/oneapi/device.cpp b/intern/cycles/device/oneapi/device.cpp
index 326bdfabe92..b6f0f0c2b42 100644
--- a/intern/cycles/device/oneapi/device.cpp
+++ b/intern/cycles/device/oneapi/device.cpp
@@ -47,7 +47,7 @@ bool device_oneapi_init()
# endif
void *lib_handle = LOAD_ONEAPI_SHARED_LIBRARY(lib_path.c_str());
- // This shouldn't happens, but still make sense to have a branch for this
+ /* This shouldn't happen, but it still makes sense to have a branch for this. */
if (lib_handle == NULL) {
LOG(ERROR) << "oneAPI kernel shared library cannot be loaded for some reason. This should not "
"happen, however, it occurs hence oneAPI rendering will be disabled";
@@ -69,16 +69,16 @@ bool device_oneapi_init()
VLOG_INFO << "oneAPI kernel shared library has been loaded successfully";
- // We need to have this oneapi kernel shared library during all life-span of the Blender.
- // So it is not unloaded because of this.
- // FREE_SHARED_LIBRARY(lib_handle);
+ /* We need to have this oneapi kernel shared library during all life-span of the Blender.
+ * So it is not unloaded because of this.
+ * FREE_SHARED_LIBRARY(lib_handle); */
- // NOTE(@nsirgien): we need to enable JIT cache from here and
- // right now this cache policy is controlled by env. variables
- // NOTE(hallade) we also disable use of copy engine as it
- // improves stability as of intel/llvm sycl-nightly/20220529.
- // All these env variable can be set beforehand by end-users and
- // will in that case -not- be overwritten.
+ /* NOTE(@nsirgien): we need to enable JIT cache from here and
+ * right now this cache policy is controlled by env. variables. */
+ /* NOTE(hallade) we also disable use of copy engine as it
+ * improves stability as of intel/llvm sycl-nightly/20220529.
+ * All these env variable can be set beforehand by end-users and
+ * will in that case -not- be overwritten. */
# ifdef _WIN32
if (getenv("SYCL_CACHE_PERSISTENT") == nullptr) {
_putenv_s("SYCL_CACHE_PERSISTENT", "1");
@@ -136,7 +136,7 @@ static void device_iterator_cb(const char *id, const char *name, int num, void *
info.description = name;
info.num = num;
- // NOTE(@nsirgien): Should be unique at least on proper oneapi installation
+ /* NOTE(@nsirgien): Should be unique at least on proper oneapi installation. */
info.id = id;
info.has_nanovdb = true;
@@ -144,11 +144,11 @@ static void device_iterator_cb(const char *id, const char *name, int num, void *
info.has_gpu_queue = true;
- // NOTE(@nsirgien): oneAPI right now is focused on one device usage. In future it maybe will
- // change, but right now peer access from one device to another device is not supported
+ /* NOTE(@nsirgien): oneAPI right now is focused on one device usage. In future it maybe will
+ * change, but right now peer access from one device to another device is not supported. */
info.has_peer_memory = false;
- // NOTE(@nsirgien): Seems not possible to know from SYCL/oneAPI or Level0.
+ /* NOTE(@nsirgien): Seems not possible to know from SYCL/oneAPI or Level0. */
info.display_device = false;
devices->push_back(info);
diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp
index a2f79fa1bed..5a53f1a45be 100644
--- a/intern/cycles/device/oneapi/device_impl.cpp
+++ b/intern/cycles/device/oneapi/device_impl.cpp
@@ -35,7 +35,7 @@ OneapiDevice::OneapiDevice(const DeviceInfo &info,
oneapi_dll.oneapi_set_error_cb(queue_error_cb, &oneapi_error_string);
- // Oneapi calls should be initialised on this moment;
+ /* Oneapi calls should be initialised on this moment. */
assert(oneapi_dll.oneapi_create_queue != nullptr);
bool is_finished_ok = oneapi_dll.oneapi_create_queue(device_queue, info.num);
@@ -93,8 +93,8 @@ BVHLayoutMask OneapiDevice::get_bvh_layout_mask() const
bool OneapiDevice::load_kernels(const uint requested_features)
{
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.
+ /* 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);
@@ -120,20 +120,20 @@ void OneapiDevice::generic_alloc(device_memory &mem)
{
size_t memory_size = mem.memory_size();
- // TODO(@nsirgien): In future, if scene doesn't fit into device memory, then
- // we can use USM host memory.
- // Because of the expected performance impact, implementation of this has had a low priority
- // and is not implemented yet.
+ /* TODO(@nsirgien): In future, if scene doesn't fit into device memory, then
+ * we can use USM host memory.
+ * Because of the expected performance impact, implementation of this has had a low priority
+ * and is not implemented yet. */
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
- // on device, without need to worry about explicit memory transfer operations. But for
- // Blender/Cycles this type of memory is not very suitable in current application architecture,
- // 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.
+ /* 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
+ * on device, without need to worry about explicit memory transfer operations. But for
+ * Blender/Cycles this type of memory is not very suitable in current application architecture,
+ * 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);
if (device_pointer == nullptr) {
size_t max_memory_on_device = oneapi_dll.oneapi_get_memcapacity(device_queue);
@@ -156,14 +156,14 @@ void OneapiDevice::generic_copy_to(device_memory &mem)
{
size_t memory_size = mem.memory_size();
- // copy operation from host shouldn't be requested if there is no memory allocated on host.
+ /* 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);
}
-// TODO: Make sycl::queue part of OneapiQueue and avoid using pointers to sycl::queue.
+/* TODO: Make sycl::queue part of OneapiQueue and avoid using pointers to sycl::queue. */
SyclQueue *OneapiDevice::sycl_queue()
{
return device_queue;
@@ -376,7 +376,7 @@ void OneapiDevice::tex_alloc(device_texture &mem)
generic_alloc(mem);
generic_copy_to(mem);
- // Resize if needed. Also, in case of resize - allocate in advance for future allocs.
+ /* 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);
@@ -390,7 +390,7 @@ void OneapiDevice::tex_alloc(device_texture &mem)
void OneapiDevice::tex_free(device_texture &mem)
{
- // There is no texture memory in SYCL.
+ /* There is no texture memory in SYCL. */
if (mem.device_pointer) {
generic_free(mem);
}
@@ -403,8 +403,8 @@ unique_ptr<DeviceQueue> OneapiDevice::gpu_queue_create()
bool OneapiDevice::should_use_graphics_interop()
{
- // NOTE(@nsirgien): oneAPI doesn't yet support direct writing into graphics API objects, so
- // return false.
+ /* NOTE(@nsirgien): oneAPI doesn't yet support direct writing into graphics API objects, so
+ * return false. */
return false;
}
diff --git a/intern/cycles/device/oneapi/device_impl.h b/intern/cycles/device/oneapi/device_impl.h
index e3bdaa959af..af5cbce4332 100644
--- a/intern/cycles/device/oneapi/device_impl.h
+++ b/intern/cycles/device/oneapi/device_impl.h
@@ -89,8 +89,8 @@ class OneapiDevice : public Device {
virtual unique_ptr<DeviceQueue> gpu_queue_create() override;
- // NOTE(@nsirgien): Create this methods to avoid some compilation problems on Windows with host
- // side compilation (MSVC)
+ /* NOTE(@nsirgien): Create this methods to avoid some compilation problems on Windows with host
+ * side compilation (MSVC). */
void *usm_aligned_alloc_host(size_t memory_size, size_t alignment);
void usm_free(void *usm_ptr);
};
diff --git a/intern/cycles/device/oneapi/queue.cpp b/intern/cycles/device/oneapi/queue.cpp
index 52a8a429208..42e2408ee7a 100644
--- a/intern/cycles/device/oneapi/queue.cpp
+++ b/intern/cycles/device/oneapi/queue.cpp
@@ -38,20 +38,20 @@ int OneapiDeviceQueue::num_concurrent_states(const size_t state_size) const
{
int num_states;
- // TODO: implement and use get_num_multiprocessors and get_max_num_threads_per_multiprocessor.
+ /* TODO: implement and use get_num_multiprocessors and get_max_num_threads_per_multiprocessor. */
const size_t compute_units = oneapi_dll_.oneapi_get_compute_units_amount(
oneapi_device_->sycl_queue());
if (compute_units >= 128) {
- // dGPU path, make sense to allocate more states, because it will be dedicated GPU memory
+ /* dGPU path, make sense to allocate more states, because it will be dedicated GPU memory. */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list