Commit Graph
37 Commits
Author SHA1 Message Date
Noel Grandin 1743d74e87 clang-tidy modernize-pass-by-value in various
Change-Id: Ie091b22bd77d4e1fbff46545bc86c12f1dbafcfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138171
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-13 19:11:49 +02:00
Michael Meeks 4140154fe7 opencl: no need for unhelpful nullptr OUString * case.
Change-Id: I0b3cad2247706901e1a6b9c3df7fbbc9f23ff987
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136816
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2022-07-06 10:29:45 +02:00
Philipp Hofer 01baeab998 tdf#123936 Formatting files in module include with clang-format
Change-Id: I0507dd797cd5a35e0ae14f4b69ee4e172d08a71a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105681
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Jenkins
2020-11-21 13:19:17 +01:00
Thorsten Behrens abb6c01519 replace usage of whitelist with allowlist
Background and motivation:
  https://tools.ietf.org/html/draft-knodel-terminology-02

[API CHANGE] officecfg::Office::Common::Misc::OpenCLWhiteList -> OpenCLAllowList

Change-Id: I65636b19b13e4af1e4851f70e78053f3443d6bb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98181
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-10 01:36:07 +02:00
Thorsten Behrens 493ae7a6bb replace usage of blacklist with denylist
.. and a few cases of instead doing blacklist->excludelist where that
made more sense.

Background and motivation:
  https://tools.ietf.org/html/draft-knodel-terminology-02

[API CHANGE] officecfg::Office::Canvas::DeviceBlacklist -> DeviceDenylist
[API CHANGE] officecfg::Office::Canvas::BlacklistCurrentDevice -> DenylistCurrentDevice
[API CHANGE] officecfg::Office::Common::Misc::OpenCLBlackList -> OpenCLDenyList

Change-Id: Ia35e25496bf0cc0692d5de4cb66bfc232d3a869e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98180
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-10 01:34:54 +02:00
Luboš Luňák 397ad713cf merge OpenGLZone and OpenCLZone into one generic code
To be used also by Skia code to detect problems with Vulkan drivers.
The watchdog does not handle OpenCL because neither did the original
code, but also because OpenCLZone::hardDisable() called from it
would deadlock on SolarMutex for some reason.

Change-Id: I483d8cb0b11a4e1e65c564f4e4c29ab68843ff71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88008
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-02-07 09:11:32 +01:00
Noel Grandin 781c4402f1 make some classes module-private
improve the script, but it still generates some false positives

Change-Id: If8ee1cba8c04ac0be11f73220149e6de15f24f44
Reviewed-on: https://gerrit.libreoffice.org/81929
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-03 17:12:00 +01:00
Stephan Bergmann 6bdbe7f5af Silence false cid#1454000 "Side effect in assertion"
The side effect is intentional here.

Change-Id: I05d166bb312ea3a97905607c5effccf1e8d8eef7
Reviewed-on: https://gerrit.libreoffice.org/79668
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-27 11:36:12 +02:00
Stephan Bergmann 33d922ea07 -Werror=volatile in OpenCLZone
Recent GCC 10 trunk in C++20 mode reports issues like

> include/opencl/OpenCLZone.hxx:27:9: error: ‘++’ expression of ‘volatile’-qualified type is deprecated [-Werror=volatile]
>    27 |         gnEnterCount++;
>       |         ^~~~~~~~~~~~

But unlike in the case of ec17c8ec52
"-Werror=volatile in OpenGLZone",

* it looks like there are no multi-threading issues here, and the counters are
  just accessed (via OpenCLZone::isInZone) from the VCLExceptionSignal_impl
  signal handler in addition to being modified (via OpenCLZone RAII objects)
  from mainline code; and

* from the usage pattern of gnEnterCount and gnLeaveCount it appears that they
  can be combined into a single counter.
  (f41eb66302 "opencl: OpenCLZone, detect CL
  device change and disable CL on crash" presumably modelled OpenCLZone naively
  after OpenGLZone, without simplifying it where possible.)  One minor advantage
  of having two monotonically increasing counters is that when they overflow,
  the implementation of isInZone (comparing them for equality) still gives
  ~useful results (assuming that a false "match" of non-overflown gnEnterCount
  against overflown gnLeaveCount is highly unlikely).  But instances of
  OpenCLZone RAII objects are presumably never nested very deeply (if at all),
  so that the newly added "TODO: overflow" comment (which would even cause UB if
  std::sig_atomic_t is signed) is probably of no practical concern.

Change-Id: I92e1f2c46ca996a0a86bacabcda2accba5eb6298
Reviewed-on: https://gerrit.libreoffice.org/79106
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-18 20:28:29 +02:00
Luboš Luňák 101eea01c7 test in a separate helper process if OpenCL crashes (tdf#112252)
Some OpenCL implementations may be broken, e.g. pocl simply
asserts and aborts if it can't find Clang. In order to protect
against crashes caused by faulty OpenCL drivers, when testing OpenCL
functionality on OpenCL setup change, first do a simple test
in a separate helper.

Change-Id: I1cf328e731c48f47745b27c7130e7521254209f5
Reviewed-on: https://gerrit.libreoffice.org/71080
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-04-29 10:40:12 +02:00
Gabor Kelemen dc35f25926 tdf#42949 Fix IWYU warnings in include/opencl/*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I76f15a8e7724384e8ba773621bdcac1351b32a0a
Reviewed-on: https://gerrit.libreoffice.org/62086
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-24 13:29:40 +02:00
Tor Lillqvist aa7dc5fa1d 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
2017-08-25 15:49:34 +03: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 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
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
Tor Lillqvist b9898f03eb The enter() and leave() functions are not used anywhere
Change-Id: I42d2d6a12d49fc60c625dc2d230f70d05cf67673
2016-08-12 15:58:38 +03: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
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
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
Jochen Nitschke 4c7ec9f112 cleanup: remove unused com/sun/star/uno includes
Sequence.h(xx), Any.h(xx) and Type.h(xx)
and remove unused using-declarations from these files.

Add a few missing includes provided by them.

Change-Id: I6b91b6d1fdf9d0496dd546c0aab9bdcc6831a5d4
Reviewed-on: https://gerrit.libreoffice.org/23805
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-12 06:38:26 +00:00
Tor Lillqvist c59b417f1a No need for <config_features.h> here
Change-Id: Ieccd31d3cefd2fc397a296827de29d834ce093f0
2015-12-15 19:55:46 +02:00
Noel Grandin 60795a7fd1 loplugin:unusedfields in include/oox/
Change-Id: Ie7a53f3ecc05d1d4f6f71aa8165315f9155c60dc
2015-11-24 14:20:26 +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
Caolán McNamara 22b80ac8e2 boost->std
Change-Id: I3fd9e1599c5ad812879a58cf1dabbcd393105e1c
Reviewed-on: https://gerrit.libreoffice.org/18564
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-09-14 12:54:25 +00:00
Tor Lillqvist 43617f1448 Move OpenCLError::strerror() from sc to opencl, and rename to errorString()
There is nothing Calc-specific in this function, and surely it will be good to
output OpenCL errors symbolically also in the opencl module.

Change-Id: Ibe7d0d036f24dd87e06b8290224e1033dda0f3d1
2015-02-06 09:35:10 +02:00
Tor Lillqvist 119d9c33b0 The horrible CHECK_OPENCL() fortunately is used only in openclwrapper.cxx
So move it there. While at it, make it use SAL_WARN() instead of
printf.

Also, add a few more SAL_WARN() and SAL_INFO().

Change-Id: Ib058fb20d07757331ca364a8d7649abc59e9494b
2015-02-05 15:01:16 +02:00
Kohei Yoshida e12fcd050a Set up foundation for supporting multiple OpenCL command queues per device.
Change-Id: Ia63c8bd6552cdbc2b5eabadaa044b9f1eca5f664
2015-01-07 16:39:38 -05:00
Tor Lillqvist bf6544c0ab Don't treat clew as part of an "external" clcc module
There is no obvious authoritative upstream for clew anyway, so it causes
philosophical problems for distros. For a while, we used to use a zip archive
from the "clcc" project on SourceForge that included clew.c and
clew.h. (Before that we also just had clew.c and clew.h in our source repo.)

So, drop the external/clcc module and have clew.c and clew.h in the source
repo again. But this time clew is in a module of its own, not in sc.

This re-introduces "No need to have OpenCL optional at configure-time"

This reverts commit 764836cb00.

Change-Id: I413142f4f9f8399489f9c3e5327132822f07a454
Reviewed-on: https://gerrit.libreoffice.org/13368
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2014-12-08 09:07:27 +00:00
Tor Lillqvist 81e3c00d41 The compiler-generated dtor is good enough, no need for this
Change-Id: Ib72e0df4ac3ca90d440a32359e711d77e758cca0
2014-11-28 09:28:14 +02:00
Tor Lillqvist abeef65da7 Put the KernelEnv struct inside the opencl namespace, too
Change-Id: I33d51b0e30445c34c792210e7c656c1d48159019
2014-11-27 19:12:21 +02:00
Tor Lillqvist 52f9606ed0 The OpenCLEnv struct is used only inside openclwrapper.cxx
Change-Id: I95fbee302213e6ced469dd7a2a1c254178159357
2014-11-27 19:12:21 +02:00
Tor Lillqvist 598f25c857 Clean up confusing OpenCL code a bit
Get rid of the silly OpenCLDevice class that had only static members. We can
as well just use namespacing. Remove functions only used internally in
openclwrapper.cxx from the now public openclwrapper.hxx header.

Change-Id: If7336edd262c772564dc13e64113d72d0b52428c
2014-11-27 19:12:21 +02:00
Tor Lillqvist a70b717ef8 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
2014-11-27 15:32:58 +02:00
Tor Lillqvist 280fd15426 Try to fix MSVC build
Change-Id: I24c48d2540a8cb7d2a823862d53cddf90d41f94a
2014-11-27 11:44:20 +02:00
Tor Lillqvist c1d09b1ad0 Work in progress: Move Calc-independend OpenCL configuration out of sc
Intermediate commit. More changes will follow: The device selection
logic needs to be moved, too. (And cleaned up.) Instead of the
separate formulacalculationoptions dialog we should simply have a
normal options page for those OpenCL-related settings that will remain
purely Calc-specific, like the formula opcode subsetting.

Change-Id: Id60d95e80d377cbbf5780beb473b221bce06b5e5
2014-11-27 11:07:37 +02:00