Kaydet (Commit) 2675e428 authored tarafından Luboš Luňák's avatar Luboš Luňák

avoid incorrect OpenCL code with empty arguments

Change-Id: Ib7438cc2e9a020ce0cfcc649cd82667c64e0d3df
Reviewed-on: https://gerrit.libreoffice.org/65479
Tested-by: Jenkins
Reviewed-by: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 89b9969d
...@@ -2598,6 +2598,13 @@ public: ...@@ -2598,6 +2598,13 @@ public:
for (const auto & rSubArgument : mvSubArguments) for (const auto & rSubArgument : mvSubArguments)
rSubArgument->DumpInlineFun(decls, funs); rSubArgument->DumpInlineFun(decls, funs);
} }
virtual bool IsEmpty() const override
{
for (const auto & rSubArgument : mvSubArguments)
if( !rSubArgument->IsEmpty())
return false;
return true;
}
virtual ~DynamicKernelSoPArguments() override virtual ~DynamicKernelSoPArguments() override
{ {
if (mpClmem2) if (mpClmem2)
...@@ -3887,8 +3894,12 @@ void DynamicKernel::CodeGen() ...@@ -3887,8 +3894,12 @@ void DynamicKernel::CodeGen()
mSyms.DumpSlidingWindowFunctions(decl); mSyms.DumpSlidingWindowFunctions(decl);
mKernelSignature = DK->DumpOpName(); mKernelSignature = DK->DumpOpName();
decl << "__kernel void DynamicKernel" << mKernelSignature; decl << "__kernel void DynamicKernel" << mKernelSignature;
decl << "(__global double *result, "; decl << "(__global double *result";
DK->GenSlidingWindowDecl(decl); if( !DK->IsEmpty())
{
decl << ", ";
DK->GenSlidingWindowDecl(decl);
}
decl << ") {\n\tint gid0 = get_global_id(0);\n\tresult[gid0] = " << decl << ") {\n\tint gid0 = get_global_id(0);\n\tresult[gid0] = " <<
DK->GenSlidingWindowDeclRef() << ";\n}\n"; DK->GenSlidingWindowDeclRef() << ";\n}\n";
mFullProgramSrc = decl.str(); mFullProgramSrc = decl.str();
......
...@@ -140,6 +140,8 @@ public: ...@@ -140,6 +140,8 @@ public:
virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const; virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const;
const std::string& GetName() const; const std::string& GetName() const;
virtual bool NeedParallelReduction() 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: protected:
const ScCalcConfig& mCalcConfig; const ScCalcConfig& mCalcConfig;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment