diff options
-rw-r--r-- | sc/source/core/opencl/opbase.cxx | 69 | ||||
-rw-r--r-- | sc/source/core/opencl/opbase.hxx | 54 |
2 files changed, 93 insertions, 30 deletions
diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index f19e36edc7a4..14ae1245179f 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 15dedc5f2317..d806140c45f4 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 |