[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 24 19:36:54 UTC 2019


 sc/source/core/opencl/formulagroupcl.cxx |   15 +++++++++++++--
 sc/source/core/opencl/opbase.hxx         |    2 ++
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 2675e4283a5eceb30d47e622775e7e8c4fc98f15
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 30 15:01:52 2018 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu Jan 24 20:36:24 2019 +0100

    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 at collabora.com>

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;


More information about the Libreoffice-commits mailing list