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/cuda | |
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/cuda')
-rw-r--r-- | intern/cycles/device/cuda/device_impl.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/intern/cycles/device/cuda/device_impl.cpp b/intern/cycles/device/cuda/device_impl.cpp index 2bb0592bcc5..20945796a2d 100644 --- a/intern/cycles/device/cuda/device_impl.cpp +++ b/intern/cycles/device/cuda/device_impl.cpp @@ -777,6 +777,7 @@ void CUDADevice::generic_free(device_memory &mem) if (mem.device_pointer) { CUDAContextScope scope(this); thread_scoped_lock lock(cuda_mem_map_mutex); + DCHECK(cuda_mem_map.find(&mem) != cuda_mem_map.end()); const CUDAMem &cmem = cuda_mem_map[&mem]; /* If cmem.use_mapped_host is true, reference counting is used @@ -1145,6 +1146,7 @@ void CUDADevice::tex_free(device_texture &mem) if (mem.device_pointer) { CUDAContextScope scope(this); thread_scoped_lock lock(cuda_mem_map_mutex); + DCHECK(cuda_mem_map.find(&mem) != cuda_mem_map.end()); const CUDAMem &cmem = cuda_mem_map[&mem]; if (cmem.texobject) { |