[Libreoffice-commits] core.git: Branch 'private/tml/opencl-default-1' - 8 commits - officecfg/registry sc/inc sc/source
Tor Lillqvist
tml at collabora.com
Wed Nov 12 09:06:55 PST 2014
officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 2
sc/inc/platforminfo.hxx | 4
sc/source/core/inc/openclwrapper.hxx | 1
sc/source/core/opencl/opencl_device_selection.h | 7
sc/source/core/opencl/openclwrapper.cxx | 236 +++++----------
sc/source/core/tool/calcconfig.cxx | 3
sc/source/core/tool/platforminfo.cxx | 19 +
7 files changed, 126 insertions(+), 146 deletions(-)
New commits:
commit 623d3d05db426d6c7ad742f5f1981c984f3c1062
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 19:03:32 2014 +0200
Add first whitelist and blacklist check attempt to checkForKnownBadCompilers()
Not sure if that is the right place for it.
Change-Id: I246bb6191513f5c1557b9f211915becce0908d24
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index e6a0f7d..c307371 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -11,6 +11,7 @@
#include "openclwrapper.hxx"
+#include <comphelper/string.hxx>
#include <rtl/ustring.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/digest.h>
@@ -19,6 +20,8 @@
#include <sal/config.h>
#include <osl/file.hxx>
+#include "calcconfig.hxx"
+#include "interpre.hxx"
#include "opencl_device.hxx"
#include <stdio.h>
@@ -515,23 +518,82 @@ bool OpenCLDevice::initOpenCLRunEnv( GPUEnv *gpuInfo )
namespace {
// based on crashes and hanging during kernel compilation
-bool checkForKnownBadCompilers(const OpenCLDeviceInfo& rInfo)
+bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice)
{
+ // Check blacklist of known bad OpenCL implementations
- struct {
- const char* pVendorName; const char* pDriverVersion;
- } aBadOpenCLCompilers[] = {
- { "Intel(R) Corporation", "9.17.10.2884" }
- };
+ for (auto i = ScInterpreter::GetGlobalConfig().maOpenCLBlackList.cbegin();
+ i != ScInterpreter::GetGlobalConfig().maOpenCLBlackList.end();
+ ++i)
+ {
+#if defined WNT
+ if (i->maOS != "*" && i->maOS != "Windows")
+ continue;
+#elif defined LINUX
+ if (i->maOS != "*" && i->maOS != "Linux")
+ continue;
+#elif defined MACOSX
+ if (i->maOS != "*" && i->maOS != "OS X")
+ continue;
+#endif
+
+ // OS version check not yet implemented
+
+ if (i->maPlatformVendor != "*" && i->maPlatformVendor != rDevice.maVendor)
+ continue;
+
+ if (i->maDevice != "*" && i->maDevice != rDevice.maName)
+ continue;
+
+ if (i->maDriverVersionMin != "*" &&
+ (comphelper::string::compareVersionStrings(i->maDriverVersionMin, rDevice.maDriver) > 0 ||
+ (i->maDriverVersionMax != "" && comphelper::string::compareVersionStrings(i->maDriverVersionMax, rDevice.maDriver) < 0) ||
+ (i->maDriverVersionMax == "" && comphelper::string::compareVersionStrings(i->maDriverVersionMin, rDevice.maDriver) < 0)))
+ continue;
+
+ // It matches; reject it
+ SAL_INFO("sc.opencl", "Match for platform=" << rPlatform << ", device=" << rDevice << " in blacklist=" << *i);
+ return true;
+ }
+
+ // Check for whitelist of known good OpenCL implementations
- for(size_t i = 0; i < SAL_N_ELEMENTS(aBadOpenCLCompilers); ++i)
+ for (auto i = ScInterpreter::GetGlobalConfig().maOpenCLWhiteList.cbegin();
+ i != ScInterpreter::GetGlobalConfig().maOpenCLWhiteList.end();
+ ++i)
{
- if(rInfo.maVendor == OUString::createFromAscii(aBadOpenCLCompilers[i].pVendorName) &&
- rInfo.maDriver == OUString::createFromAscii(aBadOpenCLCompilers[i].pDriverVersion))
- return true;
+#if defined WNT
+ if (i->maOS != "*" && i->maOS != "Windows")
+ continue;
+#elif defined LINUX
+ if (i->maOS != "*" && i->maOS != "Linux")
+ continue;
+#elif defined MACOSX
+ if (i->maOS != "*" && i->maOS != "OS X")
+ continue;
+#endif
+
+ // OS version check not yet implemented
+
+ if (i->maPlatformVendor != "*" && i->maPlatformVendor != rPlatform.maVendor)
+ continue;
+
+ if (i->maDevice != "*" && i->maDevice != rDevice.maName)
+ continue;
+
+ if (i->maDriverVersionMin != "*" &&
+ (comphelper::string::compareVersionStrings(i->maDriverVersionMin, rDevice.maDriver) > 0 ||
+ comphelper::string::compareVersionStrings(i->maDriverVersionMax, rDevice.maDriver) < 0))
+ continue;
+
+ // It matches; approve it
+ SAL_INFO("sc.opencl", "Match for platform=" << rPlatform << ", device=" << rDevice << " in whitelist=" << *i);
+ return false;
}
- return false;
+ // Fallback: reject
+ SAL_INFO("sc.opencl", "Fallback: rejecting platform=" << rPlatform << ", device=" << rDevice);
+ return true;
}
void createDeviceInfo(cl_device_id aDeviceId, OpenCLPlatformInfo& rPlatformInfo)
@@ -590,7 +652,7 @@ void createDeviceInfo(cl_device_id aDeviceId, OpenCLPlatformInfo& rPlatformInfo)
aDeviceInfo.mnComputeUnits = nComputeUnits;
- if(!checkForKnownBadCompilers(aDeviceInfo))
+ if(!checkForKnownBadCompilers(rPlatformInfo, aDeviceInfo))
rPlatformInfo.maDevices.push_back(aDeviceInfo);
}
commit d34606de54b924e11bf4f56b15a6cd4bc386e8d5
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 19:01:56 2014 +0200
Add a whitelist entry, too (for what I happen to be running at the moment)
I am starting to suspect that we will need regexps for the driver versions,
not just match-anything wildcard "*" and version number comparison a'la
strverscmp.
Change-Id: I6945f8be2cf478a8f0c76c5d9f82b2d60a981f37
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 57bb66c..377f5f4 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1394,7 +1394,7 @@
<info>
<desc>Combinations of (OS, OS version, OpenCL platform vendor, OpenCL device name, OpenCL driver version) that are known to be good. Has higher priority than OpenCLBlackList. Each entry is a string consisting of five parts separated by slashes. In case a slash occurs inside a part, it is prefixed by a backslash. And in case a backslash occurs inside a part, it is also prefixed by another backslash. Any part might contain a single asterisk as a wildcard, matching any value, but there is no more generic regexp support.</desc>
</info>
- <value/>
+ <value oor:separator=";">*/*/AMD Accelerated Parallel Processing/*/1445.5 (sse2,avx)/</value>
</prop>
<prop oor:name="OpenCLBlackList" oor:type="oor:string-list" oor:nillable="false">
<!-- UIHints: Tools - Options Spreadsheet Formula -->
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 36d1fa5..1a2e69a 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -44,6 +44,9 @@ void ScCalcConfig::setOpenCLConfigToDefault()
maOpenCLSubsetOpCodes.insert(ocSum);
maOpenCLSubsetOpCodes.insert(ocAverage);
maOpenCLSubsetOpCodes.insert(ocSumIfs);
+
+ maOpenCLWhiteList.insert(OpenCLImplMatcher("Linux", "*", "AMD Accelerated Parallel Processing", "*", "1445.5 (sse2,avx)", ""));
+
maOpenCLBlackList.insert(OpenCLImplMatcher("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884", ""));
maOpenCLBlackList.insert(OpenCLImplMatcher("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3", "4.4"));
}
commit d8e2dfe2122e042b7991d49ccbc86392afe2a68e
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 19:00:36 2014 +0200
Add output operators for SAL_INFO convenience
Change-Id: Iee3be5f4847f12f3463438435b1713c5ad74d3d0
diff --git a/sc/inc/platforminfo.hxx b/sc/inc/platforminfo.hxx
index c7bb377..8fd0ee2 100644
--- a/sc/inc/platforminfo.hxx
+++ b/sc/inc/platforminfo.hxx
@@ -10,6 +10,7 @@
#ifndef INCLUDED_SC_INC_PLATFORMINFO_HXX
#define INCLUDED_SC_INC_PLATFORMINFO_HXX
+#include <ostream>
#include <vector>
#include <rtl/ustring.hxx>
@@ -43,4 +44,7 @@ struct SC_DLLPUBLIC OpenCLPlatformInfo
}
+SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLPlatformInfo& rPlatform);
+SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLDeviceInfo& rDevice);
+
#endif
diff --git a/sc/source/core/tool/platforminfo.cxx b/sc/source/core/tool/platforminfo.cxx
index 3f90b14..f456939 100644
--- a/sc/source/core/tool/platforminfo.cxx
+++ b/sc/source/core/tool/platforminfo.cxx
@@ -27,4 +27,23 @@ OpenCLPlatformInfo::OpenCLPlatformInfo()
}
+std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLPlatformInfo& rPlatform)
+{
+ rStream << "{"
+ "Vendor=" << rPlatform.maVendor << ","
+ "Name=" << rPlatform.maName <<
+ "}";
+ return rStream;
+}
+
+std::ostream& operator<<(std::ostream& rStream, const sc::OpenCLDeviceInfo& rDevice)
+{
+ rStream << "{"
+ "Name=" << rDevice.maName << ","
+ "Vendor=" << rDevice.maVendor << ","
+ "Driver=" << rDevice.maDriver <<
+ "}";
+ return rStream;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 62eb2d1c46233447c565de5ee4461ac21bb9d397
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 15:20:44 2014 +0200
Bin effectively dead code
initOpenCLAttr() sets mnIsUserCreated to 1, thus it can never be 0 in
initOpenCLRunEnv().
Change-Id: If42b4fac082284bd0924292d234911b3c319f9ab
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 4516af5..e6a0f7d 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -501,122 +501,6 @@ void checkDeviceForDoubleSupport(cl_device_id deviceId, bool& bKhrFp64, bool& bA
bool OpenCLDevice::initOpenCLRunEnv( GPUEnv *gpuInfo )
{
- size_t length;
- cl_int clStatus;
- cl_uint numPlatforms, numDevices;
- cl_platform_id *platforms;
-
- // Have a look at the available platforms.
-
- if ( !gpuInfo->mnIsUserCreated )
- {
- clStatus = clGetPlatformIDs( 0, NULL, &numPlatforms );
- CHECK_OPENCL(clStatus, "clGetPlatformIDs");
- gpuInfo->mpPlatformID = NULL;
-
- if ( 0 < numPlatforms )
- {
- char platformName[256];
- platforms = (cl_platform_id*) malloc( numPlatforms * sizeof( cl_platform_id ) );
- if (!platforms)
- {
- return true;
- }
- clStatus = clGetPlatformIDs( numPlatforms, platforms, NULL );
- CHECK_OPENCL(clStatus, "clGetPlatformIDs");
-
- for ( unsigned int i = 0; i < numPlatforms; i++ )
- {
- clStatus = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR,
- sizeof( platformName ), platformName, NULL );
-
- if ( clStatus != CL_SUCCESS )
- {
- break;
- }
- gpuInfo->mpPlatformID = platforms[i];
-
- //if (!strcmp(platformName, "Intel(R) Coporation"))
- //if( !strcmp( platformName, "Advanced Micro Devices, Inc." ))
- {
- gpuInfo->mpPlatformID = platforms[i];
- if ( getenv("SC_OPENCLCPU") )
- {
- clStatus = clGetDeviceIDs(gpuInfo->mpPlatformID, // platform
- CL_DEVICE_TYPE_CPU, // device_type for CPU device
- 0, // num_entries
- NULL, // devices
- &numDevices);
- }
- else
- {
- clStatus = clGetDeviceIDs(gpuInfo->mpPlatformID, // platform
- CL_DEVICE_TYPE_GPU, // device_type for GPU device
- 0, // num_entries
- NULL, // devices
- &numDevices);
- }
- if ( clStatus != CL_SUCCESS )
- continue;
-
- if ( numDevices )
- break;
- }
- }
- free( platforms );
- if ( clStatus != CL_SUCCESS )
- return true;
- }
- if ( NULL == gpuInfo->mpPlatformID )
- return true;
-
- // Use available platform.
- cl_context_properties cps[3];
- cps[0] = CL_CONTEXT_PLATFORM;
- cps[1] = reinterpret_cast<cl_context_properties>(gpuInfo->mpPlatformID);
- cps[2] = 0;
- // Set device type for OpenCL
- if ( getenv("SC_OPENCLCPU") )
- {
- gpuInfo->mDevType = CL_DEVICE_TYPE_CPU;
- }
- else
- {
- gpuInfo->mDevType = CL_DEVICE_TYPE_GPU;
- }
- gpuInfo->mpContext = clCreateContextFromType( cps, gpuInfo->mDevType, NULL, NULL, &clStatus );
-
- if ( ( gpuInfo->mpContext == (cl_context) NULL) || ( clStatus != CL_SUCCESS ) )
- {
- gpuInfo->mDevType = CL_DEVICE_TYPE_CPU;
- gpuInfo->mpContext = clCreateContextFromType( cps, gpuInfo->mDevType, NULL, NULL, &clStatus );
- }
- if ( ( gpuInfo->mpContext == (cl_context) NULL) || ( clStatus != CL_SUCCESS ) )
- {
- gpuInfo->mDevType = CL_DEVICE_TYPE_DEFAULT;
- gpuInfo->mpContext = clCreateContextFromType( cps, gpuInfo->mDevType, NULL, NULL, &clStatus );
- }
- if ( ( gpuInfo->mpContext == (cl_context) NULL) || ( clStatus != CL_SUCCESS ) )
- return true;
- // Detect OpenCL devices.
- // First, get the size of device list data
- clStatus = clGetContextInfo( gpuInfo->mpContext, CL_CONTEXT_DEVICES, 0, NULL, &length );
- if ( ( clStatus != CL_SUCCESS ) || ( length == 0 ) )
- return true;
- // Now allocate memory for device list based on the size we got earlier
- gpuInfo->mpArryDevsID = (cl_device_id*) malloc( length );
- if ( gpuInfo->mpArryDevsID == (cl_device_id*) NULL )
- return true;
- // Now, get the device list data
- clStatus = clGetContextInfo( gpuInfo->mpContext, CL_CONTEXT_DEVICES, length,
- gpuInfo->mpArryDevsID, NULL );
- CHECK_OPENCL(clStatus, "clGetContextInfo");
-
- // Create OpenCL command queue.
- gpuInfo->mpCmdQueue = clCreateCommandQueue( gpuInfo->mpContext, gpuInfo->mpArryDevsID[0], 0, &clStatus );
-
- CHECK_OPENCL(clStatus, "clCreateCommandQueue");
- }
bool bKhrFp64 = false;
bool bAmdFp64 = false;
@@ -912,10 +796,7 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
// (Assuming the above question refers to the mpArryDevsID
// initialisation below.) Because otherwise the code crashes in
- // initOpenCLRunEnv(). Note that the initOpenCLAttr() call above
- // sets mnIsUserCreated to 1, thus the code in initOpenCLRunEnv()
- // that would initialise mpArryDevsID is not executed. Confused?
- // You should be.
+ // initOpenCLRunEnv(). Confused? You should be.
OpenCLDevice::gpuEnv.mpArryDevsID = (cl_device_id*) malloc( sizeof(cl_device_id) );
OpenCLDevice::gpuEnv.mpArryDevsID[0] = pDeviceId;
commit 89d75b048faaa1f9e783def440af546249a13ab1
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 15:02:37 2014 +0200
Add comment that replies to the question in comment above
Change-Id: Iad8896df4491b2b4363fb2d16134e92dd9545c35
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 3812bd7..4516af5 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -909,8 +909,17 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
OpenCLDevice::initOpenCLAttr(&env);
// why do we need this at all?
+
+ // (Assuming the above question refers to the mpArryDevsID
+ // initialisation below.) Because otherwise the code crashes in
+ // initOpenCLRunEnv(). Note that the initOpenCLAttr() call above
+ // sets mnIsUserCreated to 1, thus the code in initOpenCLRunEnv()
+ // that would initialise mpArryDevsID is not executed. Confused?
+ // You should be.
+
OpenCLDevice::gpuEnv.mpArryDevsID = (cl_device_id*) malloc( sizeof(cl_device_id) );
OpenCLDevice::gpuEnv.mpArryDevsID[0] = pDeviceId;
+
return !OpenCLDevice::initOpenCLRunEnv(0);
}
commit d746bcb7333e29bcfb4b3b81756ec7ad343c6ab1
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 14:14:32 2014 +0200
Don't use misleading 'm' prefix for non-member variables
Change-Id: I5b3042e4b5cc11445a8f704df686cebe56874b12
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 0c01274..3812bd7 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -136,16 +136,16 @@ std::vector<boost::shared_ptr<osl::File> > OpenCLDevice::binaryGenerated( const
return aGeneratedFiles;
// grab the handles to all of the devices in the context.
- boost::scoped_array<cl_device_id> mpArryDevsID(new cl_device_id[numDevices]);
+ boost::scoped_array<cl_device_id> pArryDevsID(new cl_device_id[numDevices]);
clStatus = clGetContextInfo( context, CL_CONTEXT_DEVICES,
- sizeof( cl_device_id ) * numDevices, mpArryDevsID.get(), NULL );
+ sizeof( cl_device_id ) * numDevices, pArryDevsID.get(), NULL );
if(clStatus != CL_SUCCESS)
return aGeneratedFiles;
for ( size_t i = 0; i < numDevices; i++ )
{
- if ( mpArryDevsID[i] != 0 )
+ if ( pArryDevsID[i] != 0 )
{
OString fileName = createFileName(gpuEnv.mpArryDevsID[i], clFileName);
osl::File* pNewFile = new osl::File(rtl::OStringToOUString(fileName, RTL_TEXTENCODING_UTF8));
@@ -191,10 +191,10 @@ bool OpenCLDevice::generatBinFromKernelSource( cl_program program, const char *
sizeof(numDevices), &numDevices, NULL );
CHECK_OPENCL( clStatus, "clGetProgramInfo" );
- std::vector<cl_device_id> mpArryDevsID(numDevices);
+ std::vector<cl_device_id> pArryDevsID(numDevices);
/* grab the handles to all of the devices in the program. */
clStatus = clGetProgramInfo( program, CL_PROGRAM_DEVICES,
- sizeof(cl_device_id) * numDevices, &mpArryDevsID[0], NULL );
+ sizeof(cl_device_id) * numDevices, &pArryDevsID[0], NULL );
CHECK_OPENCL( clStatus, "clGetProgramInfo" );
/* figure out the sizes of each of the binaries. */
@@ -229,7 +229,7 @@ bool OpenCLDevice::generatBinFromKernelSource( cl_program program, const char *
if ( binarySizes[i] != 0 )
{
- OString fileName = createFileName(mpArryDevsID[i], clFileName);
+ OString fileName = createFileName(pArryDevsID[i], clFileName);
if ( !writeBinaryToFile( fileName,
binaries[i], binarySizes[i] ) )
SAL_INFO("sc.opencl.file", "Writing binary file '" << fileName << "': FAIL");
@@ -388,9 +388,9 @@ bool OpenCLDevice::buildProgramFromBinary(const char* buildOption, GPUEnv* gpuIn
}
// grab the handles to all of the devices in the context.
- boost::scoped_array<cl_device_id> mpArryDevsID(new cl_device_id[numDevices]);
+ boost::scoped_array<cl_device_id> pArryDevsID(new cl_device_id[numDevices]);
clStatus = clGetContextInfo( gpuInfo->mpContext, CL_CONTEXT_DEVICES,
- sizeof( cl_device_id ) * numDevices, mpArryDevsID.get(), NULL );
+ sizeof( cl_device_id ) * numDevices, pArryDevsID.get(), NULL );
if(clStatus != CL_SUCCESS)
{
@@ -404,7 +404,7 @@ bool OpenCLDevice::buildProgramFromBinary(const char* buildOption, GPUEnv* gpuIn
cl_int binary_status;
gpuInfo->mpArryPrograms[idx] = clCreateProgramWithBinary( gpuInfo->mpContext,numDevices,
- mpArryDevsID.get(), length.get(), (const unsigned char**) pBinary.get(),
+ pArryDevsID.get(), length.get(), (const unsigned char**) pBinary.get(),
&binary_status, &clStatus );
if(clStatus != CL_SUCCESS)
{
commit c42cea37f16c2ef95c2983ae09a048fa6f016b13
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 13:39:31 2014 +0200
Expand tiny misleadingly named 'registerOpenCLKernel' at its only call site
The function did not register any OpenCL kernel;)
Change-Id: Iebba89bc39d3035ff0d39d9cfa8ec72d4ebf217a
diff --git a/sc/source/core/inc/openclwrapper.hxx b/sc/source/core/inc/openclwrapper.hxx
index bc3957f..1f11ffc 100644
--- a/sc/source/core/inc/openclwrapper.hxx
+++ b/sc/source/core/inc/openclwrapper.hxx
@@ -75,7 +75,6 @@ public:
static bool bIsInited;
static OString maCacheFolder;
- static void registerOpenCLKernel();
static bool initOpenCLRunEnv( GPUEnv *gpu );
static void releaseOpenCLEnv( GPUEnv *gpuInfo );
static bool initOpenCLRunEnv( int argc );
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 23db69e..0c01274 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -81,12 +81,6 @@ OString getCacheFolder()
OString OpenCLDevice::maCacheFolder = getCacheFolder();
-void OpenCLDevice::registerOpenCLKernel()
-{
- if ( !gpuEnv.mnIsUserCreated )
- memset( &gpuEnv, 0, sizeof(gpuEnv) );
-}
-
void OpenCLDevice::setKernelEnv( KernelEnv *envInfo )
{
envInfo->mpkContext = gpuEnv.mpContext;
@@ -437,7 +431,9 @@ bool OpenCLDevice::initOpenCLRunEnv( int argc )
if ( !bIsInited )
{
- registerOpenCLKernel();
+ if ( !gpuEnv.mnIsUserCreated )
+ memset( &gpuEnv, 0, sizeof(gpuEnv) );
+
//initialize devices, context, command_queue
bool status = initOpenCLRunEnv( &gpuEnv );
if ( status )
commit 0253c7b9b3ba920b24f191d19d921b02ccb2fb9f
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Nov 12 13:29:37 2014 +0200
Keep also the platform vendor in ds_device
Change-Id: Id195cf9d079b24108b1fb9abeb1f0bf1529d2f72
diff --git a/sc/source/core/opencl/opencl_device_selection.h b/sc/source/core/opencl/opencl_device_selection.h
index fcfa41a..43e0f4c 100644
--- a/sc/source/core/opencl/opencl_device_selection.h
+++ b/sc/source/core/opencl/opencl_device_selection.h
@@ -49,6 +49,7 @@ struct ds_device
{
ds_device_type type;
cl_device_id oclDeviceID;
+ char* oclPlatformVendor;
char* oclDeviceName;
char* oclDriverVersion;
void* score; // a pointer to the score data, the content/format is application defined
@@ -73,6 +74,7 @@ inline ds_status releaseDSProfile(ds_profile* profile, ds_score_release sr)
unsigned int i;
for (i = 0; i < profile->numDevices; i++)
{
+ free(profile->devices[i].oclPlatformVendor);
free(profile->devices[i].oclDeviceName);
free(profile->devices[i].oclDriverVersion);
status = sr(profile->devices[i].score);
@@ -148,6 +150,9 @@ inline ds_status initDSProfile(ds_profile** p, const char* version)
{
cl_uint num;
unsigned j;
+ char vendor[256];
+ if (clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, sizeof(vendor), vendor, NULL) != CL_SUCCESS)
+ vendor[0] = '\0';
clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, numDevices, devices, &num);
for (j = 0; j < num; j++, next++)
{
@@ -157,6 +162,8 @@ inline ds_status initDSProfile(ds_profile** p, const char* version)
profile->devices[next].type = DS_DEVICE_OPENCL_DEVICE;
profile->devices[next].oclDeviceID = devices[j];
+ profile->devices[next].oclPlatformVendor = strdup(vendor);
+
clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME
, DS_DEVICE_NAME_LENGTH, &buffer, NULL);
length = strlen(buffer);
More information about the Libreoffice-commits
mailing list