sc/source/core/opencl/op_statistical.cxx | 6 +- sc/source/core/opencl/opbase.cxx | 73 ++++++++++++++++++++++++++++++- sc/source/core/opencl/opbase.hxx | 68 ++++++++++++---------------- 3 files changed, 103 insertions(+), 44 deletions(-)
New commits: commit 8c40b70fc944526a5dcbdf40f9509ce25abe88da Author: Kohei Yoshida <[email protected]> Date: Fri Oct 3 16:43:25 2014 -0400 Inlining make no sense for virtual functions. Change-Id: I6392eaceb0544b7faa9a0c726acf6619d971dbb7 diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index f19e36e..14ae124 100644 --- a/sc/source/core/opencl/opbase.cxx +++ b/sc/source/core/opencl/opbase.cxx @@ -88,17 +88,62 @@ DynamicKernelArgument::DynamicKernelArgument( const std::string& s, FormulaTreeNodeRef ft ) : mSymName(s), mFormulaTree(ft) { } +std::string DynamicKernelArgument::GenDoubleSlidingWindowDeclRef( bool ) const +{ + return std::string(""); +} + +/// When Mix, it will be called +std::string DynamicKernelArgument::GenStringSlidingWindowDeclRef( bool ) const +{ + return std::string(""); +} + +bool DynamicKernelArgument::IsMixedArgument() const +{ + return false; +} + /// Generate use/references to the argument void DynamicKernelArgument::GenDeclRef( std::stringstream& ss ) const { ss << mSymName; } +void DynamicKernelArgument::GenNumDeclRef( std::stringstream& ss ) const +{ + ss << ","; +} + +void DynamicKernelArgument::GenStringDeclRef( std::stringstream& ss ) const +{ + ss << ","; +} + +void DynamicKernelArgument::GenSlidingWindowFunction( std::stringstream& ) {} + FormulaToken* DynamicKernelArgument::GetFormulaToken() const { return mFormulaTree->GetFormulaToken(); } +std::string DynamicKernelArgument::DumpOpName() const +{ + return std::string(""); +} + +void DynamicKernelArgument::DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const {} + +const std::string& DynamicKernelArgument::GetName() const +{ + return mSymName; +} + +bool DynamicKernelArgument::NeedParallelReduction() const +{ + return false; +} + VectorRef::VectorRef( const std::string& s, FormulaTreeNodeRef ft, int idx ) : DynamicKernelArgument(s, ft), mpClmem(NULL), mnIndex(idx) { @@ -144,6 +189,8 @@ std::string VectorRef::GenSlidingWindowDeclRef( bool nested ) const return ss.str(); } +void VectorRef::GenSlidingWindowFunction( std::stringstream& ) {} + size_t VectorRef::GetWindowSize() const { FormulaToken* pCur = mFormulaTree->GetFormulaToken(); @@ -164,6 +211,28 @@ size_t VectorRef::GetWindowSize() const } } +std::string VectorRef::DumpOpName() const +{ + return std::string(""); +} + +void VectorRef::DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const {} + +const std::string& VectorRef::GetName() const +{ + return mSymName; +} + +cl_mem VectorRef::GetCLBuffer() const +{ + return mpClmem; +} + +bool VectorRef::NeedParallelReduction() const +{ + return false; +} + void Normal::GenSlidingWindowFunction( std::stringstream& ss, const std::string& sSymName, SubArguments& vSubArguments ) { diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index 15dedc5..d806140 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -87,6 +87,7 @@ class DynamicKernelArgument : boost::noncopyable { public: DynamicKernelArgument( const std::string& s, FormulaTreeNodeRef ft ); + virtual ~DynamicKernelArgument() {} /// Generate declaration virtual void GenDecl( std::stringstream& ss ) const = 0; @@ -97,36 +98,31 @@ public: /// When referenced in a sliding window function virtual std::string GenSlidingWindowDeclRef( bool = false ) const = 0; + /// Create buffer and pass the buffer to a given kernel + virtual size_t Marshal( cl_kernel, int, int, cl_program ) = 0; + + virtual size_t GetWindowSize() const = 0; + /// When Mix, it will be called - virtual std::string GenDoubleSlidingWindowDeclRef( bool = false ) const - { return std::string(""); } + virtual std::string GenDoubleSlidingWindowDeclRef( bool = false ) const; /// When Mix, it will be called - virtual std::string GenStringSlidingWindowDeclRef( bool = false ) const - { return std::string(""); } + virtual std::string GenStringSlidingWindowDeclRef( bool = false ) const; - virtual bool IsMixedArgument() const - { return false; } + virtual bool IsMixedArgument() const; /// Generate use/references to the argument virtual void GenDeclRef( std::stringstream& ss ) const; - virtual void GenNumDeclRef( std::stringstream& ss ) const { ss << ",";} + virtual void GenNumDeclRef( std::stringstream& ss ) const; - virtual void GenStringDeclRef( std::stringstream& ss ) const { ss << ",";} + virtual void GenStringDeclRef( std::stringstream& ss ) const; - /// Create buffer and pass the buffer to a given kernel - virtual size_t Marshal( cl_kernel, int, int, cl_program ) = 0; - - virtual ~DynamicKernelArgument() { } - - virtual void GenSlidingWindowFunction( std::stringstream& ) { } + virtual void GenSlidingWindowFunction( std::stringstream& ); formula::FormulaToken* GetFormulaToken() const; - virtual size_t GetWindowSize() const = 0; - virtual std::string DumpOpName() const { return std::string(""); } - virtual void DumpInlineFun( std::set<std::string>&, - std::set<std::string>& ) const { } - const std::string& GetName() const { return mSymName; } - virtual bool NeedParallelReduction() const { return false; } + virtual std::string DumpOpName() const; + virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const; + const std::string& GetName() const; + virtual bool NeedParallelReduction() const; protected: std::string mSymName; @@ -142,6 +138,7 @@ class VectorRef : public DynamicKernelArgument { public: VectorRef( const std::string& s, FormulaTreeNodeRef ft, int index = 0 ); + virtual ~VectorRef(); /// Generate declaration virtual void GenDecl( std::stringstream& ss ) const SAL_OVERRIDE; @@ -154,16 +151,13 @@ public: /// Create buffer and pass the buffer to a given kernel virtual size_t Marshal( cl_kernel, int, int, cl_program ) SAL_OVERRIDE; - virtual ~VectorRef(); - - virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE { } + virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE; virtual size_t GetWindowSize() const SAL_OVERRIDE; - virtual std::string DumpOpName() const SAL_OVERRIDE { return std::string(""); } - virtual void DumpInlineFun( std::set<std::string>&, - std::set<std::string>& ) const SAL_OVERRIDE { } - const std::string& GetName() const { return mSymName; } - virtual cl_mem GetCLBuffer() const { return mpClmem; } - virtual bool NeedParallelReduction() const SAL_OVERRIDE { return false; } + virtual std::string DumpOpName() const SAL_OVERRIDE; + virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const SAL_OVERRIDE; + const std::string& GetName() const; + virtual cl_mem GetCLBuffer() const; + virtual bool NeedParallelReduction() const SAL_OVERRIDE; protected: // Used by marshaling @@ -200,7 +194,7 @@ public: typedef std::vector<SubArgument> SubArguments; virtual void GenSlidingWindowFunction( std::stringstream&, const std::string&, SubArguments& ) = 0; - virtual ~SlidingFunctionBase() { }; + virtual ~SlidingFunctionBase() { } }; class Normal : public SlidingFunctionBase commit d2827e9246133077731e74e971714b4b995728e2 Author: Kohei Yoshida <[email protected]> Date: Fri Oct 3 16:28:54 2014 -0400 GetSymName() not used. Change-Id: Ia369bf99a5e381a6f1f9c3d8a2499aa1780f04b8 diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index ea89378..15dedc5 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -120,7 +120,6 @@ public: virtual ~DynamicKernelArgument() { } virtual void GenSlidingWindowFunction( std::stringstream& ) { } - const std::string& GetSymName() const { return mSymName; } formula::FormulaToken* GetFormulaToken() const; virtual size_t GetWindowSize() const = 0; virtual std::string DumpOpName() const { return std::string(""); } @@ -158,7 +157,6 @@ public: virtual ~VectorRef(); virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE { } - const std::string& GetSymName() const { return mSymName; } virtual size_t GetWindowSize() const SAL_OVERRIDE; virtual std::string DumpOpName() const SAL_OVERRIDE { return std::string(""); } virtual void DumpInlineFun( std::set<std::string>&, commit c363a8601d956b4ff1d3d733a8fb3282eed0aff9 Author: Kohei Yoshida <[email protected]> Date: Fri Oct 3 16:26:05 2014 -0400 GetNameAsString() identical to GetName(). Remove this and use GetName(). Change-Id: I26dce2dd11792ee118e78d23d652a5feb0789830 diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index d2ece0d..839b46c 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -5661,14 +5661,14 @@ void OpMedian::GenSlidingWindowFunction( ss << " int nSize =endFlag- startFlag ;\n"; ss << " if (nSize & 1)\n"; ss << " {\n"; - ss << " tmp = "<<vSubArguments[0]->GetNameAsString(); + ss << " tmp = "<<vSubArguments[0]->GetName(); ss << " [startFlag+nSize/2];\n"; ss << " }\n"; ss << " else\n"; ss << " {\n"; - ss << " tmp =("<<vSubArguments[0]->GetNameAsString(); + ss << " tmp =("<<vSubArguments[0]->GetName(); ss << " [startFlag+nSize/2]+"; - ss << vSubArguments[0]->GetNameAsString(); + ss << vSubArguments[0]->GetName(); ss << " [startFlag+nSize/2-1])/2;\n"; ss << " }\n"; ss <<" return tmp;\n"; diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index 497af94..ea89378 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -88,7 +88,6 @@ class DynamicKernelArgument : boost::noncopyable public: DynamicKernelArgument( const std::string& s, FormulaTreeNodeRef ft ); - const std::string& GetNameAsString() const { return mSymName; } /// Generate declaration virtual void GenDecl( std::stringstream& ss ) const = 0; @@ -145,7 +144,6 @@ class VectorRef : public DynamicKernelArgument public: VectorRef( const std::string& s, FormulaTreeNodeRef ft, int index = 0 ); - const std::string& GetNameAsString() const { return mSymName; } /// Generate declaration virtual void GenDecl( std::stringstream& ss ) const SAL_OVERRIDE; /// When declared as input to a sliding window function commit eb9e914d2ccd451e56badef2ce2a1755957e4adf Author: Kohei Yoshida <[email protected]> Date: Fri Oct 3 16:21:14 2014 -0400 ( void ) -> () Change-Id: I0d3d1d9ab5f7bc270c89a2a98d45ebea3cc37e02 diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index e1aef1f..f19e36e 100644 --- a/sc/source/core/opencl/opbase.cxx +++ b/sc/source/core/opencl/opbase.cxx @@ -94,7 +94,7 @@ void DynamicKernelArgument::GenDeclRef( std::stringstream& ss ) const ss << mSymName; } -FormulaToken* DynamicKernelArgument::GetFormulaToken( void ) const +FormulaToken* DynamicKernelArgument::GetFormulaToken() const { return mFormulaTree->GetFormulaToken(); } @@ -144,7 +144,7 @@ std::string VectorRef::GenSlidingWindowDeclRef( bool nested ) const return ss.str(); } -size_t VectorRef::GetWindowSize( void ) const +size_t VectorRef::GetWindowSize() const { FormulaToken* pCur = mFormulaTree->GetFormulaToken(); assert(pCur); diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index 125d24d..497af94 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -73,7 +73,7 @@ public: Children.reserve(8); } std::vector<FormulaTreeNodeRef> Children; - formula::FormulaToken* GetFormulaToken( void ) const + formula::FormulaToken* GetFormulaToken() const { return const_cast<formula::FormulaToken*>(mpCurrentFormula.get()); } @@ -88,7 +88,7 @@ class DynamicKernelArgument : boost::noncopyable public: DynamicKernelArgument( const std::string& s, FormulaTreeNodeRef ft ); - const std::string& GetNameAsString( void ) const { return mSymName; } + const std::string& GetNameAsString() const { return mSymName; } /// Generate declaration virtual void GenDecl( std::stringstream& ss ) const = 0; @@ -121,14 +121,14 @@ public: virtual ~DynamicKernelArgument() { } virtual void GenSlidingWindowFunction( std::stringstream& ) { } - const std::string& GetSymName( void ) const { return mSymName; } - formula::FormulaToken* GetFormulaToken( void ) const; - virtual size_t GetWindowSize( void ) const = 0; - virtual std::string DumpOpName( void ) const { return std::string(""); } + const std::string& GetSymName() const { return mSymName; } + formula::FormulaToken* GetFormulaToken() const; + virtual size_t GetWindowSize() const = 0; + virtual std::string DumpOpName() const { return std::string(""); } virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const { } - const std::string& GetName( void ) const { return mSymName; } - virtual bool NeedParallelReduction( void ) const { return false; } + const std::string& GetName() const { return mSymName; } + virtual bool NeedParallelReduction() const { return false; } protected: std::string mSymName; @@ -145,7 +145,7 @@ class VectorRef : public DynamicKernelArgument public: VectorRef( const std::string& s, FormulaTreeNodeRef ft, int index = 0 ); - const std::string& GetNameAsString( void ) const { return mSymName; } + const std::string& GetNameAsString() const { return mSymName; } /// Generate declaration virtual void GenDecl( std::stringstream& ss ) const SAL_OVERRIDE; /// When declared as input to a sliding window function @@ -160,14 +160,14 @@ public: virtual ~VectorRef(); virtual void GenSlidingWindowFunction( std::stringstream& ) SAL_OVERRIDE { } - const std::string& GetSymName( void ) const { return mSymName; } - virtual size_t GetWindowSize( void ) const SAL_OVERRIDE; - virtual std::string DumpOpName( void ) const SAL_OVERRIDE { return std::string(""); } + const std::string& GetSymName() const { return mSymName; } + virtual size_t GetWindowSize() const SAL_OVERRIDE; + virtual std::string DumpOpName() const SAL_OVERRIDE { return std::string(""); } virtual void DumpInlineFun( std::set<std::string>&, std::set<std::string>& ) const SAL_OVERRIDE { } - const std::string& GetName( void ) const { return mSymName; } - virtual cl_mem GetCLBuffer( void ) const { return mpClmem; } - virtual bool NeedParallelReduction( void ) const SAL_OVERRIDE { return false; } + const std::string& GetName() const { return mSymName; } + virtual cl_mem GetCLBuffer() const { return mpClmem; } + virtual bool NeedParallelReduction() const SAL_OVERRIDE { return false; } protected: // Used by marshaling @@ -182,11 +182,11 @@ class OpBase public: typedef std::vector<std::string> ArgVector; typedef std::vector<std::string>::iterator ArgVectorIter; - virtual std::string GetBottom( void ) { return "";}; + virtual std::string GetBottom() { return "";}; virtual std::string Gen2( const std::string&/*lhs*/, const std::string&/*rhs*/ ) const { return "";} virtual std::string Gen( ArgVector& /*argVector*/ ) { return "";}; - virtual std::string BinFuncName( void ) const { return "";}; + virtual std::string BinFuncName() const { return "";}; virtual void BinInlineFun( std::set<std::string>&, std::set<std::string>& ) { } virtual bool takeString() const = 0; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
