diff options
Diffstat (limited to 'intern/cycles/device/cuda/device_impl.cpp')
-rw-r--r-- | intern/cycles/device/cuda/device_impl.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/intern/cycles/device/cuda/device_impl.cpp b/intern/cycles/device/cuda/device_impl.cpp index f7b3c5ad77f..8d022040414 100644 --- a/intern/cycles/device/cuda/device_impl.cpp +++ b/intern/cycles/device/cuda/device_impl.cpp @@ -477,10 +477,10 @@ void CUDADevice::reserve_local_memory(const uint kernel_features) * still to make it faster. */ CUDADeviceQueue 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); @@ -678,7 +678,7 @@ CUDADevice::CUDAMem *CUDADevice::generic_alloc(device_memory &mem, size_t pitch_ void *shared_pointer = 0; - if (mem_alloc_result != CUDA_SUCCESS && can_map_host) { + if (mem_alloc_result != CUDA_SUCCESS && can_map_host && mem.type != MEM_DEVICE_ONLY) { if (mem.shared_pointer) { /* Another device already allocated host memory. */ mem_alloc_result = CUDA_SUCCESS; @@ -701,8 +701,14 @@ CUDADevice::CUDAMem *CUDADevice::generic_alloc(device_memory &mem, size_t pitch_ } if (mem_alloc_result != CUDA_SUCCESS) { - status = " failed, out of device and host memory"; - set_error("System is out of GPU and shared host memory"); + if (mem.type == MEM_DEVICE_ONLY) { + status = " failed, out of device memory"; + set_error("System is out of GPU memory"); + } + else { + status = " failed, out of device and host memory"; + set_error("System is out of GPU and shared host memory"); + } } if (mem.name) { @@ -775,6 +781,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 @@ -1141,6 +1148,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) { |