[Libreoffice-commits] core.git: 2 commits - include/opencl opencl/inc opencl/Library_opencl.mk opencl/source sc/Library_sc.mk sc/source

Tor Lillqvist tml at collabora.com
Thu Nov 27 05:41:17 PST 2014


 include/opencl/openclwrapper.hxx                |  109 +++
 opencl/Library_opencl.mk                        |    7 
 opencl/inc/opencl_device.hxx                    |   25 
 opencl/inc/opencl_device_selection.h            |  641 +++++++++++++++++++
 opencl/source/opencl_device.cxx                 |  598 +++++++++++++++++
 opencl/source/openclwrapper.cxx                 |  804 +++++++++++++++++++++++
 sc/Library_sc.mk                                |    2 
 sc/source/core/inc/openclwrapper.hxx            |  108 ---
 sc/source/core/opencl/formulagroupcl.cxx        |   42 -
 sc/source/core/opencl/opencl_device.cxx         |  597 -----------------
 sc/source/core/opencl/opencl_device.hxx         |   26 
 sc/source/core/opencl/opencl_device_selection.h |  642 -------------------
 sc/source/core/opencl/openclwrapper.cxx         |  806 ------------------------
 sc/source/core/tool/formulagroup.cxx            |    8 
 sc/source/core/tool/formulaopt.cxx              |    4 
 15 files changed, 2212 insertions(+), 2207 deletions(-)

New commits:
commit afcb67bd0645a0ddd2ae024d13becc118b8c40b0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Nov 27 15:32:45 2014 +0200

    WaE: variable 'bSetOpenCL' set but not used
    
    Change-Id: I897accf5b4259a4a01198118421abaa55465207e

diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index 60378df..5da7b01 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -649,7 +649,9 @@ void ScFormulaCfg::Commit()
             break;
         }
     }
-#if HAVE_FEATURE_OPENCL
+#if !HAVE_FEATURE_OPENCL
+    (void) bSetOpenCL;
+#else
     if(bSetOpenCL)
         sc::FormulaGroupInterpreter::switchOpenCLDevice(
                 GetCalcConfig().maOpenCLDevice, GetCalcConfig().mbOpenCLAutoSelect);
commit a70b717ef872c0ac652883ecd2a82c4cc29763e2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Nov 27 15:13:12 2014 +0200

    Move more Calc-independent OpenCL stuff from the sc to the opencl module
    
    No cleanups yet. Just removed the "sc" namespace parts now when this stuff is
    no longer Calc-specific. There is still horribly confusing use of the same
    OpenCLDevice name for both a class and as a namespace, for instance. And the
    OpenCLDevice class has only public static members even, so effectively it acts
    as just a namespace anyway... Etc.
    
    Change-Id: Idc5f30a721df0101426c676f04a85e02c5dc8443

diff --git a/sc/source/core/inc/openclwrapper.hxx b/include/opencl/openclwrapper.hxx
similarity index 87%
rename from sc/source/core/inc/openclwrapper.hxx
rename to include/opencl/openclwrapper.hxx
index 9dad747..ba7aada 100644
--- a/sc/source/core/inc/openclwrapper.hxx
+++ b/include/opencl/openclwrapper.hxx
@@ -11,16 +11,19 @@
 #define INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCLWRAPPER_HXX
 
 #include <config_features.h>
-#include <sal/detail/log.h>
-#include <opencl/platforminfo.hxx>
-#include <osl/file.hxx>
+
+#include <cassert>
 #include <vector>
+
 #include <boost/shared_ptr.hpp>
-#include <cassert>
+#include <clew.h>
 
+#include <sal/detail/log.h>
+#include <opencl/opencldllapi.h>
+#include <opencl/platforminfo.hxx>
+#include <osl/file.hxx>
 #include <rtl/string.hxx>
 
-#include <clew.h>
 
 #define CHECK_OPENCL(status,name)    \
 if( status != CL_SUCCESS )    \
@@ -40,9 +43,7 @@ struct KernelEnv
     cl_program mpkProgram;
 };
 
-namespace sc { namespace opencl {
-
-typedef unsigned int uint;
+namespace opencl {
 
 struct OpenCLEnv
 {
@@ -67,7 +68,7 @@ struct GPUEnv
     bool mnAmdFp64Flag;
 };
 
-class OpenCLDevice
+class OPENCL_DLLPUBLIC OpenCLDevice
 {
 public:
     static GPUEnv gpuEnv;
@@ -86,7 +87,7 @@ public:
     static void setKernelEnv( KernelEnv *envInfo );
 };
 
-const std::vector<OpenCLPlatformInfo>& fillOpenCLInfo();
+OPENCL_DLLPUBLIC const std::vector<OpenCLPlatformInfo>& fillOpenCLInfo();
 
 /**
  * Used to set or switch between OpenCL devices.
@@ -96,12 +97,12 @@ const std::vector<OpenCLPlatformInfo>& fillOpenCLInfo();
  *
  * @return returns true if there is a valid opencl device that has been set up
  */
-bool switchOpenCLDevice(const OUString* pDeviceId, bool bAutoSelect,
-        bool bForceEvaluation);
+OPENCL_DLLPUBLIC bool switchOpenCLDevice(const OUString* pDeviceId, bool bAutoSelect,
+                                         bool bForceEvaluation);
 
-void getOpenCLDeviceInfo(size_t& rDeviceId, size_t& rPlatformId);
+OPENCL_DLLPUBLIC void getOpenCLDeviceInfo(size_t& rDeviceId, size_t& rPlatformId);
 
-}}
+}
 
 #endif
 
diff --git a/opencl/Library_opencl.mk b/opencl/Library_opencl.mk
index 51ca62c..ad1af37 100644
--- a/opencl/Library_opencl.mk
+++ b/opencl/Library_opencl.mk
@@ -9,6 +9,11 @@
 
 $(eval $(call gb_Library_Library,opencl))
 
+$(eval $(call gb_Library_set_include,opencl,\
+    -I$(SRCDIR)/opencl/inc \
+    $$(INCLUDE) \
+))
+
 $(eval $(call gb_Library_add_defs,opencl,\
     -DOPENCL_DLLIMPLEMENTATION \
 ))
@@ -36,6 +41,8 @@ $(eval $(call gb_Library_use_libraries,opencl,\
 
 $(eval $(call gb_Library_add_exception_objects,opencl,\
     opencl/source/openclconfig \
+    opencl/source/openclwrapper \
+    opencl/source/opencl_device \
     opencl/source/platforminfo \
 ))
 
diff --git a/sc/source/core/opencl/opencl_device.hxx b/opencl/inc/opencl_device.hxx
similarity index 78%
rename from sc/source/core/opencl/opencl_device.hxx
rename to opencl/inc/opencl_device.hxx
index c5367f2..7435879 100644
--- a/sc/source/core/opencl/opencl_device.hxx
+++ b/opencl/inc/opencl_device.hxx
@@ -7,19 +7,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCL_DEVICE_HXX
-#define INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCL_DEVICE_HXX
+#ifndef INCLUDED_OPENCL_INC_OPENCL_DEVICE_HXX
+#define INCLUDED_OPENCL_INC_OPENCL_DEVICE_HXX
 
-#pragma once
 #include "opencl_device_selection.h"
 
-namespace sc { namespace OpenCLDevice {
+namespace OpenCLDevice {
 
 ds_device getDeviceSelection(const char* pFileName, bool bForceSelection = false);
 bool selectedDeviceIsOpenCL(ds_device device);
 bool selectedDeviceIsNativeCPU(ds_device device);
 
-}}
+}
 
 #endif
 
diff --git a/sc/source/core/opencl/opencl_device_selection.h b/opencl/inc/opencl_device_selection.h
similarity index 99%
rename from sc/source/core/opencl/opencl_device_selection.h
rename to opencl/inc/opencl_device_selection.h
index 30e947a..03373f4 100644
--- a/sc/source/core/opencl/opencl_device_selection.h
+++ b/opencl/inc/opencl_device_selection.h
@@ -7,9 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCL_DEVICE_SELECTION_H
-#define INCLUDED_SC_SOURCE_CORE_OPENCL_OPENCL_DEVICE_SELECTION_H
-
+#ifndef INCLUDED_OPENCL_INC_OPENCL_DEVICE_SELECTION_H
+#define INCLUDED_OPENCL_INC_OPENCL_DEVICE_SELECTION_H
 
 #ifdef _MSC_VER
 #define _CRT_SECURE_NO_WARNINGS
diff --git a/sc/source/core/opencl/opencl_device.cxx b/opencl/source/opencl_device.cxx
similarity index 89%
rename from sc/source/core/opencl/opencl_device.cxx
rename to opencl/source/opencl_device.cxx
index f845f42..204ab34 100644
--- a/sc/source/core/opencl/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -15,6 +15,7 @@
 #else
 #include <sys/time.h>
 #endif
+
 #include <time.h>
 #include <math.h>
 #include <float.h>
@@ -26,11 +27,11 @@
 
 #include <comphelper/random.hxx>
 #include <opencl/openclconfig.hxx>
+#include <opencl/openclwrapper.hxx>
 #include <opencl/platforminfo.hxx>
 #include <sal/log.hxx>
 
 #include "opencl_device.hxx"
-#include "openclwrapper.hxx"
 
 #define INPUTSIZE  15360
 #define OUTPUTSIZE 15360
@@ -40,10 +41,10 @@
 #define DS_CHECK_STATUS(status, name) \
     if (CL_SUCCESS != status) \
     { \
-    SAL_INFO("sc.opencl.device", "Error code is " << status << " at " name); \
+    SAL_INFO("opencl.device", "Error code is " << status << " at " name); \
     }
 
-namespace sc { namespace OpenCLDevice {
+namespace OpenCLDevice {
 
 bool bIsInited = false;
 bool bIsDeviceSelected = false;
@@ -230,7 +231,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
     if (DS_DEVICE_OPENCL_DEVICE == device->type)
     {
         /* Evaluating an OpenCL device */
-        SAL_INFO("sc.opencl.device", "Device: \"" << device->oclDeviceName << "\" (OpenCL) evaluation...");
+        SAL_INFO("opencl.device", "Device: \"" << device->oclDeviceName << "\" (OpenCL) evaluation...");
         cl_int clStatus;
         /* Check for 64-bit float extensions */
         size_t aDevExtInfoSize = 0;
@@ -254,7 +255,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
             //buildOption = "-D KHR_DP_EXTENSION -Dfp_t=double -Dfp_t4=double4 -Dfp_t16=double16";
             tmpStr.append(" -DKHR_DP_EXTENSION");
             buildOption = tmpStr.c_str();
-            SAL_INFO("sc.opencl.device", "... has cl_khr_fp64");
+            SAL_INFO("opencl.device", "... has cl_khr_fp64");
         }
         else if ((std::string(aExtInfo)).find("cl_amd_fp64") != std::string::npos)
         {
@@ -262,7 +263,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
             //buildOption = "-D AMD_DP_EXTENSION -Dfp_t=double -Dfp_t4=double4 -Dfp_t16=double16";
             tmpStr.append(" -DAMD_DP_EXTENSION");
             buildOption = tmpStr.c_str();
-            SAL_INFO("sc.opencl.device", "... has cl_amd_fp64");
+            SAL_INFO("opencl.device", "... has cl_amd_fp64");
         }
         delete[] aExtInfo;
 
@@ -272,7 +273,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
             device->score = (void*)new LibreOfficeDeviceScore;
             ((LibreOfficeDeviceScore*)device->score)->fTime = DBL_MAX;
             ((LibreOfficeDeviceScore*)device->score)->bNoCLErrors = true;
-            SAL_INFO("sc.opencl.device", "... no fp64 support");
+            SAL_INFO("opencl.device", "... no fp64 support");
         }
         else
         {
@@ -297,7 +298,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
                 clStatus = clGetProgramBuildInfo(clProgram, device->oclDeviceID, CL_PROGRAM_BUILD_LOG, 0, NULL, &length);
                 buildLog = (char*)malloc(length);
                 clGetProgramBuildInfo(clProgram, device->oclDeviceID, CL_PROGRAM_BUILD_LOG, length, buildLog, &length);
-                SAL_INFO("sc.opencl.device", "Build Errors:\n" << buildLog);
+                SAL_INFO("opencl.device", "Build Errors:\n" << buildLog);
                 free(buildLog);
 
                 device->score = (void*)new LibreOfficeDeviceScore;
@@ -359,7 +360,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
     else
     {
         /* Evaluating an Native CPU device */
-        SAL_INFO("sc.opencl.device", "Device: \"CPU\" (Native) evaluation...");
+        SAL_INFO("opencl.device", "Device: \"CPU\" (Native) evaluation...");
         timer kernelTime;
         timerStart(&kernelTime);
 
@@ -423,7 +424,7 @@ ds_status pickBestDevice(ds_profile* profile, int* bestDeviceIdx)
             // If blacklisted or not whitelisted, ignore it
             if (OpenCLConfig::get().checkImplementation(aPlatform, aDevice))
             {
-                SAL_INFO("sc.opencl.device", "Device[" << d << "] " << device.oclDeviceName << " is blacklisted or not whitelisted");
+                SAL_INFO("opencl.device", "Device[" << d << "] " << device.oclDeviceName << " is blacklisted or not whitelisted");
                 pScore->fTime = DBL_MAX;
                 pScore->bNoCLErrors = true;
             }
@@ -436,16 +437,16 @@ ds_status pickBestDevice(ds_profile* profile, int* bestDeviceIdx)
         }
         else
         {
-            SAL_INFO("sc.opencl.device", "Unusual null score");
+            SAL_INFO("opencl.device", "Unusual null score");
         }
 
         if (DS_DEVICE_OPENCL_DEVICE == device.type)
         {
-            SAL_INFO("sc.opencl.device", "Device[" << d << "] " << device.oclDeviceName << " (OpenCL) score is " << fScore);
+            SAL_INFO("opencl.device", "Device[" << d << "] " << device.oclDeviceName << " (OpenCL) score is " << fScore);
         }
         else
         {
-            SAL_INFO("sc.opencl.device", "Device[" << d << "] CPU (Native) score is " << fScore);
+            SAL_INFO("opencl.device", "Device[" << d << "] CPU (Native) score is " << fScore);
         }
         if (fScore < bestScore)
         {
@@ -455,11 +456,11 @@ ds_status pickBestDevice(ds_profile* profile, int* bestDeviceIdx)
     }
     if (DS_DEVICE_OPENCL_DEVICE == profile->devices[*bestDeviceIdx].type)
     {
-        SAL_INFO("sc.opencl.device", "Selected Device[" << *bestDeviceIdx << "]: " << profile->devices[*bestDeviceIdx].oclDeviceName << "(OpenCL).");
+        SAL_INFO("opencl.device", "Selected Device[" << *bestDeviceIdx << "]: " << profile->devices[*bestDeviceIdx].oclDeviceName << "(OpenCL).");
     }
     else
     {
-        SAL_INFO("sc.opencl.device", "Selected Device[" << *bestDeviceIdx << "]: CPU (Native).");
+        SAL_INFO("opencl.device", "Selected Device[" << *bestDeviceIdx << "]: CPU (Native).");
     }
 
     return DS_SUCCESS;
@@ -507,13 +508,13 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection)
         else
         {
             status = DS_INVALID_PROFILE;
-            SAL_INFO("sc.opencl.device", "Performing forced profiling.");
+            SAL_INFO("opencl.device", "Performing forced profiling.");
         }
         if (DS_SUCCESS != status)
         {
             if (!bForceSelection)
             {
-                SAL_INFO("sc.opencl.device", "Profile file not available (" << fileName << "); performing profiling.");
+                SAL_INFO("opencl.device", "Profile file not available (" << fileName << "); performing profiling.");
             }
 
             /* Populate input data for micro-benchmark */
@@ -537,21 +538,21 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection)
                 status = writeProfileToFile(profile, serializeScore, fileName);
                 if (DS_SUCCESS == status)
                 {
-                    SAL_INFO("sc.opencl.device", "Scores written to file (" << fileName << ").");
+                    SAL_INFO("opencl.device", "Scores written to file (" << fileName << ").");
                 }
                 else
                 {
-                    SAL_INFO("sc.opencl.device", "Error saving scores to file (" << fileName << "); scores not written to file.");
+                    SAL_INFO("opencl.device", "Error saving scores to file (" << fileName << "); scores not written to file.");
                 }
             }
             else
             {
-                SAL_INFO("sc.opencl.device", "Unable to evaluate performance; scores not written to file.");
+                SAL_INFO("opencl.device", "Unable to evaluate performance; scores not written to file.");
             }
         }
         else
         {
-            SAL_INFO("sc.opencl.device", "Profile read from file (" << fileName << ").");
+            SAL_INFO("opencl.device", "Profile read from file (" << fileName << ").");
         }
 
         /* Pick best device */
@@ -565,20 +566,20 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection)
             int overrideDeviceIdx = matchDevice(profile, overrideDeviceStr);
             if (-1 != overrideDeviceIdx)
             {
-                SAL_INFO("sc.opencl.device", "Overriding Device Selection (SC_OPENCL_DEVICE_OVERRIDE=" << overrideDeviceStr << ").");
+                SAL_INFO("opencl.device", "Overriding Device Selection (SC_OPENCL_DEVICE_OVERRIDE=" << overrideDeviceStr << ").");
                 bestDeviceIdx = overrideDeviceIdx;
                 if (DS_DEVICE_OPENCL_DEVICE == profile->devices[bestDeviceIdx].type)
                 {
-                    SAL_INFO("sc.opencl.device", "Selected Device[" << bestDeviceIdx << "]: " << profile->devices[bestDeviceIdx].oclDeviceName << " (OpenCL).");
+                    SAL_INFO("opencl.device", "Selected Device[" << bestDeviceIdx << "]: " << profile->devices[bestDeviceIdx].oclDeviceName << " (OpenCL).");
                 }
                 else
                 {
-                    SAL_INFO("sc.opencl.device", "Selected Device[" << bestDeviceIdx << "]: CPU (Native).");
+                    SAL_INFO("opencl.device", "Selected Device[" << bestDeviceIdx << "]: CPU (Native).");
                 }
             }
             else
             {
-                SAL_INFO("sc.opencl.device", "Ignoring invalid SC_OPENCL_DEVICE_OVERRIDE=" << overrideDeviceStr << ").");
+                SAL_INFO("opencl.device", "Ignoring invalid SC_OPENCL_DEVICE_OVERRIDE=" << overrideDeviceStr << ").");
             }
         }
 
@@ -592,6 +593,6 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection)
     return selectedDevice;
 }
 
-}}
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
similarity index 95%
rename from sc/source/core/opencl/openclwrapper.cxx
rename to opencl/source/openclwrapper.cxx
index 20f4919..86ba6cd 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -9,13 +9,11 @@
 
 #include <config_folders.h>
 
-#include "calcconfig.hxx"
-#include "interpre.hxx"
 #include "opencl_device.hxx"
-#include "openclwrapper.hxx"
 
 #include <comphelper/string.hxx>
 #include <opencl/openclconfig.hxx>
+#include <opencl/openclwrapper.hxx>
 #include <osl/file.hxx>
 #include <rtl/bootstrap.hxx>
 #include <rtl/digest.h>
@@ -48,7 +46,7 @@
 
 using namespace std;
 
-namespace sc { namespace opencl {
+namespace opencl {
 
 GPUEnv OpenCLDevice::gpuEnv;
 bool OpenCLDevice::bIsInited = false;
@@ -60,7 +58,7 @@ OString generateMD5(const void* pData, size_t length)
     sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_MD5];
     rtlDigestError aError = rtl_digest_MD5(pData, length,
             pBuffer, RTL_DIGEST_LENGTH_MD5);
-    SAL_WARN_IF(aError != rtl_Digest_E_None, "sc", "md5 generation failed");
+    SAL_WARN_IF(aError != rtl_Digest_E_None, "opencl", "md5 generation failed");
 
     OStringBuffer aBuffer;
     const char* pString = "0123456789ABCDEF";
@@ -158,11 +156,11 @@ std::vector<boost::shared_ptr<osl::File> > OpenCLDevice::binaryGenerated( const
             if(pNewFile->open(osl_File_OpenFlag_Read) == osl::FileBase::E_None)
             {
                 aGeneratedFiles.push_back(boost::shared_ptr<osl::File>(pNewFile));
-                SAL_INFO("sc.opencl.file", "Opening binary file '" << fileName << "' for reading: success");
+                SAL_INFO("opencl.file", "Opening binary file '" << fileName << "' for reading: success");
             }
             else
             {
-                SAL_INFO("sc.opencl.file", "Opening binary file '" << fileName << "' for reading: FAIL");
+                SAL_INFO("opencl.file", "Opening binary file '" << fileName << "' for reading: FAIL");
                 delete pNewFile;
                 break;
             }
@@ -238,9 +236,9 @@ bool OpenCLDevice::generatBinFromKernelSource( cl_program program, const char *
             OString fileName = createFileName(pArryDevsID[i], clFileName);
             if ( !writeBinaryToFile( fileName,
                         binaries[i], binarySizes[i] ) )
-                SAL_INFO("sc.opencl.file", "Writing binary file '" << fileName << "': FAIL");
+                SAL_INFO("opencl.file", "Writing binary file '" << fileName << "': FAIL");
             else
-                SAL_INFO("sc.opencl.file", "Writing binary file '" << fileName << "': success");
+                SAL_INFO("opencl.file", "Writing binary file '" << fileName << "': success");
         }
     }
 
@@ -454,15 +452,15 @@ bool OpenCLDevice::initOpenCLRunEnv( int argc )
         }
         if( gpuEnv.mnKhrFp64Flag )
         {
-            SAL_INFO("sc.opencl", "Use Khr double");
+            SAL_INFO("opencl", "Use Khr double");
         }
         else if( gpuEnv.mnAmdFp64Flag )
         {
-            SAL_INFO("sc.opencl", "Use AMD double type");
+            SAL_INFO("opencl", "Use AMD double type");
         }
         else
         {
-            SAL_INFO("sc.opencl", "USE float type");
+            SAL_INFO("opencl", "USE float type");
         }
         bIsInited = true;
     }
@@ -727,7 +725,7 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
         OUString path;
         osl::FileBase::getSystemPathFromFileURL(url,path);
         OString dsFileName = rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8);
-        ds_device pSelectedDevice = sc::OpenCLDevice::getDeviceSelection(dsFileName.getStr(), bForceEvaluation);
+        ds_device pSelectedDevice = ::OpenCLDevice::getDeviceSelection(dsFileName.getStr(), bForceEvaluation);
         pDeviceId = pSelectedDevice.oclDeviceID;
 
     }
@@ -754,7 +752,7 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
         if(context != NULL)
             clReleaseContext(context);
 
-        SAL_WARN("sc", "failed to set/switch opencl device");
+        SAL_WARN("opencl", "failed to set/switch opencl device");
         return false;
     }
 
@@ -767,7 +765,7 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
             clReleaseCommandQueue(command_queue);
 
         clReleaseContext(context);
-        SAL_WARN("sc", "failed to set/switch opencl device");
+        SAL_WARN("opencl", "failed to set/switch opencl device");
         return false;
     }
 
@@ -801,6 +799,6 @@ void getOpenCLDeviceInfo(size_t& rDeviceId, size_t& rPlatformId)
     findDeviceInfoFromDeviceId(id, rDeviceId, rPlatformId);
 }
 
-}}
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 31643f8..7860a6e 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -664,8 +664,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 $(eval $(call gb_Helper_optional,OPENCL,\
 $(call gb_Library_add_exception_objects,sc,\
     sc/source/core/opencl/formulagroupcl \
-    sc/source/core/opencl/openclwrapper \
-    sc/source/core/opencl/opencl_device \
     sc/source/core/opencl/opbase \
     sc/source/core/opencl/op_financial \
     sc/source/core/opencl/op_database \
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 3dfcc10..0615410 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -19,7 +19,7 @@
 #include <formula/vectortoken.hxx>
 #include "scmatrix.hxx"
 
-#include "openclwrapper.hxx"
+#include <opencl/openclwrapper.hxx>
 
 #include "op_financial.hxx"
 #include "op_database.hxx"
@@ -114,7 +114,7 @@ size_t VectorRef::Marshal( cl_kernel k, int argno, int, cl_program )
     }
     // Obtain cl context
     KernelEnv kEnv;
-    OpenCLDevice::setKernelEnv(&kEnv);
+    ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
     cl_int err;
     if (pHostBuffer)
     {
@@ -205,7 +205,7 @@ public:
         // marshaling
         // Obtain cl context
         KernelEnv kEnv;
-        OpenCLDevice::setKernelEnv(&kEnv);
+        ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
         // Pass the scalar result back to the rest of the formula kernel
         cl_int err = clSetKernelArg(k, argno, sizeof(cl_uint), (void*)&hashCode);
         if (CL_SUCCESS != err)
@@ -389,7 +389,7 @@ size_t DynamicKernelStringArgument::Marshal( cl_kernel k, int argno, int, cl_pro
     FormulaToken* ref = mFormulaTree->GetFormulaToken();
     // Obtain cl context
     KernelEnv kEnv;
-    OpenCLDevice::setKernelEnv(&kEnv);
+    ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
     cl_int err;
     formula::VectorRefArray vRef;
     size_t nStrings = 0;
@@ -1132,7 +1132,7 @@ public:
         assert(Base::mpClmem == NULL);
         // Obtain cl context
         KernelEnv kEnv;
-        OpenCLDevice::setKernelEnv(&kEnv);
+        ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
         cl_int err;
         size_t nInput = mpDVR->GetArrayLength();
         size_t nCurWindowSize = mpDVR->GetRefRowSize();
@@ -1913,7 +1913,7 @@ public:
         {
             // Obtain cl context
             KernelEnv kEnv;
-            OpenCLDevice::setKernelEnv(&kEnv);
+            ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
             cl_int err;
             cl_mem pClmem2;
 
@@ -1971,7 +1971,7 @@ public:
         {
             // Obtain cl context
             KernelEnv kEnv;
-            OpenCLDevice::setKernelEnv(&kEnv);
+            ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
             cl_int err;
             DynamicKernelArgument* Arg = mvSubArguments[0].get();
             DynamicKernelSlidingArgument<VectorRef>* slidingArgPtr =
@@ -3282,11 +3282,11 @@ public:
                                                                DynamicKernelSoPArguments>(mpRoot, new OpNop);
 
         std::stringstream decl;
-        if (OpenCLDevice::gpuEnv.mnKhrFp64Flag)
+        if (::opencl::OpenCLDevice::gpuEnv.mnKhrFp64Flag)
         {
             decl << "#pragma OPENCL EXTENSION cl_khr_fp64: enable\n";
         }
-        else if (OpenCLDevice::gpuEnv.mnAmdFp64Flag)
+        else if (::opencl::OpenCLDevice::gpuEnv.mnAmdFp64Flag)
         {
             decl << "#pragma OPENCL EXTENSION cl_amd_fp64: enable\n";
         }
@@ -3355,7 +3355,7 @@ public:
     {
         // Obtain cl context
         KernelEnv kEnv;
-        OpenCLDevice::setKernelEnv(&kEnv);
+        ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
         cl_int err;
         // The results
         mpResClmem = clCreateBuffer(kEnv.mpkContext,
@@ -3417,7 +3417,7 @@ void DynamicKernel::CreateKernel()
     // Compile kernel here!!!
     // Obtain cl context
     KernelEnv kEnv;
-    OpenCLDevice::setKernelEnv(&kEnv);
+    ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
     const char* src = mFullProgramSrc.c_str();
     static std::string lastOneKernelHash = "";
     static std::string lastSecondKernelHash = "";
@@ -3439,11 +3439,11 @@ void DynamicKernel::CreateKernel()
         {
             clReleaseProgram(lastSecondProgram);
         }
-        if (OpenCLDevice::buildProgramFromBinary("",
-                &OpenCLDevice::gpuEnv, KernelHash.c_str(), 0))
+        if (::opencl::OpenCLDevice::buildProgramFromBinary("",
+                &::opencl::OpenCLDevice::gpuEnv, KernelHash.c_str(), 0))
         {
-            mpProgram = OpenCLDevice::gpuEnv.mpArryPrograms[0];
-            OpenCLDevice::gpuEnv.mpArryPrograms[0] = NULL;
+            mpProgram = ::opencl::OpenCLDevice::gpuEnv.mpArryPrograms[0];
+            ::opencl::OpenCLDevice::gpuEnv.mpArryPrograms[0] = NULL;
         }
         else
         {
@@ -3452,7 +3452,7 @@ void DynamicKernel::CreateKernel()
             if (err != CL_SUCCESS)
                 throw OpenCLError(err, __FILE__, __LINE__);
             err = clBuildProgram(mpProgram, 1,
-                OpenCLDevice::gpuEnv.mpArryDevsID, "", NULL, NULL);
+                ::opencl::OpenCLDevice::gpuEnv.mpArryDevsID, "", NULL, NULL);
             if (err != CL_SUCCESS)
             {
 #if OSL_DEBUG_LEVEL > 0
@@ -3460,7 +3460,7 @@ void DynamicKernel::CreateKernel()
                 {
                     cl_build_status stat;
                     cl_int e = clGetProgramBuildInfo(
-                        mpProgram, OpenCLDevice::gpuEnv.mpArryDevsID[0],
+                        mpProgram, ::opencl::OpenCLDevice::gpuEnv.mpArryDevsID[0],
                         CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),
                         &stat, 0);
                     SAL_WARN_IF(
@@ -3472,7 +3472,7 @@ void DynamicKernel::CreateKernel()
                     {
                         size_t n;
                         e = clGetProgramBuildInfo(
-                            mpProgram, OpenCLDevice::gpuEnv.mpArryDevsID[0],
+                            mpProgram, ::opencl::OpenCLDevice::gpuEnv.mpArryDevsID[0],
                             CL_PROGRAM_BUILD_LOG, 0, 0, &n);
                         SAL_WARN_IF(
                             e != CL_SUCCESS || n == 0, "sc.opencl",
@@ -3483,7 +3483,7 @@ void DynamicKernel::CreateKernel()
                         {
                             std::vector<char> log(n);
                             e = clGetProgramBuildInfo(
-                                mpProgram, OpenCLDevice::gpuEnv.mpArryDevsID[0],
+                                mpProgram, ::opencl::OpenCLDevice::gpuEnv.mpArryDevsID[0],
                                 CL_PROGRAM_BUILD_LOG, n, &log[0], 0);
                             SAL_WARN_IF(
                                 e != CL_SUCCESS || n == 0, "sc.opencl",
@@ -3502,7 +3502,7 @@ void DynamicKernel::CreateKernel()
                 throw OpenCLError(err, __FILE__, __LINE__);
             }
             // Generate binary out of compiled kernel.
-            OpenCLDevice::generatBinFromKernelSource(mpProgram,
+            ::opencl::OpenCLDevice::generatBinFromKernelSource(mpProgram,
                 (mKernelSignature + GetMD5()).c_str());
         }
         lastSecondKernelHash = lastOneKernelHash;
@@ -3668,7 +3668,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
     {
         // Obtain cl context
         KernelEnv kEnv;
-        OpenCLDevice::setKernelEnv(&kEnv);
+        ::opencl::OpenCLDevice::setKernelEnv(&kEnv);
         // Run the kernel.
         pKernel->Launch(xGroup->mnLength);
         // Map results back
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 328e3c3..cc4f805 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -35,7 +35,7 @@
 #include <cstdio>
 
 #if HAVE_FEATURE_OPENCL
-#include "openclwrapper.hxx"
+#include <opencl/openclwrapper.hxx>
 #endif
 
 namespace sc {
@@ -542,7 +542,7 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
 void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rPlatforms)
 {
     const std::vector<OpenCLPlatformInfo>& rPlatformsFromWrapper =
-        sc::opencl::fillOpenCLInfo();
+        ::opencl::fillOpenCLInfo();
 
     rPlatforms.assign(rPlatformsFromWrapper.begin(), rPlatformsFromWrapper.end());
 }
@@ -564,7 +564,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
         msInstance = new sc::FormulaGroupInterpreterSoftware();
         return true;
     }
-    bool bSuccess = sc::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
+    bool bSuccess = ::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
     if(!bSuccess)
         return false;
 
@@ -591,7 +591,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);
 
-    sc::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId);
+    ::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId);
     rDeviceId = aDeviceId;
     rPlatformId = aPlatformId;
 }


More information about the Libreoffice-commits mailing list