summaryrefslogtreecommitdiff
path: root/sc/source/core/opencl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2018-11-30 15:01:52 +0100
committerLuboš Luňák <l.lunak@collabora.com>2019-01-24 20:36:24 +0100
commit2675e4283a5eceb30d47e622775e7e8c4fc98f15 (patch)
tree3462f414ce57775fcb7d6ee038db2040231c7d73 /sc/source/core/opencl
parent89b9969d24c0272948004fffedf62725671670a6 (diff)
avoid incorrect OpenCL code with empty arguments
Change-Id: Ib7438cc2e9a020ce0cfcc649cd82667c64e0d3df Reviewed-on: https://gerrit.libreoffice.org/65479 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/source/core/opencl')
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx15
-rw-r--r--sc/source/core/opencl/opbase.hxx2
2 files changed, 15 insertions, 2 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 8a0d22529007..ab43f2f3092a 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2598,6 +2598,13 @@ public:
for (const auto & rSubArgument : mvSubArguments)
rSubArgument->DumpInlineFun(decls, funs);
}
+ virtual bool IsEmpty() const override
+ {
+ for (const auto & rSubArgument : mvSubArguments)
+ if( !rSubArgument->IsEmpty())
+ return false;
+ return true;
+ }
virtual ~DynamicKernelSoPArguments() override
{
if (mpClmem2)
@@ -3887,8 +3894,12 @@ void DynamicKernel::CodeGen()
mSyms.DumpSlidingWindowFunctions(decl);
mKernelSignature = DK->DumpOpName();
decl << "__kernel void DynamicKernel" << mKernelSignature;
- decl << "(__global double *result, ";
- DK->GenSlidingWindowDecl(decl);
+ decl << "(__global double *result";
+ if( !DK->IsEmpty())
+ {
+ decl << ", ";
+ DK->GenSlidingWindowDecl(decl);
+ }
decl << ") {\n\tint gid0 = get_global_id(0);\n\tresult[gid0] = " <<
DK->GenSlidingWindowDeclRef() << ";\n}\n";
mFullProgramSrc = decl.str();
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 112589a6a5f6..1e36e7c1a29f 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -140,6 +140,8 @@ public:
virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const;
const std::string& GetName() const;
virtual bool NeedParallelReduction() const;
+ /// If there's actually no argument, i.e. it expands to no code.
+ virtual bool IsEmpty() const { return false; }
protected:
const ScCalcConfig& mCalcConfig;