Skip to content

Commit

Permalink
[RUNTIME][OPENCL] clFinish before releasing memory (#2737)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazum authored and tqchen committed Mar 7, 2019
1 parent ef58291 commit 66cad62
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/opencl/opencl_device_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ void* OpenCLWorkspace::AllocDataSpace(
}

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);
OPENCL_CALL(clReleaseMemObject(mptr));
}
Expand Down

0 comments on commit 66cad62

Please sign in to comment.