Unmap memory object right after the buffer is read.

Change-Id: Ic7c355dc005b8071a3b5db347f51882d89d2160f
This commit is contained in:
Kohei Yoshida 2014-12-18 13:53:29 -05:00
parent 20f8006e21
commit 64c479e9da

View File

@ -3688,6 +3688,14 @@ public:
mnGroupLength * sizeof(double), 0, NULL, NULL,
&err);
if (err != CL_SUCCESS)
{
SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCL error: " << err);
mpResBuf = NULL;
return;
}
err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpCLResBuf, mpResBuf, 0, NULL, NULL);
if (err != CL_SUCCESS)
{
SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCL error: " << err);
@ -3701,18 +3709,6 @@ public:
return false;
rDoc.SetFormulaResults(rTopPos, mpResBuf, mnGroupLength);
// Obtain cl context
::opencl::KernelEnv kEnv;
::opencl::setKernelEnv(&kEnv);
cl_int err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpCLResBuf, mpResBuf, 0, NULL, NULL);
if (err != CL_SUCCESS)
{
SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCL error: " << err);
return false;
}
return true;
}
};