sc/qa/unit/data/xls/opencl/math/sumproductTest.xls |binary sc/qa/unit/opencl-test.cxx | 26 ++++++++++ sc/source/core/opencl/formulagroupcl.cxx | 52 ++++++++++++++++++--- 3 files changed, 72 insertions(+), 6 deletions(-)
New commits: commit 01a977486f0999950bf61b2c8592426e26cfe4f8 Author: I-Jui (Ray) Sung <r...@multicorewareinc.com> Date: Mon Nov 25 01:10:04 2013 -0600 GPU Calc: a test case for unrolling SumOfProduct AMLOEXT-245 BUG Change-Id: Ia8756af26c765820a04137a87f6681447dd18efd diff --git a/sc/qa/unit/data/xls/opencl/math/sumproductTest.xls b/sc/qa/unit/data/xls/opencl/math/sumproductTest.xls new file mode 100644 index 0000000..28eaebf Binary files /dev/null and b/sc/qa/unit/data/xls/opencl/math/sumproductTest.xls differ diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index faf2ddb..833d9c0 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -242,6 +242,7 @@ public: void testStatisticalFormulaCovar(); void testLogicalFormulaAnd(); void testMathFormulaSumProduct(); + void testMathFormulaSumProduct2(); void testStatisticalParallelCountBug(); CPPUNIT_TEST_SUITE(ScOpenclTest); CPPUNIT_TEST(testSharedFormulaXLS); @@ -416,6 +417,7 @@ public: CPPUNIT_TEST(testStatisticalFormulaCovar); CPPUNIT_TEST(testLogicalFormulaAnd); CPPUNIT_TEST(testMathFormulaSumProduct); + CPPUNIT_TEST(testMathFormulaSumProduct2); CPPUNIT_TEST(testStatisticalParallelCountBug); CPPUNIT_TEST_SUITE_END(); @@ -4792,6 +4794,30 @@ void ScOpenclTest::testMathFormulaSumProduct() xDocSh->DoClose(); xDocShRes->DoClose(); } +//[AMLOEXT-245] +void ScOpenclTest::testMathFormulaSumProduct2() +{ + if (!detectOpenCLDevice()) + return; + ScDocShellRef xDocSh = loadDoc("opencl/math/sumproductTest.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + enableOpenCL(); + pDoc->CalcAll(); + ScDocShellRef xDocShRes = loadDoc("opencl/math/sumproductTest.", XLS); + ScDocument* pDocRes = xDocShRes->GetDocument(); + CPPUNIT_ASSERT(pDocRes); + // Check the results of formula cells in the shared formula range. + for (SCROW i = 2; i <= 12; ++i) + { + double fLibre = pDoc->GetValue(ScAddress(4,i,1)); + double fExcel = pDocRes->GetValue(ScAddress(4,i,1)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel)); + } + xDocSh->DoClose(); + xDocShRes->DoClose(); +} + //[AMLOEXT-217] void ScOpenclTest:: testLogicalFormulaAnd() { commit 7e3d93e763770c7759555cfe7441573a97d276c1 Author: I-Jui (Ray) Sung <r...@multicorewareinc.com> Date: Mon Nov 25 01:13:44 2013 -0600 GPU Calc: fixed a SUMPRODUCT problem ALMOEXT-245 Change-Id: Iedbbdc612232a939b2270e373313c872de831c20 diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 3405459..bee159b 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1103,10 +1103,30 @@ public: ss << "for(int outLoop=0; outLoop<" << nCurWindowSize/outLoopSize<< "; outLoop++){\n\t"; for(int count=0; count < outLoopSize; count++){ - ss << "i = outLoop*"<<outLoopSize<<"+"<<count<<";\n\t"; + ss << "i = outLoop*"<<outLoopSize<<"+"<<count<<";\n"; if(count==0){ - temp3 << "currentCount0 = i+gid0+1;\n\t"; - temp3 << "currentCount1 = i+1;\n\t"; + for (unsigned i = 0; i < vSubArguments.size(); i++) + { + tmpCur = vSubArguments[i]->GetFormulaToken(); + if(ocPush==tmpCur->GetOpCode()) + { + pCurDVR= dynamic_cast< + const formula::DoubleVectorRefToken *>(tmpCur); + if(!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) + { + temp3 << " currentCount"; + temp3 << i; + temp3 <<" =i+gid0+1;\n"; + } + else + { + temp3 << " currentCount"; + temp3 << i; + temp3 << " =i+1;\n"; + } + } + } + temp3 << "tmp = fsum("; for (unsigned i = 0; i < vSubArguments.size(); i++){ if (i) @@ -1149,10 +1169,30 @@ public: for(unsigned int count=nCurWindowSize/outLoopSize*outLoopSize; count < nCurWindowSize; count++) { - ss << "i =" <<count<<";\n\t"; + ss << "i =" <<count<<";\n"; if(count==nCurWindowSize/outLoopSize*outLoopSize){ - temp4 << "currentCount0 = i+gid0+1;\n\t"; - temp4 << "currentCount1 = i+1;\n\t"; + for (unsigned i = 0; i < vSubArguments.size(); i++) + { + tmpCur = vSubArguments[i]->GetFormulaToken(); + if(ocPush==tmpCur->GetOpCode()) + { + pCurDVR= dynamic_cast< + const formula::DoubleVectorRefToken *>(tmpCur); + if(!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) + { + temp4 << " currentCount"; + temp4 << i; + temp4 <<" =i+gid0+1;\n"; + } + else + { + temp4 << " currentCount"; + temp4 << i; + temp4 << " =i+1;\n"; + } + } + } + temp4 << "tmp = fsum("; for (unsigned i = 0; i < vSubArguments.size(); i++) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits