[Libreoffice-commits] core.git: 2 commits - opencl/source sc/source
Tor Lillqvist
tml at collabora.com
Tue Feb 10 10:30:52 PST 2015
opencl/source/openclwrapper.cxx | 1 +
sc/source/core/opencl/formulagroupcl.cxx | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
New commits:
commit 127b0efe6fee1620647a2e249cbae9b8f13ee0cd
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Feb 10 20:04:01 2015 +0200
Don't call clReleaseProgram() on the same program twice
If the clBuildProgram() failed, the lastSecondProgram variable kept as its
value the already released program handle, and later we called
clReleaseProgram() on it again. This is certainly wrong, and caused a crash at
least with my OpenCL implementation.
As such I am not sure if that lastOneProgram, lastSecondProgram etc dance is
sane...
Change-Id: Ia30426fbba9118ad7e20f13ef35daa5f78a1f0a1
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index a70c0f7..6f42d2c 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3837,6 +3837,7 @@ void DynamicKernel::CreateKernel()
SAL_INFO("sc.opencl", "Releasing program " << lastSecondProgram);
err = clReleaseProgram(lastSecondProgram);
SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseProgram failed: " << ::opencl::errorString(err));
+ lastSecondProgram = NULL;
}
if (::opencl::buildProgramFromBinary("",
&::opencl::gpuEnv, KernelHash.c_str(), 0))
commit 770c92b048df2259df1b7ce2a47f9903fc8be387
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Feb 10 19:25:58 2015 +0200
Add SAL_INFOs for tracing kernel and program life cycle
Change-Id: Icb28114d3939063dedaedbd0ce370210b3721fc5
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 658e275..5f0b991 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -442,6 +442,7 @@ bool buildProgramFromBinary(const char* buildOption, GPUEnv* gpuInfo, const char
// something went wrong, fall back to compiling from source
return false;
}
+ SAL_INFO("opencl", "Created program " << gpuInfo->mpArryPrograms[idx] << " from binary");
for(size_t i = 0; i < numDevices; ++i)
{
delete[] pBinary[i];
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index d549451..a70c0f7 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1499,6 +1499,8 @@ public:
cl_kernel redKernel = clCreateKernel(mpProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
+ SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << mpProgram);
+
// set kernel arg of reduction kernel
// TODO(Wei Wei): use unique name for kernel
cl_mem buf = Base::GetCLBuffer();
@@ -1556,6 +1558,8 @@ public:
redKernel = clCreateKernel(mpProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
+ SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << mpProgram);
+
// set kernel arg of reduction kernel
buf = Base::GetCLBuffer();
SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << 0 << ": cl_mem: " << buf);
@@ -2281,6 +2285,8 @@ public:
cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
+ SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << pProgram);
+
// set kernel arg of reduction kernel
for (size_t j = 0; j < vclmem.size(); j++)
{
@@ -2352,6 +2358,7 @@ public:
cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), &err);
if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
+ SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << pProgram);
// set kernel arg of reduction kernel
for (size_t j = 0; j < vclmem.size(); j++)
@@ -2394,6 +2401,7 @@ public:
if (CL_SUCCESS != err)
throw OpenCLError("clFinish", err, __FILE__, __LINE__);
+ SAL_INFO("sc.opencl", "Relasing kernel " << redKernel);
err = clReleaseKernel(redKernel);
SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << ::opencl::errorString(err));
@@ -3719,6 +3727,7 @@ DynamicKernel::~DynamicKernel()
}
if (mpKernel)
{
+ SAL_INFO("sc.opencl", "Releasing kernel " << mpKernel);
err = clReleaseKernel(mpKernel);
SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << ::opencl::errorString(err));
}
@@ -3825,6 +3834,7 @@ void DynamicKernel::CreateKernel()
if (lastSecondProgram)
{
+ SAL_INFO("sc.opencl", "Releasing program " << lastSecondProgram);
err = clReleaseProgram(lastSecondProgram);
SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseProgram failed: " << ::opencl::errorString(err));
}
@@ -3840,6 +3850,8 @@ void DynamicKernel::CreateKernel()
&src, NULL, &err);
if (err != CL_SUCCESS)
throw OpenCLError("clCreateProgramWithSource", err, __FILE__, __LINE__);
+ SAL_INFO("sc.opencl", "Created program " << mpProgram);
+
err = clBuildProgram(mpProgram, 1,
::opencl::gpuEnv.mpArryDevsID, "", NULL, NULL);
if (err != CL_SUCCESS)
@@ -3890,6 +3902,8 @@ void DynamicKernel::CreateKernel()
#endif
throw OpenCLError("clBuildProgram", err, __FILE__, __LINE__);
}
+ SAL_INFO("sc.opencl", "Built program " << mpProgram);
+
// Generate binary out of compiled kernel.
::opencl::generatBinFromKernelSource(mpProgram,
(mKernelSignature + GetMD5()).c_str());
@@ -3902,6 +3916,7 @@ void DynamicKernel::CreateKernel()
mpKernel = clCreateKernel(mpProgram, kname.c_str(), &err);
if (err != CL_SUCCESS)
throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
+ SAL_INFO("sc.opencl", "Created kernel " << mpKernel << " with name " << kname << " in program " << mpProgram);
}
void DynamicKernel::Launch( size_t nr )
More information about the Libreoffice-commits
mailing list