Commit 66cad621 by MORITA Kazutaka Committed by Tianqi Chen

[RUNTIME][OPENCL] clFinish before releasing memory (#2737)

parent ef58291d
...@@ -110,6 +110,10 @@ void* OpenCLWorkspace::AllocDataSpace( ...@@ -110,6 +110,10 @@ void* OpenCLWorkspace::AllocDataSpace(
} }
void OpenCLWorkspace::FreeDataSpace(TVMContext ctx, void* ptr) { void OpenCLWorkspace::FreeDataSpace(TVMContext ctx, void* ptr) {
// We have to make sure that the memory object is not in the command queue
// for some OpenCL platforms.
OPENCL_CALL(clFinish(this->GetQueue(ctx)));
cl_mem mptr = static_cast<cl_mem>(ptr); cl_mem mptr = static_cast<cl_mem>(ptr);
OPENCL_CALL(clReleaseMemObject(mptr)); OPENCL_CALL(clReleaseMemObject(mptr));
} }
......
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