diff options
author | Tor Lillqvist <tml@collabora.com> | 2015-09-08 14:35:37 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2015-09-17 06:04:27 +0000 |
commit | f2b93f2e314215d6342e0bd5727e6740cc15e29c (patch) | |
tree | 3a539267a45b5bfedc9587a180033eea71d80ede | |
parent | 9008c5365581733f3d54ee30ade5e418cd6e694b (diff) |
ENABLE_THREADED_OPENCL_KERNEL_COMPILATION has been zero for a long time
And I doubt we will try to turn it on again, so remove dead code.
Change-Id: Iaa8908fdb5a197ef0d1da5eaf08ae08df2a86ee7
Reviewed-on: https://gerrit.libreoffice.org/18404
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r-- | sc/Library_sc.mk | 1 | ||||
-rw-r--r-- | sc/inc/clkernelthread.hxx | 52 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 64 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 28 | ||||
-rw-r--r-- | sc/source/core/tool/clkernelthread.cxx | 69 | ||||
-rw-r--r-- | unusedcode.easy | 4 |
7 files changed, 0 insertions, 229 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 3fa8c746f180..52d17d153472 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -214,7 +214,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/core/tool/chartpos \ sc/source/core/tool/chgtrack \ sc/source/core/tool/chgviset \ - sc/source/core/tool/clkernelthread \ sc/source/core/tool/compare \ sc/source/core/tool/compiler \ sc/source/core/tool/consoli \ diff --git a/sc/inc/clkernelthread.hxx b/sc/inc/clkernelthread.hxx deleted file mode 100644 index d4d83ed5d688..000000000000 --- a/sc/inc/clkernelthread.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_SC_INC_CLKERNELTHREAD_HXX -#define INCLUDED_SC_INC_CLKERNELTHREAD_HXX - -#include <queue> - -#include <osl/conditn.hxx> -#include <salhelper/thread.hxx> - -#include <boost/noncopyable.hpp> - -#include "scdllapi.h" -#include "formulacell.hxx" - -namespace sc { - -struct CLBuildKernelWorkItem -{ - enum { COMPILE, FINISH } meWhatToDo; - ScFormulaCellGroupRef mxGroup; -}; - -class SC_DLLPUBLIC CLBuildKernelThread : public salhelper::Thread, boost::noncopyable -{ -public: - CLBuildKernelThread(); - virtual ~CLBuildKernelThread(); - - osl::Condition maCompilationDoneCondition; - -protected: - virtual void execute() SAL_OVERRIDE; - -private: - osl::Mutex maQueueMutex; - osl::Condition maQueueCondition; - std::queue<CLBuildKernelWorkItem> maQueue; -}; - -} - -#endif // INCLUDED_SC_INC_CLKERNELTHREAD_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 957902957681..3deb9e30583d 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -34,11 +34,8 @@ #include "formularesult.hxx" -#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0 - namespace sc { -class CLBuildKernelThread; class CompiledFormula; class StartListeningContext; class EndListeningContext; @@ -78,9 +75,6 @@ public: ScFormulaCellGroup(); ~ScFormulaCellGroup(); -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION - void scheduleCompilation(); -#endif void setCode( const ScTokenArray& rCode ); void setCode( ScTokenArray* pCode ); @@ -92,11 +86,6 @@ public: ScFormulaCell** ppTopCell, const ScRange& rRange, bool bStartFixed, bool bEndFixed ); void endAllGroupListening( ScDocument& rDoc ); - -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION - static int snCount; - static rtl::Reference<sc::CLBuildKernelThread> sxCompilationThread; -#endif }; inline void intrusive_ptr_add_ref(const ScFormulaCellGroup *p) diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 14d3d44ba89d..07d19a394387 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -44,7 +44,6 @@ #include "editutil.hxx" #include "chgtrack.hxx" #include "tokenarray.hxx" -#include "clkernelthread.hxx" #include <formula/errorcodes.hxx> #include <formula/vectortoken.hxx> @@ -535,28 +534,6 @@ typedef boost::ptr_map<AreaListenerKey, sc::FormulaGroupAreaListener> AreaListen } -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION -// The mutex to synchronize access to the OpenCL compilation thread. -static osl::Mutex& getOpenCLCompilationThreadMutex() -{ - static osl::Mutex* pMutex = NULL; - if( !pMutex ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pMutex ) - { - static osl::Mutex aMutex; - pMutex = &aMutex; - } - } - - return *pMutex; -} - -int ScFormulaCellGroup::snCount = 0; -rtl::Reference<sc::CLBuildKernelThread> ScFormulaCellGroup::sxCompilationThread; -#endif - struct ScFormulaCellGroup::Impl { AreaListenersType maAreaListeners; @@ -576,53 +553,16 @@ ScFormulaCellGroup::ScFormulaCellGroup() : meKernelState(sc::OpenCLKernelNone) { SAL_INFO( "sc.core.formulacell", "ScFormulaCellGroup ctor this " << this); -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION - if (officecfg::Office::Common::Misc::UseOpenCL::get()) - { - osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex()); - if (snCount++ == 0) - { - assert(!sxCompilationThread.is()); - sxCompilationThread.set(new sc::CLBuildKernelThread); - sxCompilationThread->launch(); - } - } -#endif } ScFormulaCellGroup::~ScFormulaCellGroup() { SAL_INFO( "sc.core.formulacell", "ScFormulaCellGroup dtor this " << this); -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION - if (officecfg::Office::Common::Misc::UseOpenCL::get()) - { - osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex()); - if (--snCount == 0 && sxCompilationThread.is()) - { - assert(sxCompilationThread.is()); - sxCompilationThread->finish(); - sxCompilationThread->join(); - SAL_INFO("sc.opencl", "OpenCL kernel compilation thread has finished"); - sxCompilationThread.clear(); - } - } -#endif delete mpCode; delete mpCompiledFormula; delete mpImpl; } -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION -void ScFormulaCellGroup::scheduleCompilation() -{ - meKernelState = sc::OpenCLKernelCompilationScheduled; - sc::CLBuildKernelWorkItem aWorkItem; - aWorkItem.meWhatToDo = sc::CLBuildKernelWorkItem::COMPILE; - aWorkItem.mxGroup = this; - sxCompilationThread->push(aWorkItem); -} -#endif - void ScFormulaCellGroup::setCode( const ScTokenArray& rCode ) { delete mpCode; @@ -3755,10 +3695,6 @@ ScFormulaCellGroupRef ScFormulaCell::CreateCellGroup( SCROW nLen, bool bInvarian mxGroup->mbInvariant = bInvariant; mxGroup->mnLength = nLen; mxGroup->mpCode = pCode; // Move this to the shared location. -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION - if (mxGroup->sxCompilationThread.is()) - mxGroup->scheduleCompilation(); -#endif return mxGroup; } diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 340f3915a649..b72c3177d0ec 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -9,7 +9,6 @@ #include "formulagroup.hxx" #include "formulagroupcl.hxx" -#include "clkernelthread.hxx" #include "grouptokenconverter.hxx" #include "document.hxx" #include "formulacell.hxx" @@ -4181,13 +4180,6 @@ public: mpKernel = pKernel; } -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION - void setUnmanagedKernel( DynamicKernel* pKernel ) - { - mpKernel = pKernel; - } -#endif - CLInterpreterResult launchKernel() { if (!isValid()) @@ -4229,27 +4221,7 @@ CLInterpreterContext createCLInterpreterContext( const ScCalcConfig& rConfig, { CLInterpreterContext aCxt(xGroup->mnLength); -#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION - if (rGroup.meKernelState == sc::OpenCLKernelCompilationScheduled || - rGroup.meKernelState == sc::OpenCLKernelBinaryCreated) - { - if (rGroup.meKernelState == sc::OpenCLKernelCompilationScheduled) - { - ScFormulaCellGroup::sxCompilationThread->maCompilationDoneCondition.wait(); - ScFormulaCellGroup::sxCompilationThread->maCompilationDoneCondition.reset(); - } - - // Kernel instance is managed by the formula group. - aCxt.setUnmanagedKernel(static_cast<DynamicKernel*>(xGroup->mpCompiledFormula)); - } - else - { - assert(xGroup->meCalcState == sc::GroupCalcRunning); - aCxt.setManagedKernel(static_cast<DynamicKernel*>(DynamicKernel::create(rConfig, rCode, xGroup->mnLength))); - } -#else aCxt.setManagedKernel(static_cast<DynamicKernel*>(DynamicKernel::create(rConfig, rCode, xGroup->mnLength))); -#endif return aCxt; } diff --git a/sc/source/core/tool/clkernelthread.cxx b/sc/source/core/tool/clkernelthread.cxx deleted file mode 100644 index 52a483051a4c..000000000000 --- a/sc/source/core/tool/clkernelthread.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <sal/log.hxx> - -#include "formulagroup.hxx" -#include "grouptokenconverter.hxx" - -#include "clkernelthread.hxx" - -using namespace std; - -namespace sc { - -CLBuildKernelThread::CLBuildKernelThread() : - salhelper::Thread("opencl-build-kernel-thread") -{ -} - -CLBuildKernelThread::~CLBuildKernelThread() -{ -} - -void CLBuildKernelThread::execute() -{ - SAL_INFO("sc.opencl.thread", "running"); - - bool done = false; - while (!done) - { - SAL_INFO("sc.opencl.thread", "waiting for condition"); - maQueueCondition.wait(); - SAL_INFO("sc.opencl.thread", "got condition"); - osl::ResettableMutexGuard aGuard(maQueueMutex); - maQueueCondition.reset(); - while (!maQueue.empty()) - { - CLBuildKernelWorkItem aWorkItem = maQueue.front(); - maQueue.pop(); - aGuard.clear(); - - switch (aWorkItem.meWhatToDo) - { - case CLBuildKernelWorkItem::COMPILE: - SAL_INFO("sc.opencl.thread", "told to compile group " << aWorkItem.mxGroup << " (state " << aWorkItem.mxGroup->meCalcState << ") to binary"); - aWorkItem.mxGroup->compileOpenCLKernel(); - SAL_INFO("sc.opencl.thread", "group " << aWorkItem.mxGroup << " compilation done"); - maCompilationDoneCondition.set(); - break; - case CLBuildKernelWorkItem::FINISH: - SAL_INFO("sc.opencl.thread", "told to finish"); - done = true; - break; - } - - aGuard.reset(); - } - } -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unusedcode.easy b/unusedcode.easy index acf29d41cc01..bf723ce1658c 100644 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -84,10 +84,6 @@ oglcanvas::CanvasHelper::drawPoint(com::sun::star::rendering::XCanvas const*, co oglcanvas::TextLayout::draw(com::sun::star::rendering::ViewState const&, com::sun::star::rendering::RenderState const&, com::sun::star::uno::Reference<com::sun::star::rendering::XGraphicDevice> const&) const oox::drawingml::TextListStyle::dump() const oox::xls::DefinedName::getTokens() -sc::CLBuildKernelThread::CLBuildKernelThread() -sc::CLBuildKernelThread::consume() -sc::CLBuildKernelThread::finish() -sc::CLBuildKernelThread::produce() sc::CellValues::transferTo(ScColumn&, int) sc::ColumnSpanSet::swap(sc::ColumnSpanSet&) sc::FormulaGroupAreaListener::getGroupLength() const |