[Libreoffice-commits] core.git: cui/source desktop/source include/opencl opencl/inc opencl/source sc/source

Tor Lillqvist tml at collabora.com
Fri Aug 25 13:10:19 UTC 2017


 cui/source/dialogs/about.cxx             |    2 
 cui/source/options/optopencl.cxx         |    2 
 desktop/source/app/opencl.cxx            |   10 +-
 include/opencl/openclwrapper.hxx         |    2 
 opencl/inc/opencl_device.hxx             |    9 --
 opencl/source/OpenCLZone.cxx             |    2 
 opencl/source/opencl_device.cxx          |    4 -
 opencl/source/openclwrapper.cxx          |   70 +++++++++----------
 sc/source/core/opencl/formulagroupcl.cxx |  110 +++++++++++++++----------------
 sc/source/core/opencl/opbase.cxx         |    4 -
 sc/source/core/tool/formulagroup.cxx     |    6 -
 11 files changed, 107 insertions(+), 114 deletions(-)

New commits:
commit aa7dc5fa1df23f1a9079305cb362aab018e94848
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Aug 25 15:22:40 2017 +0300

    Get rid of need to use initial :: for ::opencl to avoid clash with sc::opencl
    
    Rename the global opencl namespace to openclwrapper. Its public API is
    after all declared in a file called openclwrapper.hxx. The confusion
    started when part of the OpenCL code was moved out from sc some years
    ago.
    
    Change-Id: I98ebd8498b2244804411e5de9169eb619f86070b

diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 914c47438fcb..d5f0d2eabe89 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -335,7 +335,7 @@ OUString AboutDialog::GetVersionString()
 #if HAVE_FEATURE_OPENCL
     OUString aCalcMode = "Calc: "; // Calc calculation mode
     bool bSWInterp = officecfg::Office::Common::Misc::UseSwInterpreter::get();
-    bool bOpenCL = opencl::GPUEnv::isOpenCLEnabled();
+    bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled();
     if (bOpenCL)
         aCalcMode += "CL";
     else if (bSWInterp)
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index 731f385976be..5e94bda5a12a 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -54,7 +54,7 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
     mpUseOpenCL->Check(maConfig.mbUseOpenCL);
     mpUseOpenCL->Enable(!officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
 
-    bool bCLUsed = opencl::GPUEnv::isOpenCLEnabled();
+    bool bCLUsed = openclwrapper::GPUEnv::isOpenCLEnabled();
     mpOclUsed->Show(bCLUsed);
     mpOclNotUsed->Show(!bCLUsed);
 }
diff --git a/desktop/source/app/opencl.cxx b/desktop/source/app/opencl.cxx
index 05afc6411837..1dfc338b51d3 100644
--- a/desktop/source/app/opencl.cxx
+++ b/desktop/source/app/opencl.cxx
@@ -49,7 +49,7 @@ bool testOpenCLCompute(const Reference< XDesktop2 > &xDesktop, const OUString &r
     bool bSuccess = false;
     css::uno::Reference< css::lang::XComponent > xComponent;
 
-    sal_uInt64 nKernelFailures = opencl::kernelFailures;
+    sal_uInt64 nKernelFailures = openclwrapper::kernelFailures;
 
     SAL_INFO("opencl", "Starting CL test spreadsheet");
 
@@ -99,12 +99,12 @@ bool testOpenCLCompute(const Reference< XDesktop2 > &xDesktop, const OUString &r
         SAL_WARN("opencl", "OpenCL testing failed - disabling: " << e.Message);
     }
 
-    if (nKernelFailures != opencl::kernelFailures)
+    if (nKernelFailures != openclwrapper::kernelFailures)
     {
         // tdf#100883 - defeat SEH exception handling fallbacks.
         SAL_WARN("opencl", "OpenCL kernels failed to compile, "
                  "or took SEH exceptions "
-                 << nKernelFailures << " != " << opencl::kernelFailures);
+                 << nKernelFailures << " != " << openclwrapper::kernelFailures);
         bSuccess = false;
     }
 
@@ -119,7 +119,7 @@ bool testOpenCLCompute(const Reference< XDesktop2 > &xDesktop, const OUString &r
 
 void Desktop::CheckOpenCLCompute(const Reference< XDesktop2 > &xDesktop)
 {
-    if (!opencl::canUseOpenCL() || Application::IsSafeModeEnabled())
+    if (!openclwrapper::canUseOpenCL() || Application::IsSafeModeEnabled())
         return;
 
     SAL_INFO("opencl", "Initiating test of OpenCL device");
@@ -128,7 +128,7 @@ void Desktop::CheckOpenCLCompute(const Reference< XDesktop2 > &xDesktop)
 
     OUString aDevice = officecfg::Office::Calc::Formula::Calculation::OpenCLDevice::get();
     OUString aSelectedCLDeviceVersionID;
-    if (!opencl::switchOpenCLDevice(
+    if (!openclwrapper::switchOpenCLDevice(
             &aDevice,
             officecfg::Office::Calc::Formula::Calculation::OpenCLAutoSelect::get(),
             false /* bForceEvaluation */,
diff --git a/include/opencl/openclwrapper.hxx b/include/opencl/openclwrapper.hxx
index 5f71b2a205f3..1b5ac674a01c 100644
--- a/include/opencl/openclwrapper.hxx
+++ b/include/opencl/openclwrapper.hxx
@@ -26,7 +26,7 @@
 
 #include <cstdio>
 
-namespace opencl
+namespace openclwrapper
 {
 
 struct KernelEnv
diff --git a/opencl/inc/opencl_device.hxx b/opencl/inc/opencl_device.hxx
index 4fc75cf443f8..b69cbabc28a5 100644
--- a/opencl/inc/opencl_device.hxx
+++ b/opencl/inc/opencl_device.hxx
@@ -10,16 +10,13 @@
 #ifndef INCLUDED_OPENCL_INC_OPENCL_DEVICE_HXX
 #define INCLUDED_OPENCL_INC_OPENCL_DEVICE_HXX
 
-#include "opencl_device_selection.h"
+#include <opencl/openclwrapper.hxx>
 
-namespace opencl {
+#include "opencl_device_selection.h"
 
 ds_device const & getDeviceSelection(OUString const & pFileName, bool bForceSelection);
 
-struct GPUEnv;
-void releaseOpenCLEnv( GPUEnv *gpuInfo );
-
-}
+void releaseOpenCLEnv( openclwrapper::GPUEnv *gpuInfo );
 
 #endif
 
diff --git a/opencl/source/OpenCLZone.cxx b/opencl/source/OpenCLZone.cxx
index 52d6ada8518a..e757cd497073 100644
--- a/opencl/source/OpenCLZone.cxx
+++ b/opencl/source/OpenCLZone.cxx
@@ -44,7 +44,7 @@ void OpenCLZone::hardDisable()
         css::uno::Reference<css::util::XFlushable> xFlushable(xConfProvider, css::uno::UNO_QUERY_THROW);
         xFlushable->flush();
 
-        releaseOpenCLEnv(&opencl::gpuEnv);
+        releaseOpenCLEnv(&openclwrapper::gpuEnv);
     }
 }
 
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index 695c85505201..4f63e983ae3a 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -40,8 +40,6 @@
 
 #define STRINGIFY(...) #__VA_ARGS__"\n"
 
-namespace opencl {
-
 namespace {
 
 void DS_CHECK_STATUS(cl_int status, char const * name) {
@@ -671,6 +669,4 @@ ds_device const & getDeviceSelection(
     return selectedDevice;
 }
 
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index d59630c53981..73412e9fff58 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -61,7 +61,13 @@ if( status != CL_SUCCESS )  \
 
 using namespace std;
 
-namespace opencl {
+namespace {
+
+bool bIsInited = false;
+
+}
+
+namespace openclwrapper {
 
 GPUEnv gpuEnv;
 sal_uInt64 kernelFailures = 0;
@@ -69,8 +75,6 @@ sal_uInt64 kernelFailures = 0;
 namespace
 {
 
-bool bIsInited = false;
-
 OString generateMD5(const void* pData, size_t length)
 {
     sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_MD5];
@@ -320,38 +324,6 @@ bool initOpenCLAttr( OpenCLEnv * env )
     return false;
 }
 
-}
-
-void releaseOpenCLEnv( GPUEnv *gpuInfo )
-{
-    OpenCLZone zone;
-
-    if ( !bIsInited )
-    {
-        return;
-    }
-
-    for (_cl_command_queue* & i : gpuEnv.mpCmdQueue)
-    {
-        if (i)
-        {
-            clReleaseCommandQueue(i);
-            i = nullptr;
-        }
-    }
-    gpuEnv.mnCmdQueuePos = 0;
-
-    if ( gpuEnv.mpContext )
-    {
-        clReleaseContext( gpuEnv.mpContext );
-        gpuEnv.mpContext = nullptr;
-    }
-    bIsInited = false;
-    gpuInfo->mnIsUserCreated = 0;
-}
-
-namespace {
-
 bool buildProgram(const char* buildOption, GPUEnv* gpuInfo, int idx)
 {
     cl_int clStatus;
@@ -958,4 +930,32 @@ bool GPUEnv::isOpenCLEnabled()
 
 }
 
+void releaseOpenCLEnv( openclwrapper::GPUEnv *gpuInfo )
+{
+    OpenCLZone zone;
+
+    if ( !bIsInited )
+    {
+        return;
+    }
+
+    for (_cl_command_queue* & i : openclwrapper::gpuEnv.mpCmdQueue)
+    {
+        if (i)
+        {
+            clReleaseCommandQueue(i);
+            i = nullptr;
+        }
+    }
+    openclwrapper::gpuEnv.mnCmdQueuePos = 0;
+
+    if ( openclwrapper::gpuEnv.mpContext )
+    {
+        clReleaseContext( openclwrapper::gpuEnv.mpContext );
+        openclwrapper::gpuEnv.mpContext = nullptr;
+    }
+    bIsInited = false;
+    gpuInfo->mnIsUserCreated = 0;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index dd1933c862c2..9d5165bee14e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -164,8 +164,8 @@ size_t VectorRef::Marshal( cl_kernel k, int argno, int, cl_program )
         throw Unhandled(__FILE__, __LINE__);
     }
 
-    ::opencl::KernelEnv kEnv;
-    ::opencl::setKernelEnv(&kEnv);
+    openclwrapper::KernelEnv kEnv;
+    openclwrapper::setKernelEnv(&kEnv);
     cl_int err;
     if (pHostBuffer)
     {
@@ -201,7 +201,7 @@ size_t VectorRef::Marshal( cl_kernel k, int argno, int, cl_program )
             pNanBuffer, 0, nullptr, nullptr);
         // FIXME: Is it intentional to not throw an OpenCLError even if the clEnqueueUnmapMemObject() fails?
         if (CL_SUCCESS != err)
-            SAL_WARN("sc.opencl", "clEnqueueUnmapMemObject failed: " << ::opencl::errorString(err));
+            SAL_WARN("sc.opencl", "clEnqueueUnmapMemObject failed: " << openclwrapper::errorString(err));
     }
 
     SAL_INFO("sc.opencl", "Kernel " << k << " arg " << argno << ": cl_mem: " << mpClmem);
@@ -758,8 +758,8 @@ size_t DynamicKernelStringArgument::Marshal( cl_kernel k, int argno, int, cl_pro
 {
     FormulaToken* ref = mFormulaTree->GetFormulaToken();
 
-    ::opencl::KernelEnv kEnv;
-    ::opencl::setKernelEnv(&kEnv);
+    openclwrapper::KernelEnv kEnv;
+    openclwrapper::setKernelEnv(&kEnv);
     cl_int err;
     formula::VectorRefArray vRef;
     size_t nStrings = 0;
@@ -1438,8 +1438,8 @@ public:
     {
         assert(Base::mpClmem == nullptr);
 
-        ::opencl::KernelEnv kEnv;
-        ::opencl::setKernelEnv(&kEnv);
+        openclwrapper::KernelEnv kEnv;
+        openclwrapper::setKernelEnv(&kEnv);
         cl_int err;
         size_t nInput = mpDVR->GetArrayLength();
         size_t nCurWindowSize = mpDVR->GetRefRowSize();
@@ -1578,11 +1578,11 @@ public:
             err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem2, resbuf, 0, nullptr, nullptr);
             // FIXME: Is it intentional to not throw an OpenCLError even if the clEnqueueUnmapMemObject() fails?
             if (CL_SUCCESS != err)
-                SAL_WARN("sc.opencl", "clEnqueueUnmapMemObject failed: " << ::opencl::errorString(err));
+                SAL_WARN("sc.opencl", "clEnqueueUnmapMemObject failed: " << openclwrapper::errorString(err));
             if (mpClmem2)
             {
                 err = clReleaseMemObject(mpClmem2);
-                SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << ::opencl::errorString(err));
+                SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << openclwrapper::errorString(err));
                 mpClmem2 = nullptr;
             }
             mpClmem2 = clCreateBuffer(kEnv.mpkContext,
@@ -1605,7 +1605,7 @@ public:
         {
             cl_int err;
             err = clReleaseMemObject(mpClmem2);
-            SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << ::opencl::errorString(err));
+            SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << openclwrapper::errorString(err));
             mpClmem2 = nullptr;
         }
     }
@@ -2225,8 +2225,8 @@ public:
         }
         if (dynamic_cast<OpGeoMean*>(mpCodeGen.get()))
         {
-            ::opencl::KernelEnv kEnv;
-            ::opencl::setKernelEnv(&kEnv);
+            openclwrapper::KernelEnv kEnv;
+            openclwrapper::setKernelEnv(&kEnv);
             cl_int err;
             cl_mem pClmem2;
 
@@ -2286,8 +2286,8 @@ public:
         }
         if (OpSumIfs* OpSumCodeGen = dynamic_cast<OpSumIfs*>(mpCodeGen.get()))
         {
-            ::opencl::KernelEnv kEnv;
-            ::opencl::setKernelEnv(&kEnv);
+            openclwrapper::KernelEnv kEnv;
+            openclwrapper::setKernelEnv(&kEnv);
             cl_int err;
             DynamicKernelArgument* Arg = mvSubArguments[0].get();
             DynamicKernelSlidingArgument<VectorRef>* slidingArgPtr =
@@ -2365,7 +2365,7 @@ public:
 
                 SAL_INFO("sc.opencl", "Relasing kernel " << redKernel);
                 err = clReleaseKernel(redKernel);
-                SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << ::opencl::errorString(err));
+                SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << openclwrapper::errorString(err));
 
                 // Pass mpClmem2 to the "real" kernel
                 SAL_INFO("sc.opencl", "Kernel " << k << " arg " << argno << ": cl_mem: " << mpClmem2);
@@ -2482,7 +2482,7 @@ public:
         {
             cl_int err;
             err = clReleaseMemObject(mpClmem2);
-            SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << ::opencl::errorString(err));
+            SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << openclwrapper::errorString(err));
             mpClmem2 = nullptr;
         }
     }
@@ -3681,13 +3681,13 @@ DynamicKernel::~DynamicKernel()
     if (mpResClmem)
     {
         err = clReleaseMemObject(mpResClmem);
-        SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << ::opencl::errorString(err));
+        SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << openclwrapper::errorString(err));
     }
     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));
+        SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseKernel failed: " << openclwrapper::errorString(err));
     }
     // mpProgram is not going to be released here -- it's cached.
 }
@@ -3698,13 +3698,13 @@ void DynamicKernel::CodeGen()
     const DynamicKernelArgument* DK = mSyms.DeclRefArg<DynamicKernelSoPArguments>(mCalcConfig, mpRoot, new OpNop(mnResultSize), mnResultSize);
 
     std::stringstream decl;
-    if (::opencl::gpuEnv.mnKhrFp64Flag)
+    if (openclwrapper::gpuEnv.mnKhrFp64Flag)
     {
         decl << "#if __OPENCL_VERSION__ < 120\n";
         decl << "#pragma OPENCL EXTENSION cl_khr_fp64: enable\n";
         decl << "#endif\n";
     }
-    else if (::opencl::gpuEnv.mnAmdFp64Flag)
+    else if (openclwrapper::gpuEnv.mnAmdFp64Flag)
     {
         decl << "#pragma OPENCL EXTENSION cl_amd_fp64: enable\n";
     }
@@ -3768,8 +3768,8 @@ void DynamicKernel::CreateKernel()
     std::string kname = "DynamicKernel" + mKernelSignature;
     // Compile kernel here!!!
 
-    ::opencl::KernelEnv kEnv;
-    ::opencl::setKernelEnv(&kEnv);
+    openclwrapper::KernelEnv kEnv;
+    openclwrapper::setKernelEnv(&kEnv);
     const char* src = mFullProgramSrc.c_str();
     static std::string lastOneKernelHash;
     static std::string lastSecondKernelHash;
@@ -3791,14 +3791,14 @@ 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));
+            SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseProgram failed: " << openclwrapper::errorString(err));
             lastSecondProgram = nullptr;
         }
-        if (::opencl::buildProgramFromBinary("",
-                &::opencl::gpuEnv, KernelHash.c_str(), 0))
+        if (openclwrapper::buildProgramFromBinary("",
+                &openclwrapper::gpuEnv, KernelHash.c_str(), 0))
         {
-            mpProgram = ::opencl::gpuEnv.mpArryPrograms[0];
-            ::opencl::gpuEnv.mpArryPrograms[0] = nullptr;
+            mpProgram = openclwrapper::gpuEnv.mpArryPrograms[0];
+            openclwrapper::gpuEnv.mpArryPrograms[0] = nullptr;
         }
         else
         {
@@ -3809,7 +3809,7 @@ void DynamicKernel::CreateKernel()
             SAL_INFO("sc.opencl", "Created program " << mpProgram);
 
             err = clBuildProgram(mpProgram, 1,
-                &::opencl::gpuEnv.mpDevID, "", nullptr, nullptr);
+                &openclwrapper::gpuEnv.mpDevID, "", nullptr, nullptr);
             if (err != CL_SUCCESS)
             {
 #if OSL_DEBUG_LEVEL > 0
@@ -3817,36 +3817,36 @@ void DynamicKernel::CreateKernel()
                 {
                     cl_build_status stat;
                     cl_int e = clGetProgramBuildInfo(
-                        mpProgram, ::opencl::gpuEnv.mpDevID,
+                        mpProgram, openclwrapper::gpuEnv.mpDevID,
                         CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),
                         &stat, nullptr);
                     SAL_WARN_IF(
                         e != CL_SUCCESS, "sc.opencl",
                         "after CL_BUILD_PROGRAM_FAILURE,"
                         " clGetProgramBuildInfo(CL_PROGRAM_BUILD_STATUS)"
-                        " fails with " << ::opencl::errorString(e));
+                        " fails with " << openclwrapper::errorString(e));
                     if (e == CL_SUCCESS)
                     {
                         size_t n;
                         e = clGetProgramBuildInfo(
-                            mpProgram, ::opencl::gpuEnv.mpDevID,
+                            mpProgram, openclwrapper::gpuEnv.mpDevID,
                             CL_PROGRAM_BUILD_LOG, 0, nullptr, &n);
                         SAL_WARN_IF(
                             e != CL_SUCCESS || n == 0, "sc.opencl",
                             "after CL_BUILD_PROGRAM_FAILURE,"
                             " clGetProgramBuildInfo(CL_PROGRAM_BUILD_LOG)"
-                            " fails with " << ::opencl::errorString(e) << ", n=" << n);
+                            " fails with " << openclwrapper::errorString(e) << ", n=" << n);
                         if (e == CL_SUCCESS && n != 0)
                         {
                             std::vector<char> log(n);
                             e = clGetProgramBuildInfo(
-                                mpProgram, ::opencl::gpuEnv.mpDevID,
+                                mpProgram, openclwrapper::gpuEnv.mpDevID,
                                 CL_PROGRAM_BUILD_LOG, n, &log[0], nullptr);
                             SAL_WARN_IF(
                                 e != CL_SUCCESS || n == 0, "sc.opencl",
                                 "after CL_BUILD_PROGRAM_FAILURE,"
                                 " clGetProgramBuildInfo("
-                                "CL_PROGRAM_BUILD_LOG) fails with " << ::opencl::errorString(e));
+                                "CL_PROGRAM_BUILD_LOG) fails with " << openclwrapper::errorString(e));
                             if (e == CL_SUCCESS)
                                 SAL_WARN(
                                     "sc.opencl",
@@ -3861,7 +3861,7 @@ void DynamicKernel::CreateKernel()
             SAL_INFO("sc.opencl", "Built program " << mpProgram);
 
             // Generate binary out of compiled kernel.
-            ::opencl::generatBinFromKernelSource(mpProgram,
+            openclwrapper::generatBinFromKernelSource(mpProgram,
                 (mKernelSignature + GetMD5()).c_str());
         }
         lastSecondKernelHash = lastOneKernelHash;
@@ -3877,8 +3877,8 @@ void DynamicKernel::CreateKernel()
 
 void DynamicKernel::Launch( size_t nr )
 {
-    ::opencl::KernelEnv kEnv;
-    ::opencl::setKernelEnv(&kEnv);
+    openclwrapper::KernelEnv kEnv;
+    openclwrapper::setKernelEnv(&kEnv);
     cl_int err;
     // The results
     mpResClmem = clCreateBuffer(kEnv.mpkContext,
@@ -3998,12 +3998,12 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray&
     {
         // I think OpenCLError exceptions are actually exceptional (unexpected), so do use SAL_WARN
         // here.
-        SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCLError from " << oce.mFunction << ": " << ::opencl::errorString(oce.mError) << " at " << oce.mFile << ":" << oce.mLineNumber);
+        SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCLError from " << oce.mFunction << ": " << openclwrapper::errorString(oce.mError) << " at " << oce.mFile << ":" << oce.mLineNumber);
 
         // OpenCLError used to go to the catch-all below, and not delete pDynamicKernel. Was that
         // intentional, should we not do it here then either?
         delete pDynamicKernel;
-        ::opencl::kernelFailures++;
+        openclwrapper::kernelFailures++;
         return nullptr;
     }
     catch (const Unhandled& uh)
@@ -4013,7 +4013,7 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray&
         // Unhandled used to go to the catch-all below, and not delete pDynamicKernel. Was that
         // intentional, should we not do it here then either?
         delete pDynamicKernel;
-        ::opencl::kernelFailures++;
+        openclwrapper::kernelFailures++;
         return nullptr;
     }
     catch (...)
@@ -4021,7 +4021,7 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray&
         // FIXME: Do we really want to catch random exceptions here?
         SAL_WARN("sc.opencl", "Dynamic formula compiler: unexpected exception");
         // FIXME: Not deleting pDynamicKernel here!?, is that intentional?
-        ::opencl::kernelFailures++;
+        openclwrapper::kernelFailures++;
         return nullptr;
     }
     return pDynamicKernel;
@@ -4053,8 +4053,8 @@ public:
         // Map results back
         mpCLResBuf = mpKernel->GetResultBuffer();
 
-        ::opencl::KernelEnv kEnv;
-        ::opencl::setKernelEnv(&kEnv);
+        openclwrapper::KernelEnv kEnv;
+        openclwrapper::setKernelEnv(&kEnv);
 
         cl_int err;
         mpResBuf = static_cast<double*>(clEnqueueMapBuffer(kEnv.mpkCmdQueue,
@@ -4065,7 +4065,7 @@ public:
 
         if (err != CL_SUCCESS)
         {
-            SAL_WARN("sc.opencl", "clEnqueueMapBuffer failed:: " << ::opencl::errorString(err));
+            SAL_WARN("sc.opencl", "clEnqueueMapBuffer failed:: " << openclwrapper::errorString(err));
             mpResBuf = nullptr;
             return;
         }
@@ -4078,15 +4078,15 @@ public:
 
         rDoc.SetFormulaResults(rTopPos, mpResBuf, mnGroupLength);
 
-        ::opencl::KernelEnv kEnv;
-        ::opencl::setKernelEnv(&kEnv);
+        openclwrapper::KernelEnv kEnv;
+        openclwrapper::setKernelEnv(&kEnv);
 
         cl_int err;
         err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpCLResBuf, mpResBuf, 0, nullptr, nullptr);
 
         if (err != CL_SUCCESS)
         {
-            SAL_WARN("sc.opencl", "clEnqueueUnmapMemObject failed: " << ::opencl::errorString(err));
+            SAL_WARN("sc.opencl", "clEnqueueUnmapMemObject failed: " << openclwrapper::errorString(err));
             return false;
         }
 
@@ -4130,25 +4130,25 @@ public:
         catch (const UnhandledToken& ut)
         {
             SAL_INFO("sc.opencl", "Dynamic formula compiler: UnhandledToken: " << ut.mMessage << " at " << ut.mFile << ":" << ut.mLineNumber);
-            ::opencl::kernelFailures++;
+            openclwrapper::kernelFailures++;
             return CLInterpreterResult();
         }
         catch (const OpenCLError& oce)
         {
-            SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCLError from " << oce.mFunction << ": " << ::opencl::errorString(oce.mError) << " at " << oce.mFile << ":" << oce.mLineNumber);
-            ::opencl::kernelFailures++;
+            SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCLError from " << oce.mFunction << ": " << openclwrapper::errorString(oce.mError) << " at " << oce.mFile << ":" << oce.mLineNumber);
+            openclwrapper::kernelFailures++;
             return CLInterpreterResult();
         }
         catch (const Unhandled& uh)
         {
             SAL_INFO("sc.opencl", "Dynamic formula compiler: Unhandled at " << uh.mFile << ":" << uh.mLineNumber);
-            ::opencl::kernelFailures++;
+            openclwrapper::kernelFailures++;
             return CLInterpreterResult();
         }
         catch (...)
         {
             SAL_WARN("sc.opencl", "Dynamic formula compiler: unexpected exception");
-            ::opencl::kernelFailures++;
+            openclwrapper::kernelFailures++;
             return CLInterpreterResult();
         }
 
@@ -4177,12 +4177,12 @@ void genRPNTokens( ScDocument& rDoc, const ScAddress& rTopPos, ScTokenArray& rCo
 
 bool waitForResults()
 {
-    ::opencl::KernelEnv kEnv;
-    ::opencl::setKernelEnv(&kEnv);
+    openclwrapper::KernelEnv kEnv;
+    openclwrapper::setKernelEnv(&kEnv);
 
     cl_int err = clFinish(kEnv.mpkCmdQueue);
     if (err != CL_SUCCESS)
-        SAL_WARN("sc.opencl", "clFinish failed: " << ::opencl::errorString(err));
+        SAL_WARN("sc.opencl", "clFinish failed: " << openclwrapper::errorString(err));
 
     return err == CL_SUCCESS;
 }
diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx
index c4e0de0572b8..747c50a2cd03 100644
--- a/sc/source/core/opencl/opbase.cxx
+++ b/sc/source/core/opencl/opbase.cxx
@@ -26,7 +26,7 @@ OpenCLError::OpenCLError( const std::string& function, cl_int error, const std::
     // CLInterpreterContext::launchKernel() where OpenCLError is
     // caught already uses SAL_WARN() to display it.
 
-    // SAL_INFO("sc.opencl", "OpenCL error: " << ::opencl::errorString(mError));
+    // SAL_INFO("sc.opencl", "OpenCL error: " << openclwrapper::errorString(mError));
 }
 
 Unhandled::Unhandled( const std::string& fn, int ln ) :
@@ -109,7 +109,7 @@ VectorRef::~VectorRef()
     {
         cl_int err;
         err = clReleaseMemObject(mpClmem);
-        SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << ::opencl::errorString(err));
+        SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << openclwrapper::errorString(err));
     }
 }
 
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 985d5cdfed43..03e86ed19a45 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -297,7 +297,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
 void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rPlatforms)
 {
     const std::vector<OpenCLPlatformInfo>& rPlatformsFromWrapper =
-        ::opencl::fillOpenCLInfo();
+        openclwrapper::fillOpenCLInfo();
 
     rPlatforms.assign(rPlatformsFromWrapper.begin(), rPlatformsFromWrapper.end());
 }
@@ -328,7 +328,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
     }
 
     OUString aSelectedCLDeviceVersionID;
-    bool bSuccess = ::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation, aSelectedCLDeviceVersionID);
+    bool bSuccess = openclwrapper::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation, aSelectedCLDeviceVersionID);
 
     if (!bSuccess)
         return false;
@@ -350,7 +350,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3
     size_t aDeviceId = static_cast<size_t>(-1);
     size_t aPlatformId = static_cast<size_t>(-1);
 
-    ::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId);
+    openclwrapper::getOpenCLDeviceInfo(aDeviceId, aPlatformId);
     rDeviceId = aDeviceId;
     rPlatformId = aPlatformId;
 }


More information about the Libreoffice-commits mailing list