Skip to content

Commit

Permalink
[RUNTIME][OPENCL] clFinish before releasing memory (apache#2737)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazum authored and wweic committed Mar 9, 2019
1 parent 0d7c51b commit 789240b
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 789240b

Please sign in to comment.