77 Commits

Author SHA1 Message Date
Jochen Nitschke
5301985417 cppcheck: memleak (false positive)
but manage ownership from start

Change-Id: I22d855d89bd93c56fbbcc1fb64e757fc950aa791
Reviewed-on: https://gerrit.libreoffice.org/33391
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-22 13:54:22 +00:00
Stephan Bergmann
4d6353aa9d New loplugin:conststringvar: opencl
Change-Id: Ib5762151cff4c903c73ec8d487ec8fbe54a9255a
2017-01-10 08:11:17 +01:00
Stephan Bergmann
e681b38402 No apparent reason for an unnamed namespace in an include file here
Change-Id: I1017459520ba4f0e544f0fa00419789c8cd86609
2016-12-21 14:57:56 +01:00
Tomaž Vajngerl
21e8ed8b5f tdf#103395 opencl: don't initialize OpenCL when disabled
If SAL_DISABLE_OPENCL is set we don't want to do any kind of
OpenCL initialization. Put an extra guard in fillOpenCLInfo
(and similar methods in opencl package) to prevent that.

Put the check if OpenCL can be used into one place which checks
SAL_DISABLE_OPENCL and UseOpenCL in configuration.

Change-Id: Icc216d4299d3a7942843117ab9b9411de8075b11
Reviewed-on: https://gerrit.libreoffice.org/30025
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-10-24 08:35:15 +00:00
Tomaž Vajngerl
baeb3b43fb opencl: convert to C++11 for loop
Change-Id: Id96a3816eb7ef2241f5a6a57b164e1e366eb357a
Reviewed-on: https://gerrit.libreoffice.org/29693
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-10-18 22:13:24 +00:00
Tomaž Vajngerl
4eea4af892 tdf#103204 opencl: initialize command queue on demand
Change-Id: Ie3da1d6ec91e951b1ffc15abf376c7af57789e47
Reviewed-on: https://gerrit.libreoffice.org/29802
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-10-18 09:01:14 +00:00
Stephan Bergmann
52659c125e clang-cl loplugin: opencl
Change-Id: I7e0e79d67d6701e519f841d893c9b7b2f5ebef80
Reviewed-on: https://gerrit.libreoffice.org/29858
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-16 14:18:32 +00:00
Andrea Gelmini
6445d8d7d6 Fix typos
Change-Id: Icfc61fcc5ace717bca4bea988243674afe31e6f8
Reviewed-on: https://gerrit.libreoffice.org/29435
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-01 19:08:07 +00:00
Stephan Bergmann
ca3c8526ef Valgrind reports read of uninitialized bCLBool
...during e.g. CppunitTest_sc_subsequent_filters_test, where
CL_DEVICE_LINKER_AVAILABLE is apparently a later addition (<https://
www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetDeviceInfo.html>
mentions it while <https://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/
clGetDeviceInfo.html> doesn't).

Change-Id: Icdaeffa4adb0765a6317f443130fa295761eb93f
2016-09-21 13:17:31 +02:00
Michael Stahl
b647996a9b replace sal_Size with std::size_t (or sal_uInt64 for SvStream pos)
... except in include/rtl, include/sal, include/uno, where sal_Size is
retained for compatibility, and where callers of rtl functions pass in
pointers that are incompatible on MSVC.

Change-Id: I8344453780689f5120ba0870e44965b6d292450c
2016-09-15 12:01:11 +02:00
Stephan Bergmann
cd252e3ad8 loplugin:stringconstant: adapt to improved OUStringLiteral1 (opencl)
Change-Id: I0da7434b67148824d1c2343f8ecb2b069df6baa2
2016-08-30 15:28:28 +02:00
Jochen Nitschke
33b38082ca put StreamMode masks in scope of enum class
Change-Id: I77682f7e289a59b986bb84edf014029a20266470
Reviewed-on: https://gerrit.libreoffice.org/28420
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-27 12:06:15 +00:00
Caolán McNamara
e1d50431a0 coverity#1371130 'Constant' variable guards dead code
Change-Id: I94ac63f009cb398ef88e4889084bb9a99eb8bf6c
2016-08-19 13:00:44 +01:00
Tor Lillqvist
32881f0183 tdf#100965: Restart on initialisation-time OpenCL crash
Add a flag to the OpenCLZone indicating whether we are performing the
first-start OpenCL functionality verification, so that if we run into
a crash that is caught by the VCL VCLExceptionSignal_impl() handler,
we terminate the process with the EXITHELPER_NORMAL_RESTART
status after first having disabled OpenCL use. The wrapper process will
then restart soffice.bin. This is for Windows only so far.

This matches what we do if OpenGL fails early during start of
LibreOffice.

Change-Id: Ibb9bf3a86b7521bf16728de2a118ad4323be674b
Reviewed-on: https://gerrit.libreoffice.org/28086
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-08-14 06:54:03 +00:00
Noel Grandin
f12476f0f6 loplugin:countusersofdefaultparams in oox..sd
Change-Id: I4504939a3957606979c6ac36af6611e1fe072d01
Reviewed-on: https://gerrit.libreoffice.org/27902
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-05 11:50:45 +00:00
Noel Grandin
508c95f1b6 improve passstuffbyref return analysis
Change-Id: I4258bcc97273d8bb7a8c4879fac02a427f76e18c
Reviewed-on: https://gerrit.libreoffice.org/27317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-07-27 06:48:25 +00:00
Laszlo Nemeth
00a58dfead Need to try to avoid TDR also with NVIDIA cards on Windows 7 or earlier
(TDR is Timeout detection and recovery, was introduced in Vista.)

Change-Id: Ic49629adf7630e61cebcdfcc431ca96ba3fbaf7e
Reviewed-on: https://gerrit.libreoffice.org/27518
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2016-07-26 07:41:38 +00:00
Tor Lillqvist
dbdfd36f8a SAL_DETAIL_WHERE already ends with a space
Change-Id: I273e0e4301246122bd9e02556b771dc485877350
2016-07-22 18:59:59 +03:00
Michael Meeks
e9a1afbd3e tdf#100883 - opencl impls. that use SEH are still bad.
Amazingly we fell-back to the old calculation path for
crashes in older LibreOffices, might as well have this on master.

Change-Id: Ifc1de41c93329207d7a1917c736e361d840c2821
Reviewed-on: https://gerrit.libreoffice.org/27166
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2016-07-12 20:01:25 +00:00
Michael Meeks
c44726c482 desktop: validate OpenCL drivers before use.
OpenCL validation needs to happen before drivers are used in
anger. This should isolate any crashes, and/or mis-behavior to
We use app version, CL driver version and file time-stamp to
trigger re-testing the device. If anything fails: hard disable
OpenCL.

We use an opencl validation sheet (cl-test.ods) and install it.
It is a minimal CL set - it requires a very short formula group
length, and combines several CL functions into few formulae to
test more.

The sheet structure, in particular the manual squaring / SQRT is
necessary to stick within the default CL subset, and ensure that
formulae are CL enabled from the root of the dependency tree up.

Change-Id: I18682dbdf9a8ba9c16d52bad4447e9acce97f0a3
Reviewed-on: https://gerrit.libreoffice.org/27131
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2016-07-12 08:39:01 +00:00
Stephan Bergmann
9c711f05fa Remove bogus dependency from opencl to configmgr
Since f41eb66302208f384a475fb20c98b6d1b0676cb6 "opencl: OpenCLZone, detect CL
device change and disable CL on crash" vcl links against opencl (so indirectly
linked against configmgr), which caused CppunitTest_configmgr_unit to include
the configmgr object files both statically (through
gb_CppunitTest_use_library_objects) and through the linked-in configmgr dynamic
library, which in turn caused ASan builds to report an ODR violation for a
doubly defined 'typeinfo name for configmgr::Access'.

Change-Id: I9ae8637ac02c116dd2d03017f2ebb4004f4b14ad
2016-07-12 10:31:55 +02:00
Stephan Bergmann
f541b99855 loplugin:nullptr: Better heuristic to determine code shared between C and C++
Change-Id: I51e1c5fa4639e51fac90f92adf3d87d12960d589
2016-07-11 14:32:07 +02:00
Tomaž Vajngerl
f41eb66302 opencl: OpenCLZone, detect CL device change and disable CL on crash
Guard OpenCL calls with OpenCLZone, so if a OpenCL call crashes we
detect this and disable OpenCL so next time the user doesn't encounter
the crash at the same calculation because he has a broken OpenCL
drivers. Similar has been implemented for OpenGL with good results.

Additionaly we persistently remember a known good OpenCL device ID and
driver version so we can match this and perform calculation tests when
they change. This is to ensure that the selected OpenCL device performs
as we expect. In this commit the calculation tests aren't included yet.

Remove complex static initializer in opencl wrapper library.

Change-Id: I1a8b81ee31298731efcf63dc6a476955afc035e9
Reviewed-on: https://gerrit.libreoffice.org/27064
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-07-11 06:52:31 +00:00
Michael Meeks
ef47ce2397 tdf#90336 - further cleanup of OpenCL options page.
Still problematic; since we only show OpenCL as being available
if it has already been initialized and used.

Change-Id: I5e82a3f778f4f2025408330b6d9da51402d01e79
Reviewed-on: https://gerrit.libreoffice.org/26866
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2016-07-01 19:02:57 +00:00
Tor Lillqvist
68106cbac5 Don't waste too much time evaluating the "score" for the "native CPU"
This code took tens of second typically, which is utterly pointless.
Instead run the loop for max a second, after which estimate how long
it would have taken to process all of the data.

Don't confuse the "native CPU" term here with a CPU-based device
of an actual OpenCL implementation. That is a completely different
thing. This "native CPU" thing here is just our way to estimate how
much time it takes to do calculations using normal C++ code on the
CPU.

Change-Id: I92f5eedc06bbaaef6a9b5322fefec9d41f0db505
Reviewed-on: https://gerrit.libreoffice.org/26774
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
2016-06-29 16:09:15 +00:00
Tor Lillqvist
4e3bcddeb5 Add some SAL_INFO output
Change-Id: I8b47034f5b1fed465415399de89979102df8d9a7
2016-06-27 18:17:03 +03:00
Tor Lillqvist
c62baccba2 Add some informative comments
Change-Id: I3c85543efe824c06781486aff2d836e5ba48e66e
2016-06-27 18:16:02 +03:00
Stephan Bergmann
4d49c9601c Let loplugin:passstuffbyref also look at fn defn not preceded by any decl
Change-Id: I752bc96d2d521d790e919283cabb14b6526626f4
2016-06-08 17:14:34 +02:00
Michael Stahl
62d270116b tools: rename SvStream::Read/Write to ReadBytes/WriteBytes
Change-Id: Ib788a30d413436aa03f813aa2fddcbc4d6cd2f9a
Reviewed-on: https://gerrit.libreoffice.org/25972
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-06-06 18:09:11 +00:00
Mark Hung
40b0b9ab77 Ensure that OpenCL device id returned from getDeviceSelection() is valid.
Change-Id: I756bb57d471db3d3ca1d9c3733d359c7c16b4e66
Reviewed-on: https://gerrit.libreoffice.org/24959
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mark Page <aptitude@btconnect.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-06-06 10:34:07 +00:00
Caolán McNamara
3c65f07ede cppcheck: noExplicitConstructor
Change-Id: Ibb6bc9a17418a8fb0b5f882285088a5b80fd5beb
2016-05-26 12:01:11 +01:00
Andrea Gelmini
3742748699 Fix typos
Change-Id: I1c1894fcf533291b34a662b6efb96dcfa75b92b3
Reviewed-on: https://gerrit.libreoffice.org/24760
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-05-10 19:13:31 +00:00
Noel Grandin
f07ff7ed8a clang-tidy modernize-loop-convert in oox to sax
Change-Id: If0d87b6679765fc6d1f9300c6972845cf3742b9c
Reviewed-on: https://gerrit.libreoffice.org/24674
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-05 12:44:25 +00:00
Caolán McNamara
478a4032da coverity#1358844 Uninitialized pointer field
Change-Id: I66f34570c49f647cb1fd7775ef263e5e720d8064
2016-04-29 20:11:50 +01:00
Caolán McNamara
77327a0390 coverity#1358843 Argument cannot be negative
Change-Id: I97911406d55464f042922a2e37b33f92e2c024ef
2016-04-29 20:10:22 +01:00
Noel Grandin
e8fd5a07ec update loplugin stylepolice to check local pointers vars
are actually pointer vars.

Also convert from regex to normal code, so we can enable this
plugin all the time.

Change-Id: Ie36a25ecba61c18f99c77c77646d6459a443cbd1
Reviewed-on: https://gerrit.libreoffice.org/24391
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-26 10:55:58 +00:00
Stephan Bergmann
92f10ad9bc Various loplugin warnings in opencl/
Change-Id: Ia6254777bc7972e2272dba542e315a8d3bd0fdf0
2016-04-22 13:44:38 +02:00
Tomaž Vajngerl
334e2dc9c3 opencl: better logging of devices and device selection
changes:
- Clew misses a lot of things, added defines needed for gathering
  platform and device info.
- Refactored profile saving and loading to use libxml2 instead
  the weird type of saving the profile data.
- Added an additional "log" file which is similar to the OpenGL
  but it writes the OpenCL relevant information like which devices
  and platforms are available (+ all the extra useful version
  information) and which device was selected (if any at all).

Change-Id: I0fe793c756f8f4f1761fe120fc361df36e581903
Reviewed-on: https://gerrit.libreoffice.org/24270
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-04-22 11:27:05 +00:00
Stephan Bergmann
ec53ac63e3 Move clew/clew.h into external, too
For consistency with what 38cd1d9a5f00dc69ba0d60e2fe6957090c7a26d1 "clew: move
this foreign code to external/clew" did for clew.c.  Library_scfilt depends on
clew/clew.h, simply make it depend on the full clew external.

Change-Id: Idcbf56a69084e108832c8970507ebea0f7ff400b
Reviewed-on: https://gerrit.libreoffice.org/24035
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-04-12 20:54:28 +00:00
Tor Lillqvist
d739811038 The OpenCL shared library is called libOpenCL.so.1 on Linux
libOpenCL.so is just the symbolic link to it, typically from
a development package. (On Fedora, from ocl-icd-devel.)

(Sure, libOpenCL.so.1 is also a symbolic link on Fedora, to
libOpenCL.so.1.0.0. But anyway, libOpenCL.so.1 is not from a
development package, but from ocl-icd.)

Change-Id: I18ca2e52e025001f709b1b57e12cd01d5b52d08e
2016-03-29 14:17:32 +03:00
Noel Grandin
2087484c65 use consistent #define checks for the Windows platform
stage 2 of replacing usage of various checks for the windows platform
with the compiler-defined '_WIN32' macro

In this stage we focus on replacing usage of the WIN macro

Change-Id: Ie8a4a63198a6de96bd158ecd707dadafb9c8ea84
Reviewed-on: https://gerrit.libreoffice.org/22393
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-17 11:33:57 +00:00
Noel Grandin
4fccc4376c loplugin:fpcomparison in opencl/
Change-Id: Ia5b4a5010afd72ce59629dbc9b2045177a155182
Reviewed-on: https://gerrit.libreoffice.org/21867
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-04 06:28:52 +00:00
Noel Grandin
db17d3c17c new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to
use std::unique_ptr

Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc
Reviewed-on: https://gerrit.libreoffice.org/19884
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-11 07:16:20 +00:00
Stephan Bergmann
671f69abf0 loplugin:nullptr (automatic rewrite; Mac-specific code)
Change-Id: I414c1e7fa1b13d23f15f82d883ab95cf11f09299
2015-11-10 16:20:37 +01:00
Stephan Bergmann
72d9441811 loplugin:nullptr (automatic rewrite)
Change-Id: I60189077f872dd5da3633b15b67b7b7729a75d0d
2015-11-10 10:31:32 +01:00
Stephan Bergmann
93fff4ba2f clang-analyzer-deadcode.DeadStores
Change-Id: I95404b553f594ced1e2e8b4b8ddf34c08180128f
2015-10-07 15:43:44 +02:00
Noel Grandin
58aea3f36c loplugin:unusedmethods
- improvements to the plugin to find more method calls
- improvements to python script to remove more false+
- fix the FORCE_COMPILE_ALL build flag to include code in
  the $WORKDIR

Change-Id: I4d6015dcb9b9d60c26f0bcee8abad807177a7836
Reviewed-on: https://gerrit.libreoffice.org/19064
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-01 10:43:24 +00:00
Noel Grandin
34180700b2 loplugin:removeunusedmethods, remove unused stuff
Change-Id: I35456b2a3ad2a84a1d045f09cdfb29e4c19b8350
2015-09-29 15:08:43 +02:00
Tor Lillqvist
11e1c55ce0 YAGNI
We use only one OpenCL device per context or program, so get rid of
half-implemented (or half-reverted?) "support" for multiple devices per
context.

Change-Id: I951f29e867e5b3f96f6e051567ee38d607bd7ecf
2015-09-16 17:51:20 +03:00
Tor Lillqvist
d6a5aac0f9 Split formula group for OpenCL up into smaller bits when necessary
Will make it less demanding on low-end hardware, where the device
driver is unresponsive for too long when an OpenCL kernel handling lots
of data is executing. This makes Windows restart the driver which is
problematic.

I tried several approaches of splitting, both at higher levels in sc
and at the lowest level just before creating and executing the OpenCL
kernel(s). This seems to be the most minimal and local approach. Doing
it at the lower level would have required too much poking into our
obscure OpenCL code, like passing an offset parameter to every kernel.

Use a simple heuristic to find out whether to split. On the
problematic low-end devices, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT is
4, while for more performant devices it is 1 or 8.
2015-09-15 18:43:33 +03:00