Kaydet (Commit) f2b93f2e authored tarafından Tor Lillqvist's avatar Tor Lillqvist

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/18404Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
Tested-by: 's avatarTor Lillqvist <tml@collabora.com>
üst 9008c536
......@@ -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 \
......
/* -*- 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: */
......@@ -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)
......
......@@ -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;
}
......
......@@ -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;
}
......
/* -*- 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: */
......@@ -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
......
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