tdf#149940 Fix vlookup result with OpenCL

This patch fixes the vlookup result in sorted order using OpenCl.
The issue was that the loop unrolling would cause the loop to exit early. This has been fixed to only happen in unsorted mode.

Change-Id: I7aba7b301c87061bc33128c8930ef3c55dc3c386
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162363
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
dholden
2024-01-23 08:57:47 +01:00
committed by Noel Grandin
parent e3d03fa00d
commit 91ba7d22b0
3 changed files with 30 additions and 1 deletions
Binary file not shown.
+27
View File
@@ -1844,6 +1844,33 @@ CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDevPA1)
}
}
CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testTdf149940_VLookup)
{
initTestEnv(u"ods/tdf149940.ods");
ScDocument* pDoc = getScDoc2();
ScDocument* pDocRes = getScDoc();
pDoc->CalcAll();
for (SCROW i = 4; i <= 12; ++i)
{
double fLibre = pDoc->GetValue(ScAddress(1,i,1));
double fExcel = pDocRes->GetValue(ScAddress(1,i,1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00001));
}
for (SCROW i = 4; i <= 12; ++i)
{
double fLibre = pDoc->GetValue(ScAddress(2,i,1));
double fExcel = pDocRes->GetValue(ScAddress(2,i,1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00001));
}
for (SCROW i = 4; i <= 12; ++i)
{
double fLibre = pDoc->GetValue(ScAddress(3,i,1));
double fExcel = pDocRes->GetValue(ScAddress(3,i,1));
CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.00001));
}
}
ScOpenCLTest2::ScOpenCLTest2()
: ScModelTestBase( "sc/qa/unit/data" )
{
+3 -1
View File
@@ -171,7 +171,9 @@ void OpVLookup::GenSlidingWindowFunction(outputstream &ss,
}
ss << " }\n";
ss << " if(rowNum!=-1)\n";
ss << " if(rowNum!=-1 && tmp";
ss << 3 + (secondParaWidth - 1);
ss << " == 0)\n";
ss << " {\n";
for (int j = 0; j < secondParaWidth; j++)
{