officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 2 sc/source/core/inc/openclwrapper.hxx | 2 sc/source/core/opencl/opencl_device.cxx | 26 +++ sc/source/core/opencl/openclwrapper.cxx | 117 ++++++--------- sc/source/core/tool/calcconfig.cxx | 2 5 files changed, 83 insertions(+), 66 deletions(-)
New commits: commit 3c00552dac97adea3419d6e97e08047d214cbc4c Author: Tor Lillqvist <t...@collabora.com> Date: Wed Nov 12 21:49:05 2014 +0200 Check blacklist and whitelist here, too Change-Id: I0e411dccf445cb8d1e2e5238c1164d7ac18d8636 diff --git a/sc/source/core/opencl/opencl_device.cxx b/sc/source/core/opencl/opencl_device.cxx index 2703040..958fd1a 100644 --- a/sc/source/core/opencl/opencl_device.cxx +++ b/sc/source/core/opencl/opencl_device.cxx @@ -26,6 +26,8 @@ #include <boost/scoped_ptr.hpp> #include "opencl_device.hxx" +#include "openclwrapper.hxx" +#include "platforminfo.hxx" #define INPUTSIZE 15360 #define OUTPUTSIZE 15360 @@ -400,6 +402,30 @@ ds_status pickBestDevice(ds_profile* profile, int* bestDeviceIdx) ds_device device = profile->devices[d]; LibreOfficeDeviceScore *pScore = (LibreOfficeDeviceScore*)device.score; + // Check blacklist and whitelist for actual devices + if (device.type == DS_DEVICE_OPENCL_DEVICE) + { + // There is a silly impedance mismatch here. Why do we + // need two different ways to describe an OpenCL platform + // and an OpenCL device driver? + + OpenCLPlatformInfo aPlatform; + OpenCLDeviceInfo aDevice; + + // We know that only the below fields are used by checkForKnownBadCompilers() + aPlatform.maVendor = OUString(device.oclPlatformVendor, strlen(device.oclPlatformVendor), RTL_TEXTENCODING_UTF8); + aDevice.maName = OUString(device.oclDeviceName, strlen(device.oclDeviceName), RTL_TEXTENCODING_UTF8); + aDevice.maDriver = OUString(device.oclDriverVersion, strlen(device.oclDriverVersion), RTL_TEXTENCODING_UTF8); + + // If blacklisted or not whitelisted, ignore it + if (opencl::checkForKnownBadCompilers(aPlatform, aDevice)) + { + SAL_INFO("sc.opencl.device", "Device[" << d << "] " << device.oclDeviceName << " is blacklisted or not whitelisted"); + pScore->fTime = DBL_MAX; + pScore->bNoCLErrors = true; + } + } + double fScore = DBL_MAX; if (pScore) { commit 133ba236ac7367d3ce4a506fe93fb6eb144f48c1 Author: Tor Lillqvist <t...@collabora.com> Date: Wed Nov 12 21:45:55 2014 +0200 Make checkForKnownBadCompilers() public Change-Id: Icddf3c158e5f45d30467d3da82c197901d8bc380 diff --git a/sc/source/core/inc/openclwrapper.hxx b/sc/source/core/inc/openclwrapper.hxx index 1f11ffc..3da4afe 100644 --- a/sc/source/core/inc/openclwrapper.hxx +++ b/sc/source/core/inc/openclwrapper.hxx @@ -102,6 +102,8 @@ bool switchOpenCLDevice(const OUString* pDeviceId, bool bAutoSelect, void getOpenCLDeviceInfo(size_t& rDeviceId, size_t& rPlatformId); +bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice); + }} #endif diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index 2759fcd..87cc1c5 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -564,27 +564,6 @@ bool match(const ScCalcConfig::OpenCLImplMatcherSet& rList, const OpenCLPlatform } // based on crashes and hanging during kernel compilation -bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) -{ - // Check blacklist of known bad OpenCL implementations - if (match(ScInterpreter::GetGlobalConfig().maOpenCLBlackList, rPlatform, rDevice, "blacklist")) - { - SAL_INFO("sc.opencl", "Rejecting"); - return true; - } - - // Check for whitelist of known good OpenCL implementations - if (match(ScInterpreter::GetGlobalConfig().maOpenCLWhiteList, rPlatform, rDevice, "whitelist")) - { - SAL_INFO("sc.opencl", "Approving"); - return false; - } - - // Fallback: reject - SAL_INFO("sc.opencl", "Fallback: rejecting platform=" << rPlatform << ", device=" << rDevice); - return true; -} - void createDeviceInfo(cl_device_id aDeviceId, OpenCLPlatformInfo& rPlatformInfo) { OpenCLDeviceInfo aDeviceInfo; @@ -685,6 +664,27 @@ bool createPlatformInfo(cl_platform_id nPlatformId, OpenCLPlatformInfo& rPlatfor } +bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) +{ + // Check blacklist of known bad OpenCL implementations + if (match(ScInterpreter::GetGlobalConfig().maOpenCLBlackList, rPlatform, rDevice, "blacklist")) + { + SAL_INFO("sc.opencl", "Rejecting"); + return true; + } + + // Check for whitelist of known good OpenCL implementations + if (match(ScInterpreter::GetGlobalConfig().maOpenCLWhiteList, rPlatform, rDevice, "whitelist")) + { + SAL_INFO("sc.opencl", "Approving"); + return false; + } + + // Fallback: reject + SAL_INFO("sc.opencl", "Fallback: rejecting platform=" << rPlatform << ", device=" << rDevice); + return true; +} + const std::vector<OpenCLPlatformInfo>& fillOpenCLInfo() { static std::vector<OpenCLPlatformInfo> aPlatforms; commit c0b9b011d91d18c78b127b99e9d00283110a5a25 Author: Tor Lillqvist <t...@collabora.com> Date: Wed Nov 12 20:57:15 2014 +0200 Specify platform vendor, not platform name Change-Id: I4dc457a08d3baa48d461c27d325638735689f5fe diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index 829ad6a..753dda3 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 oor:separator=";">Linux/*/AMD Accelerated Parallel Processing/*/1445.5 (sse2,avx)/</value> + <value oor:separator=";">Linux/*/Advanced Micro Devices, Inc./*/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 1a2e69a..0d9b769 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -45,7 +45,7 @@ void ScCalcConfig::setOpenCLConfigToDefault() maOpenCLSubsetOpCodes.insert(ocAverage); maOpenCLSubsetOpCodes.insert(ocSumIfs); - maOpenCLWhiteList.insert(OpenCLImplMatcher("Linux", "*", "AMD Accelerated Parallel Processing", "*", "1445.5 (sse2,avx)", "")); + maOpenCLWhiteList.insert(OpenCLImplMatcher("Linux", "*", "Advanced Micro Devices, Inc.", "*", "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 7257254004c61f20f2d1d0186930e911b64ca2d7 Author: Tor Lillqvist <t...@collabora.com> Date: Wed Nov 12 20:56:11 2014 +0200 We want the platform vendor here, not the platform name We already have the platform name in maName. Change-Id: Iec94ce72cbaba0adf1c82a90892ab98851f5c8ca diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index 1db26ec..2759fcd 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -661,7 +661,7 @@ bool createPlatformInfo(cl_platform_id nPlatformId, OpenCLPlatformInfo& rPlatfor if(nState != CL_SUCCESS) return false; - rPlatformInfo.maVendor = OUString::createFromAscii(pName); + rPlatformInfo.maVendor = OUString::createFromAscii(pVendor); cl_uint nDevices; nState = clGetDeviceIDs(nPlatformId, CL_DEVICE_TYPE_ALL, 0, NULL, &nDevices); commit b2175d1100506102d45b700b2dda324e7162a8f3 Author: Tor Lillqvist <t...@collabora.com> Date: Wed Nov 12 20:45:07 2014 +0200 Refactor and fix checkForKnownBadCompilers() Change-Id: Ib2ee1a726fd54c34728234bc1a6b25a05b4e98b5 diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index f91e062..1db26ec 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -517,81 +517,66 @@ bool OpenCLDevice::initOpenCLRunEnv( GPUEnv *gpuInfo ) namespace { -// based on crashes and hanging during kernel compilation -bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) +bool match(const ScCalcConfig::OpenCLImplMatcher& rListEntry, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) { - // Check blacklist of known bad OpenCL implementations - - for (auto i = ScInterpreter::GetGlobalConfig().maOpenCLBlackList.cbegin(); - i != ScInterpreter::GetGlobalConfig().maOpenCLBlackList.end(); - ++i) - { - SAL_INFO("sc.opencl", "Looking for match for platform=" << rPlatform << ", device=" << rDevice << " in blacklist entry=" << *i); - #if defined WNT - if (i->maOS != "*" && i->maOS != "Windows") - continue; + if (rListEntry.maOS != "*" && rListEntry.maOS != "Windows") + return false; #elif defined LINUX - if (i->maOS != "*" && i->maOS != "Linux") - continue; + if (rListEntry.maOS != "*" && rListEntry.maOS != "Linux") + return false; #elif defined MACOSX - if (i->maOS != "*" && i->maOS != "OS X") - continue; + if (rListEntry.maOS != "*" && rListEntry.maOS != "OS X") + return false; #endif - // OS version check not yet implemented - - if (i->maPlatformVendor != "*" && i->maPlatformVendor != rDevice.maVendor) - continue; + // OS version check not yet implemented - if (i->maDevice != "*" && i->maDevice != rDevice.maName) - continue; + if (rListEntry.maPlatformVendor != "*" && rListEntry.maPlatformVendor != rPlatform.maVendor) + return false; - 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; + if (rListEntry.maDevice != "*" && rListEntry.maDevice != rDevice.maName) + return false; - // It matches; reject it - SAL_INFO("sc.opencl", "Match! Rejecting"); - return true; - } + if (rListEntry.maDriverVersionMin != "*" && + (comphelper::string::compareVersionStrings(rListEntry.maDriverVersionMin, rDevice.maDriver) > 0 || + (rListEntry.maDriverVersionMax != "" && comphelper::string::compareVersionStrings(rListEntry.maDriverVersionMax, rDevice.maDriver) < 0) || + (rListEntry.maDriverVersionMax == "" && comphelper::string::compareVersionStrings(rListEntry.maDriverVersionMin, rDevice.maDriver) < 0))) + return false; - // Check for whitelist of known good OpenCL implementations + return true; +} - for (auto i = ScInterpreter::GetGlobalConfig().maOpenCLWhiteList.cbegin(); - i != ScInterpreter::GetGlobalConfig().maOpenCLWhiteList.end(); - ++i) +bool match(const ScCalcConfig::OpenCLImplMatcherSet& rList, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice, const char* sKindOfList) +{ + for (auto i = rList.cbegin(); i != rList.end(); ++i) { - SAL_INFO("sc.opencl", "Looking for match for platform=" << rPlatform << ", device=" << rDevice << " in whitelist entry=" << *i); + SAL_INFO("sc.opencl", "Looking for match for platform=" << rPlatform << ", device=" << rDevice << + " in " << sKindOfList << " entry=" << *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 != rPlatform.maVendor) - continue; - - if (i->maDevice != "*" && i->maDevice != rDevice.maName) - continue; + if (match(*i, rPlatform, rDevice)) + { + SAL_INFO("sc.opencl", "Match!"); + return true; + } + } + return false; +} - if (i->maDriverVersionMin != "*" && - (comphelper::string::compareVersionStrings(i->maDriverVersionMin, rDevice.maDriver) > 0 || - comphelper::string::compareVersionStrings(i->maDriverVersionMax, rDevice.maDriver) < 0)) - continue; +// based on crashes and hanging during kernel compilation +bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) +{ + // Check blacklist of known bad OpenCL implementations + if (match(ScInterpreter::GetGlobalConfig().maOpenCLBlackList, rPlatform, rDevice, "blacklist")) + { + SAL_INFO("sc.opencl", "Rejecting"); + return true; + } - // It matches; approve it - SAL_INFO("sc.opencl", "Match! Approving"); + // Check for whitelist of known good OpenCL implementations + if (match(ScInterpreter::GetGlobalConfig().maOpenCLWhiteList, rPlatform, rDevice, "whitelist")) + { + SAL_INFO("sc.opencl", "Approving"); return false; } commit e2eaf71ff3f82c63b0282e9168f0687e38121fcd Author: Tor Lillqvist <t...@collabora.com> Date: Wed Nov 12 20:17:48 2014 +0200 A bit more informative SAL_INFO logging Change-Id: I60c38129a532e3843db4a422755ae50e4689b91f diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index c307371..f91e062 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -526,6 +526,8 @@ bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCL i != ScInterpreter::GetGlobalConfig().maOpenCLBlackList.end(); ++i) { + SAL_INFO("sc.opencl", "Looking for match for platform=" << rPlatform << ", device=" << rDevice << " in blacklist entry=" << *i); + #if defined WNT if (i->maOS != "*" && i->maOS != "Windows") continue; @@ -552,7 +554,7 @@ bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCL continue; // It matches; reject it - SAL_INFO("sc.opencl", "Match for platform=" << rPlatform << ", device=" << rDevice << " in blacklist=" << *i); + SAL_INFO("sc.opencl", "Match! Rejecting"); return true; } @@ -562,6 +564,8 @@ bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCL i != ScInterpreter::GetGlobalConfig().maOpenCLWhiteList.end(); ++i) { + SAL_INFO("sc.opencl", "Looking for match for platform=" << rPlatform << ", device=" << rDevice << " in whitelist entry=" << *i); + #if defined WNT if (i->maOS != "*" && i->maOS != "Windows") continue; @@ -587,7 +591,7 @@ bool checkForKnownBadCompilers(const OpenCLPlatformInfo& rPlatform, const OpenCL continue; // It matches; approve it - SAL_INFO("sc.opencl", "Match for platform=" << rPlatform << ", device=" << rDevice << " in whitelist=" << *i); + SAL_INFO("sc.opencl", "Match! Approving"); return false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits