diff options
Diffstat (limited to 'intern/cycles/device/hip')
-rw-r--r-- | intern/cycles/device/hip/device.cpp | 13 | ||||
-rw-r--r-- | intern/cycles/device/hip/device_impl.cpp | 19 | ||||
-rw-r--r-- | intern/cycles/device/hip/queue.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/device/hip/queue.h | 4 |
4 files changed, 28 insertions, 14 deletions
diff --git a/intern/cycles/device/hip/device.cpp b/intern/cycles/device/hip/device.cpp index 25e932ef080..a9c7b1ba841 100644 --- a/intern/cycles/device/hip/device.cpp +++ b/intern/cycles/device/hip/device.cpp @@ -57,9 +57,16 @@ bool device_hip_init() } } else { - VLOG(1) << "HIPEW initialization failed: " - << ((hipew_result == HIPEW_ERROR_ATEXIT_FAILED) ? "Error setting up atexit() handler" : - "Error opening the library"); + if (hipew_result == HIPEW_ERROR_ATEXIT_FAILED) { + VLOG(1) << "HIPEW initialization failed: Error setting up atexit() handler"; + } + else if (hipew_result == HIPEW_ERROR_OLD_DRIVER) { + VLOG(1) << "HIPEW initialization failed: Driver version too old, requires AMD Radeon Pro " + "21.Q4 driver or newer"; + } + else { + VLOG(1) << "HIPEW initialization failed: Error opening HIP dynamic library"; + } } return result; diff --git a/intern/cycles/device/hip/device_impl.cpp b/intern/cycles/device/hip/device_impl.cpp index 950fcaf1816..4f1cbabc89b 100644 --- a/intern/cycles/device/hip/device_impl.cpp +++ b/intern/cycles/device/hip/device_impl.cpp @@ -93,7 +93,7 @@ HIPDevice::HIPDevice(const DeviceInfo &info, Stats &stats, Profiler &profiler) } /* Setup device and context. */ - result = hipGetDevice(&hipDevice, hipDevId); + result = hipDeviceGet(&hipDevice, hipDevId); if (result != hipSuccess) { set_error(string_printf("Failed to get HIP device handle from ordinal (%s)", hipewErrorString(result))); @@ -440,10 +440,10 @@ void HIPDevice::reserve_local_memory(const uint kernel_features) * still to make it faster. */ HIPDeviceQueue queue(this); - void *d_path_index = nullptr; - void *d_render_buffer = nullptr; + device_ptr d_path_index = 0; + device_ptr d_render_buffer = 0; int d_work_size = 0; - void *args[] = {&d_path_index, &d_render_buffer, &d_work_size}; + DeviceKernelArguments args(&d_path_index, &d_render_buffer, &d_work_size); queue.init_execution(); queue.enqueue(test_kernel, 1, args); @@ -738,6 +738,7 @@ void HIPDevice::generic_free(device_memory &mem) if (mem.device_pointer) { HIPContextScope scope(this); thread_scoped_lock lock(hip_mem_map_mutex); + DCHECK(hip_mem_map.find(&mem) != hip_mem_map.end()); const HIPMem &cmem = hip_mem_map[&mem]; /* If cmem.use_mapped_host is true, reference counting is used @@ -980,16 +981,16 @@ void HIPDevice::tex_alloc(device_texture &mem) << string_human_readable_number(mem.memory_size()) << " bytes. (" << string_human_readable_size(mem.memory_size()) << ")"; - hip_assert(hipArray3DCreate(&array_3d, &desc)); + hip_assert(hipArray3DCreate((hArray *)&array_3d, &desc)); if (!array_3d) { return; } HIP_MEMCPY3D param; - memset(¶m, 0, sizeof(param)); + memset(¶m, 0, sizeof(HIP_MEMCPY3D)); param.dstMemoryType = hipMemoryTypeArray; - param.dstArray = &array_3d; + param.dstArray = array_3d; param.srcMemoryType = hipMemoryTypeHost; param.srcHost = mem.host_pointer; param.srcPitch = src_pitch; @@ -1055,12 +1056,13 @@ void HIPDevice::tex_alloc(device_texture &mem) if (mem.info.data_type != IMAGE_DATA_TYPE_NANOVDB_FLOAT && mem.info.data_type != IMAGE_DATA_TYPE_NANOVDB_FLOAT3) { + /* Bindless textures. */ hipResourceDesc resDesc; memset(&resDesc, 0, sizeof(resDesc)); if (array_3d) { resDesc.resType = hipResourceTypeArray; - resDesc.res.array.h_Array = &array_3d; + resDesc.res.array.h_Array = array_3d; resDesc.flags = 0; } else if (mem.data_height > 0) { @@ -1105,6 +1107,7 @@ void HIPDevice::tex_free(device_texture &mem) if (mem.device_pointer) { HIPContextScope scope(this); thread_scoped_lock lock(hip_mem_map_mutex); + DCHECK(hip_mem_map.find(&mem) != hip_mem_map.end()); const HIPMem &cmem = hip_mem_map[&mem]; if (cmem.texobject) { diff --git a/intern/cycles/device/hip/queue.cpp b/intern/cycles/device/hip/queue.cpp index 0f053ccbeb5..81b283e8cf5 100644 --- a/intern/cycles/device/hip/queue.cpp +++ b/intern/cycles/device/hip/queue.cpp @@ -89,7 +89,9 @@ bool HIPDeviceQueue::kernel_available(DeviceKernel kernel) const return hip_device_->kernels.available(kernel); } -bool HIPDeviceQueue::enqueue(DeviceKernel kernel, const int work_size, void *args[]) +bool HIPDeviceQueue::enqueue(DeviceKernel kernel, + const int work_size, + DeviceKernelArguments const &args) { if (hip_device_->have_error()) { return false; @@ -132,7 +134,7 @@ bool HIPDeviceQueue::enqueue(DeviceKernel kernel, const int work_size, void *arg 1, shared_mem_bytes, hip_stream_, - args, + const_cast<void **>(args.values), 0), "enqueue"); diff --git a/intern/cycles/device/hip/queue.h b/intern/cycles/device/hip/queue.h index 95d1afaff0f..8040d367798 100644 --- a/intern/cycles/device/hip/queue.h +++ b/intern/cycles/device/hip/queue.h @@ -42,7 +42,9 @@ class HIPDeviceQueue : public DeviceQueue { virtual bool kernel_available(DeviceKernel kernel) const override; - virtual bool enqueue(DeviceKernel kernel, const int work_size, void *args[]) override; + virtual bool enqueue(DeviceKernel kernel, + const int work_size, + DeviceKernelArguments const &args) override; virtual bool synchronize() override; |