diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-11-22 19:07:55 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-11-22 19:26:59 +0300 |
commit | 336ca6796a7a6ee26ff6d889643df07a37efa554 (patch) | |
tree | f2891e3dabf7d6740978f8ae82a9436d5823b467 /intern/cycles/device/hip | |
parent | 25c83c217b1fbf19d67363aa7d5bdeda46b0b6d9 (diff) |
Fix T90308: Cycles crash copying memory from device to host
Happens when device runs out of memory and Cycles is moving some
textures to the host memory.
The delayed memory free for OptiX BVH was moving data from one
device_memory to another, leaving the original device memory in
an invalid state. This was ruining the allocation map in the CUDA
device which is using pointer to the device_memory.
This change makes it so the memory pointer is stolen from BVH
into the delayed memory free list.
Additionally, forbid copying and moving instances of device_memory
and added sanity checks in the device implementation.
Differential Revision: https://developer.blender.org/D13316
Diffstat (limited to 'intern/cycles/device/hip')
-rw-r--r-- | intern/cycles/device/hip/device_impl.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/intern/cycles/device/hip/device_impl.cpp b/intern/cycles/device/hip/device_impl.cpp index 76e300eb132..5b0e2951c39 100644 --- a/intern/cycles/device/hip/device_impl.cpp +++ b/intern/cycles/device/hip/device_impl.cpp @@ -745,6 +745,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 @@ -1114,6 +1115,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) { |