[CUDA] Fix releasing of CL_MEM_ALLOC_HOST_PTR buffers
@@ -312,9 +312,17 @@ void pocl_cuda_free(cl_device_id device, cl_mem mem_obj)
{
cuCtxSetCurrent(((pocl_cuda_device_data_t*)device->data)->context);
+ if (mem_obj->flags & CL_MEM_ALLOC_HOST_PTR)
+ {
+ cuMemFreeHost(mem_obj->mem_host_ptr);
+ mem_obj->mem_host_ptr = NULL;
+ }
+ else
+ {
void* ptr = mem_obj->device_ptrs[device->dev_id].mem_ptr;
cuMemFree((CUdeviceptr)ptr);
}
+}
void
pocl_cuda_read(void *data, void *host_ptr, const void *device_ptr,
