[Libreoffice-commits] core.git: Branch 'feature/calc-pluggable-opencl' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Sep 17 17:53:11 PDT 2013
sc/source/core/opencl/openclwrapper.cxx | 1 -
sc/source/filter/excel/excform.cxx | 14 +++++++++++---
sc/source/filter/excel/impop.cxx | 5 +++--
sc/source/filter/inc/imp_op.hxx | 6 ++++--
4 files changed, 18 insertions(+), 8 deletions(-)
New commits:
commit bc90f1c6fb5a8c4868e0f12212a373c754c9010c
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Sep 17 20:53:24 2013 -0400
Add a heuristic to avoid always pre-compile OpenCL kernels (for xls).
If we still have 3 MB worth of stream to parse after the first formula
record, we pre-compile OpenCL kernels in a separate thread.
Change-Id: I129d95c26f26e4b1eb989bc2a1764a3f87f71fcb
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 2b2f8f7..78d3bef 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -2770,7 +2770,6 @@ void compileKernels(const OUString* pDeviceId)
if (nStatus != CL_SUCCESS)
r.mpKernel = NULL;
}
-
}
}}
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 49ca6ca..b557de5 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -136,11 +136,19 @@ void ImportExcel::Formula(
}
}
- if (!mxCLKernelThread.is())
+ if (mbRunCLKernelThread && !mxCLKernelThread.is())
{
- mxCLKernelThread.set(new sc::CLBuildKernelThread);
- mxCLKernelThread->launch();
+ double fRemainSize = maStrm.GetSvStreamSize() - maStrm.GetSvStreamPos();
+ fRemainSize /= 1048576; // Switch to MB.
+ if (fRemainSize > 3.0)
+ {
+ // We still have more than 3MB of stream to parse. Start a thread to pre-compile OpenCL kernels.
+ mxCLKernelThread.set(new sc::CLBuildKernelThread);
+ mxCLKernelThread->launch();
+ }
+ mbRunCLKernelThread = false;
}
+
ConvErr eErr = pFormConv->Convert( pResult, maStrm, nFormLen, true, FT_CellFormula);
ScFormulaCell* pCell = NULL;
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index e03980b..16c4ac5 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -116,8 +116,9 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ):
maScOleSize( ScAddress::INITIALIZE_INVALID ),
mnLastRefIdx( 0 ),
mnIxfeIndex( 0 ),
- mbBiff2HasXfs( false ),
- mbBiff2HasXfsValid( false )
+ mbBiff2HasXfs(false),
+ mbBiff2HasXfsValid(false),
+ mbRunCLKernelThread(true)
{
nBdshtTab = 0;
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index 613ae30..6e44f31 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -106,8 +106,6 @@ protected:
sal_Int16 mnLastRefIdx;
sal_uInt16 mnIxfeIndex; /// Current XF identifier from IXFE record.
- bool mbBiff2HasXfs; /// Select XF formatting or direct formatting in BIFF2.
- bool mbBiff2HasXfsValid; /// False = mbBiff2HasXfs is undetermined yet.
SCTAB nBdshtTab; // Counter fuer Boundsheet
ScFormulaCell* pLastFormCell; // fuer String-Records
@@ -115,6 +113,10 @@ protected:
sal_Bool bTabTruncated; // wenn Bereichsueberschreitung zum
// Abschneiden von Zellen fuehrt
+ bool mbBiff2HasXfs:1; /// Select XF formatting or direct formatting in BIFF2.
+ bool mbBiff2HasXfsValid:1; /// False = mbBiff2HasXfs is undetermined yet.
+ bool mbRunCLKernelThread:1;
+
// Record-Funktionen
void ReadFileSharing();
More information about the Libreoffice-commits
mailing list