sc/inc/document.hxx | 5 + sc/source/core/data/document.cxx | 9 +++ sc/source/core/opencl/formulagroupcl.cxx | 79 +++++++++++++++++++++++++------ sc/source/core/opencl/opbase.hxx | 10 +++ sc/source/core/opencl/opencl_device.cxx | 4 - sc/source/core/tool/formulagroup.cxx | 2 sc/source/ui/docshell/docsh.cxx | 1 sc/source/ui/docshell/docsh3.cxx | 1 sc/source/ui/inc/undobase.hxx | 2 sc/source/ui/undo/undobase.cxx | 24 +++++++++ sc/source/ui/undo/undoblk3.cxx | 2 sc/source/ui/view/gridwin4.cxx | 1 12 files changed, 122 insertions(+), 18 deletions(-)
New commits: commit b429051f862ac1e61322d2f62c5331da2040cded Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Thu Nov 28 00:24:55 2013 -0500 Clear the data cache here as well. Change-Id: Id26dcf8146dc7a41ea9995ad4b1f89925c08004f diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 6d5c840..3786fad 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -882,6 +882,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod // Flag drawn formula cells "unchanged". pDoc->ResetChanged(ScRange(nX1,nY1,nTab,nX2,nY2,nTab)); + pDoc->CellContentModified(); } void ScGridWindow::CheckNeedsRepaint() commit 572275a275220f56e7573f959c4bca953d03f5ec Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Thu Nov 28 00:08:51 2013 -0500 Clear column data cache here too. Change-Id: If3d9feb25d825806cb690d001872f1d0ff76466c diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 1251a2b..ad2806d 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -87,6 +87,7 @@ void ScDocShell::PostDataChanged() { Broadcast( SfxSimpleHint( FID_DATACHANGED ) ); SFX_APP()->Broadcast(SfxSimpleHint( FID_ANYDATACHANGED )); // Navigator + aDocument.CellContentModified(); //! Navigator direkt benachrichtigen! } commit 3eb61bee29733c220b9680b8783ec1aec9966dd1 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Nov 27 23:58:29 2013 -0500 Crasher fix. Check for NULL. Change-Id: Iae1fa695ea0266e97ae367db71fe6a82e6a3da1d diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 0fed853..3909bca 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -397,7 +397,7 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres fillMatrix(*pMat, nCol, pStrs, nRowSize); } } - else + else if (rArray.mpNumericArray) { // Numeric cells only. const double* pNums = rArray.mpNumericArray; commit b815a7b3d5395324d75a63cbc9c5f491e4316cc8 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Nov 27 23:29:39 2013 -0500 Clear the cache here too. Change-Id: I4dcc7244e508fcdf484b73dc843b21f4b0a18a73 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 432a373..8874cb8 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3583,6 +3583,8 @@ void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges ) if (!GetAutoCalc()) return; + mpFormulaGroupCxt.reset(); + for (size_t nPos=0, nRangeCount = rRanges.size(); nPos < nRangeCount; nPos++) { const ScRange& rRange = *rRanges[nPos]; @@ -3596,6 +3598,8 @@ void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges ) rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row()); } } + + mpFormulaGroupCxt.reset(); } commit 5f08a1e5e71352810d784111f3c978ca88586433 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Nov 27 22:16:53 2013 -0500 Not a good idea. This makes group calculation 5 times slower. Change-Id: I954606a9d6d9b0fc66f2f3496e204c8e6496db88 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index f7c6cdf..24cd615 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2835,13 +2835,6 @@ void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLe rCell.ResetDirty(); rCell.SetChanged(true); } - - std::vector<SCROW> aRows; - aRows.reserve(nLen); - for (size_t i = 0; i < nLen; ++i) - aRows.push_back(nRow+i); - - BroadcastCells(aRows, SC_HINT_DATACHANGED); } void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen ) @@ -2868,13 +2861,6 @@ void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pR rCell.ResetDirty(); rCell.SetChanged(true); } - - std::vector<SCROW> aRows; - aRows.reserve(nLen); - for (size_t i = 0; i < nLen; ++i) - aRows.push_back(nRow+i); - - BroadcastCells(aRows, SC_HINT_DATACHANGED); } void ScColumn::SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat ) commit e45fe15d09adbf5b22ccf366d6060d9291e90b5f Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Nov 27 21:40:12 2013 -0500 Don't forget to broadcast to chart objects. Change-Id: I6d4d7cd2dc426134c108f1fbcf6e3c32ed4af88d diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index c38ff47..178ec57 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -162,6 +162,8 @@ void ScSimpleUndo::BroadcastChanges( const ScRange& rRange ) } } } + + pDoc->BroadcastUno(SfxSimpleHint(SC_HINT_DATACHANGED)); } void ScSimpleUndo::ShowTable( SCTAB nTab ) commit fb2303a9e8ed0c18803356fc6af01f4aa3c43f33 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Nov 27 21:27:57 2013 -0500 Broadcast changes on undo / redo of cell range deletion. Change-Id: I48141ca77277c2de5b3526358cfadb12e3f4fbdd diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx index e57e308..5c9df4b 100644 --- a/sc/source/ui/inc/undobase.hxx +++ b/sc/source/ui/inc/undobase.hxx @@ -57,6 +57,8 @@ protected: void BeginRedo(); void EndRedo(); + void BroadcastChanges( const ScRange& rRange ); + static void ShowTable( SCTAB nTab ); static void ShowTable( const ScRange& rRange ); }; diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index 955d2ba..c38ff47 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -142,6 +142,28 @@ void ScSimpleUndo::EndRedo() pDocShell->SetInUndo( false ); } +void ScSimpleUndo::BroadcastChanges( const ScRange& rRange ) +{ + ScDocument* pDoc = pDocShell->GetDocument(); + pDoc->CellContentModified(); + + ScHint aHint(SC_HINT_DATACHANGED, ScAddress()); + ScAddress& rPos = aHint.GetAddress(); + for (SCTAB nTab = rRange.aStart.Tab(); nTab <= rRange.aEnd.Tab(); ++nTab) + { + rPos.SetTab(nTab); + for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol) + { + rPos.SetCol(nCol); + for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow) + { + rPos.SetRow(nRow); + pDoc->Broadcast(aHint); + } + } + } +} + void ScSimpleUndo::ShowTable( SCTAB nTab ) { ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index c3953c6..fe94d09 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -182,6 +182,7 @@ void ScUndoDeleteContents::Undo() DoChange( sal_True ); EndUndo(); + BroadcastChanges(aRange); HelperNotifyChanges::NotifyIfChangesListeners(*pDocShell, aRange); } @@ -191,6 +192,7 @@ void ScUndoDeleteContents::Redo() DoChange( false ); EndRedo(); + BroadcastChanges(aRange); HelperNotifyChanges::NotifyIfChangesListeners(*pDocShell, aRange); } commit 9ac0807e9e92ce6ec65e36396af16a6275c7fbd8 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Nov 27 20:47:25 2013 -0500 Change these parameters. Change-Id: Ic70aaea461e3d007e394c67c33a766d70aa4e92c diff --git a/sc/source/core/opencl/opencl_device.cxx b/sc/source/core/opencl/opencl_device.cxx index 8f9f8ff..a3fa004 100644 --- a/sc/source/core/opencl/opencl_device.cxx +++ b/sc/source/core/opencl/opencl_device.cxx @@ -25,8 +25,8 @@ #include "opencl_device.hxx" -#define INPUTSIZE 256*40 -#define OUTPUTSIZE 256*40 +#define INPUTSIZE 15360 +#define OUTPUTSIZE 15360 #define STRINGIFY(...) #__VA_ARGS__"\n" #define LOG_PRINTF(x) (std::cout << x << std::endl) commit a86a13dbb96dd24ca4775029454b1ff55cb2db6f Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Nov 27 19:43:08 2013 -0500 Clear column data array cache when the document content changes. Change-Id: I09ffa455e79199e37ca6168753ec9ef4d5aa33dc diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index b9e3dc3..85b7e99 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2017,6 +2017,11 @@ public: formula::VectorRefArray FetchVectorRefArray( const ScAddress& rPos, SCROW nLength ); + /** + * Called whenever the value of a cell inside the document is modified. + */ + void CellContentModified(); + SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ); const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const; void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength ); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 24cd615..f7c6cdf 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2835,6 +2835,13 @@ void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLe rCell.ResetDirty(); rCell.SetChanged(true); } + + std::vector<SCROW> aRows; + aRows.reserve(nLen); + for (size_t i = 0; i < nLen; ++i) + aRows.push_back(nRow+i); + + BroadcastCells(aRows, SC_HINT_DATACHANGED); } void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen ) @@ -2861,6 +2868,13 @@ void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pR rCell.ResetDirty(); rCell.SetChanged(true); } + + std::vector<SCROW> aRows; + aRows.reserve(nLen); + for (size_t i = 0; i < nLen; ++i) + aRows.push_back(nRow+i); + + BroadcastCells(aRows, SC_HINT_DATACHANGED); } void ScColumn::SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat ) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 708300e..432a373 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2313,6 +2313,11 @@ ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler() mpDoc->pFormatExchangeList = NULL; } +void ScDocument::CellContentModified() +{ + mpFormulaGroupCxt.reset(); +} + SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress& rPos ) { ScTable* pTab = FetchTable(rPos.Tab()); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 98b6be6..0760425 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -3047,6 +3047,7 @@ ScDocShellModificator::~ScDocShellModificator() void ScDocShellModificator::SetDocumentModified() { ScDocument* pDoc = rDocShell.GetDocument(); + pDoc->CellContentModified(); if ( !pDoc->IsImportingXML() ) { // AutoCalcShellDisabled temporaer restaurieren commit ac679d5fb037c2d718dfa765da8a41459e7791b5 Author: I-Jui (Ray) Sung <r...@multicorewareinc.com> Date: Wed Nov 27 18:40:49 2013 -0600 GPU Calc: fix typo in NAN macro Change-Id: I34299e0fc692c2ab43fe0c1fffaada348742d19f diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 699b193..4e48e04 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -36,7 +36,7 @@ namespace { static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff}; } -#define NAN (*(const float *) __nan) +#define NAN (*(const double*) __nan) #endif #endif commit f5d1829790a0e743c54279e9533f3a871d6420e1 Author: I-Jui (Ray) Sung <r...@multicorewareinc.com> Date: Wed Nov 27 18:36:47 2013 -0600 GPU Calc: fix compilation failure on Windows due to missing NAN macro Change-Id: I0d53dcf147a06f831120c5489b2975e42ea6120b diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index c02cef7..699b193 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -31,6 +31,14 @@ #define REDUCE_THRESHOLD 4 // set to 4 for correctness testing. priority 1 #define UNROLLING_FACTOR 16 // set to 4 for correctness testing (if no reduce) #include "formulagroupcl_public.hxx" +#ifdef WIN32 +#ifndef NAN +namespace { +static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff}; +} +#define NAN (*(const float *) __nan) +#endif +#endif #include <list> #include <map> commit 1ccf18590125d8fd8625a684cbb38e8849af43ea Author: I-Jui (Ray) Sung <r...@multicorewareinc.com> Date: Wed Nov 27 17:44:46 2013 -0600 GPU Calc: fix regression caused by recent isValid() change Change-Id: I885a222bf8a7ca4275867585ccf067a1ba7822c7 diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index c4290f4..c02cef7 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -72,8 +72,6 @@ size_t VectorRef::Marshal(cl_kernel k, int argno, int, cl_program) const formula::DoubleVectorRefToken* pDVR = dynamic_cast< const formula::DoubleVectorRefToken* >(ref); assert(pDVR); - if (pDVR->GetArrays()[mnIndex].mpNumericArray == NULL) - throw Unhandled(); pHostBuffer = const_cast<double*>( pDVR->GetArrays()[mnIndex].mpNumericArray); szHostBuffer = pDVR->GetArrayLength() * sizeof(double); @@ -84,12 +82,35 @@ size_t VectorRef::Marshal(cl_kernel k, int argno, int, cl_program) KernelEnv kEnv; OpenclDevice::setKernelEnv(&kEnv); cl_int err; - mpClmem = clCreateBuffer(kEnv.mpkContext, - (cl_mem_flags) CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR, - szHostBuffer, - pHostBuffer, &err); - if (CL_SUCCESS != err) - throw OpenCLError(err); + if (pHostBuffer) + { + mpClmem = clCreateBuffer(kEnv.mpkContext, + (cl_mem_flags) CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR, + szHostBuffer, + pHostBuffer, &err); + if (CL_SUCCESS != err) + throw OpenCLError(err); + } + else + { + if (szHostBuffer == 0) + szHostBuffer = sizeof(double); // a dummy small value + // Marshal as a buffer of NANs + mpClmem = clCreateBuffer(kEnv.mpkContext, + (cl_mem_flags) CL_MEM_READ_ONLY|CL_MEM_ALLOC_HOST_PTR, + szHostBuffer, NULL, &err); + if (CL_SUCCESS != err) + throw OpenCLError(err); + double *pNanBuffer = (double*)clEnqueueMapBuffer( + kEnv.mpkCmdQueue, mpClmem, CL_TRUE, CL_MAP_WRITE, 0, + szHostBuffer, 0, NULL, NULL, &err); + if (CL_SUCCESS != err) + throw OpenCLError(err); + for (size_t i = 0; i < szHostBuffer/sizeof(double); i++) + pNanBuffer[i] = NAN; + err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem, + pNanBuffer, 0, NULL, NULL); + } err = clSetKernelArg(k, argno, sizeof(cl_mem), (void*)&mpClmem); if (CL_SUCCESS != err) @@ -1414,9 +1435,9 @@ public: KernelEnv kEnv; OpenclDevice::setKernelEnv(&kEnv); cl_int err; + DynamicKernelArgument *Arg = mvSubArguments[0].get(); DynamicKernelSlidingArgument<VectorRef> *slidingArgPtr = - dynamic_cast< DynamicKernelSlidingArgument<VectorRef> *> - (mvSubArguments[0].get()); + dynamic_cast< DynamicKernelSlidingArgument<VectorRef> *> (Arg); cl_mem mpClmem2; if (OpSumCodeGen->NeedReductionKernel()) @@ -1590,6 +1611,8 @@ DynamicKernelArgument *VectorRefFactory(const std::string &s, //Black lists ineligible classes here .. // SUMIFS does not perform parallel reduction at DoubleVectorRef level if (dynamic_cast<OpSumIfs*>(pCodeGen.get())) { + if (index == 0) // the first argument of OpSumIfs cannot be strings anyway + return new DynamicKernelSlidingArgument<VectorRef>(s, ft, pCodeGen, index); return new DynamicKernelSlidingArgument<Base>(s, ft, pCodeGen, index); } // AVERAGE is not supported yet @@ -1650,7 +1673,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( assert(pDVR); for (size_t j = 0; j < pDVR->GetArrays().size(); ++j) { - if (pDVR->GetArrays()[j].mpNumericArray) + if (pDVR->GetArrays()[j].mpNumericArray || + (pDVR->GetArrays()[j].mpNumericArray == NULL && + pDVR->GetArrays()[j].mpStringArray == NULL )) mvSubArguments.push_back( SubArgument(VectorRefFactory<VectorRef>( ts, ft->Children[i], mpCodeGen, j))); @@ -1687,9 +1712,17 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( SubArgument(new DynamicKernelStringArgument( ts, ft->Children[i]))); } + else if (pSVR->GetArray().mpStringArray == NULL && + pSVR->GetArray().mpNumericArray == NULL) + { + // Push as an array of NANs + mvSubArguments.push_back( + SubArgument(new VectorRef(ts, + ft->Children[i]))); + } else throw UnhandledToken(pChild, - "Got unhandled case here"); + "Got unhandled case here", __FILE__, __LINE__); } else if (pChild->GetType() == formula::svDouble) { mvSubArguments.push_back( SubArgument(new DynamicKernelConstantArgument(ts, @@ -2736,7 +2769,8 @@ DynamicKernel* DynamicKernel::create(ScDocument& /* rDoc */, } catch (const UnhandledToken &ut) { std::cerr << "\nDynamic formual compiler: unhandled token: "; - std::cerr << ut.mMessage << "\n"; + std::cerr << ut.mMessage << " at "; + std::cerr << ut.mFile << ":" << ut.mLineNumber << "\n"; #ifdef NO_FALLBACK_TO_SWINTERP assert(false); #else @@ -2840,6 +2874,17 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, return false; #endif } + catch (const Unhandled &uh) { + std::cerr << "Dynamic formula compiler: unhandled case:"; + std::cerr <<" at "; + std::cerr << uh.mFile << ":" << uh.mLineNumber << "\n"; +#ifdef NO_FALLBACK_TO_SWINTERP + assert(false); + return true; +#else + return false; +#endif + } catch (...) { std::cerr << "Dynamic formula compiler: unhandled compiler error\n"; #ifdef NO_FALLBACK_TO_SWINTERP diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index 135ec4d..22a9316 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -30,9 +30,12 @@ class UnhandledToken { public: UnhandledToken(formula::FormulaToken *t, - const char *const m): mToken(t), mMessage(m) {} + const char *const m, std::string fn="", int ln=0): + mToken(t), mMessage(m), mFile(fn), mLineNumber(ln) {} formula::FormulaToken *mToken; std::string mMessage; + std::string mFile; + int mLineNumber; }; /// Failed in marshaling @@ -47,7 +50,10 @@ public: class Unhandled { public: - Unhandled() {} + Unhandled(std::string fn="", int ln=0): + mFile(fn), mLineNumber(ln) {} + std::string mFile; + int mLineNumber; }; typedef boost::shared_ptr<FormulaTreeNode> FormulaTreeNodeRef; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits