[Libreoffice-commits] core.git: sc/source

Stephan Bergmann sbergman at redhat.com
Sun Dec 8 14:41:13 PST 2013


 sc/source/core/opencl/formulagroupcl.cxx |   46 +++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

New commits:
commit 378d71201bc1fedf9f602ceaef8c68ab51a29dd6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Dec 8 23:40:44 2013 +0100

    Improve failure log
    
    Change-Id: Icb0f0ec2e4660122d524cf7a7025d1b7f225b4cd

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 140bfd5..665ab46 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2694,7 +2694,53 @@ void DynamicKernel::CreateKernel(void)
             err = clBuildProgram(mpProgram, 1,
                     OpenclDevice::gpuEnv.mpArryDevsID, "", NULL, NULL);
             if (err != CL_SUCCESS)
+            {
+#if OSL_DEBUG_LEVEL > 0
+                if (err == CL_BUILD_PROGRAM_FAILURE)
+                {
+                    cl_build_status stat;
+                    cl_int e = clGetProgramBuildInfo(
+                        mpProgram, OpenclDevice::gpuEnv.mpArryDevsID[0],
+                        CL_PROGRAM_BUILD_STATUS, sizeof (cl_build_status),
+                        &stat, 0);
+                    SAL_WARN_IF(
+                        e != CL_SUCCESS, "sc.opencl",
+                        "after CL_BUILD_PROGRAM_FAILURE,"
+                            " clGetProgramBuildInfo(CL_PROGRAM_BUILD_STATUS)"
+                            " fails with " << e);
+                    if (e == CL_SUCCESS)
+                    {
+                        size_t n;
+                        e = clGetProgramBuildInfo(
+                            mpProgram, OpenclDevice::gpuEnv.mpArryDevsID[0],
+                            CL_PROGRAM_BUILD_LOG, 0, 0, &n);
+                        SAL_WARN_IF(
+                            e != CL_SUCCESS || n == 0, "sc.opencl",
+                            "after CL_BUILD_PROGRAM_FAILURE,"
+                                " clGetProgramBuildInfo(CL_PROGRAM_BUILD_LOG)"
+                                " fails with " << e << ", n=" << n);
+                        if (e == CL_SUCCESS && n != 0)
+                        {
+                            std::vector<char> log(n);
+                            e = clGetProgramBuildInfo(
+                                mpProgram, OpenclDevice::gpuEnv.mpArryDevsID[0],
+                                CL_PROGRAM_BUILD_LOG, n, &log[0], 0);
+                            SAL_WARN_IF(
+                                e != CL_SUCCESS || n == 0, "sc.opencl",
+                                "after CL_BUILD_PROGRAM_FAILURE,"
+                                    " clGetProgramBuildInfo("
+                                    "CL_PROGRAM_BUILD_LOG) fails with " << e);
+                            if (e == CL_SUCCESS)
+                                SAL_WARN(
+                                    "sc.opencl",
+                                    "CL_BUILD_PROGRAM_FAILURE, status " << stat
+                                        << ", log \"" << &log[0] << "\"");
+                        }
+                    }
+                }
+#endif
                 throw OpenCLError(err);
+            }
             // Generate binary out of compiled kernel.
             OpenclDevice::generatBinFromKernelSource(mpProgram,
                     (mKernelSignature+GetMD5()).c_str());


More information about the Libreoffice-commits mailing list