Unverified Commit 9d89ffb9 authored by Chris Sullivan's avatar Chris Sullivan Committed by GitHub

Add missing cudaFree to emitted pool_base_ptr memory buffer (#640)

* Added corresponding cudaFree to the cudaMalloc for the cuda pool_base_ptr memory buffer.

* Check for temporary buffer allocation prior to freeing. Add null check on cudaFree.
parent 28602f31
......@@ -711,6 +711,10 @@ using namespace std;
}
}
}
if (temporaries_used)
{
writer << "ngraph::runtime::gpu::free_gpu_buffer(pool_base_ptr);\n";
}
writer.indent--;
// End generated function
......
......@@ -54,6 +54,14 @@ void* runtime::gpu::create_gpu_buffer(size_t buffer_size)
return allocated_buffer_pool;
}
void runtime::gpu::free_gpu_buffer(void* buffer)
{
if (buffer)
{
cudaFree(buffer);
}
}
void runtime::gpu::cuda_memcpyDtD(void* dst, void* src, size_t buffer_size)
{
cudaMemcpy(dst, src, buffer_size, cudaMemcpyDeviceToDevice);
......
......@@ -61,6 +61,7 @@ namespace ngraph
void print_gpu_f32_tensor(void* p, size_t element_count, size_t element_size);
void check_cuda_errors(CUresult err);
void* create_gpu_buffer(size_t buffer_size);
void free_gpu_buffer(void* buffer);
void cuda_memcpyDtD(void* dst, void* src, size_t buffer_size);
void cuda_memcpyHtD(void* dst, void* src, size_t buffer_size);
void cuda_memset(void* dst, int value, size_t buffer_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment