Re: Cross compiling LibreOffice - x86_64 to aarch64

2019-09-06 Thread Ray Vine

On 02/09/19 10:09, Michael Stahl wrote:

On 30.08.19 21:51, Ray Vine wrote:

[CMP] animations/source/animcore/animcore
/w5/build-area/LO-6304/solenv/gbuild/ComponentTarget.mk:50:
*** No LIBFILENAME set at component target:
/w5/build-area/LO-6304/workdir_for_build/ComponentTarget/animations/source/animcore/animcore.component.
  Stop.
make[1]: *** Waiting for unfinished jobs
make: *** [Makefile:295: cross-toolset] Error 2


looks like some library requires "animcore" but the module that contains 
Library_animcore.mk i.e. "animations" is missing in RepositoryModule_build.mk.



Thanks, that set me on the path to a successful build.

Added animations to RepositoryModule_build.mk but then got another error:

| /w5/build-area/LO-6304/solenv/gbuild/LinkTarget.mk:687: *** used LinkTarget 
Library/libopencllo.so not defined.

and decided to try using a sledgehammer to fix it - replaced the modules list 
in RepositoryModule_build.mk with the list from RepositoryModule_host.mk and 
the BUILD system build then completed.

Presuming the purpose of the BUILD system build is to create binaries needed 
for the HOST compilation, this probably creates more than needed, but at least 
gives me a base build that works.
TODO: revisit this to add only the modules required.

Apart then from some issues related to my installation, the HOST build 
continued until getting to coinmp.
What a pita!

'configure' for each sub-directory uses $HOST-pkg-config to generate build data 
[--modversion, --cflags, etc], one use of which is to determine whether the 
source is available:

| checking for COIN-OR package CoinUtils... not given: No package 'coinutils' 
found
| configure: error: Required package CoinUtils not available.
| configure: error: /bin/sh './configure' failed for Osi

It also sets up a PKG_CONFIG_PATH which includes the local path to .pc files in 
the source and that is overwritten by the entry in the wrapper script:

aarch64-linux-gnu-pkg-config fails:
PKG_CONFIG_PATH=/w5/build-area/LO-6304/workdir/UnpackedTarball/coinmp/CoinUtils 
aarch64-linux-gnu-pkg-config --modversion "coinutils"
| Package coinutils was not found in the pkg-config search path.
| Perhaps you should add the directory containing `coinutils.pc`
| to the PKG_CONFIG_PATH environment variable
| No package 'coinutils' found

pkg-config succeeds:
PKG_CONFIG_PATH=/w5/build-area/LO-6304/workdir/UnpackedTarball/coinmp/CoinUtils 
pkg-config --modversion "coinutils"
| 2.9.11

And derived from '--cflags coinutils', the includes path is wrong:
| Making all in Osi
| Making all in src/Osi
| mkdir .libs
|  aarch64-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. 
-I/sysroot/w5/build-area/LO-6304/workdir/UnpackedTarball/coinmp/CoinUtils/src
 -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall 
-Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long 
-DOSI_BUILD -MT OsiAuxInfo.lo -MD -MP -MF .deps/OsiAuxInfo.Tpo -c OsiAuxInfo.cpp  
-fPIC -DPIC -o .libs/OsiAuxInfo.o
| OsiAuxInfo.cpp:10:10: fatal error: CoinPragma.hpp: No such file or directory
|10 | #include "CoinPragma.hpp"
|   |  ^~~~

CoinPragma.hpp is in
/w5/build-area/LO-6304/workdir/UnpackedTarball/coinmp/CoinUtils/src
not
/sysroot/w5/build-area/LO-6304/workdir/UnpackedTarball/coinmp/CoinUtils/src


The eventual work-around I came up with was to modify the wrapper script to 
bypass the PKG_CONFIG_* variables only for the coinmp configure scripts, i.e. 
if PKG_CONFIG_PATH contains CoinUtils:

[[ ! $PKG_CONFIG_PATH == *CoinUtils* ]] && {
PKG_CONFIG_PATH=
PKG_CONFIG_SYSROOT_DIR=/sysroot
PKG_CONFIG_LIBDIR=/sysroot/usr/lib64/pkgconfig
}
exec pkg-config "$@"


That did the trick - the build completed, and so far LO 6.3.0.4 is running OK.


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

Cross compiling LibreOffice - x86_64 to aarch64

2019-08-31 Thread Ray Vine
 
I would like to cross compile LibreOffice for
aarch64 to run on my RPi3.

I've built it natively on x86_64 and am using the
same configure options for the cross compilation,
but getting errors almost immediately when it
starts with the BUILD system build.

As far as I can tell, I'm effectively doing what's
in README.cross|Raspbian.
Building on Slackware with my own cross compiler.

The set up is:

export CONFIGURE_OPTS="
--prefix=/
--disable-postgresql-sdbc
--without-java
--without-junit
--disable-odk
--without-krb5
--without-gssapi
--disable-gtk3
--disable-gtk
--disable-gstreamer-0-10
--disable-gstreamer-1-0
--disable-epm
--enable-release-build
--with-parallelism=6
--with-locales=en-GB
--with-lang=en-GB
--with-help
--with-external-tar=/w5/external_tarballs-6304
--with-system-libatomic_ops
--with-system-nss
--with-system-libpng
--with-theme=colibre"


For a native x86_64 build:
-
./autogen.sh $CONFIGURE_OPTS
make build-nocheck

.. builds successfully


For cross-compiling:
---
export HOST=aarch64-linux-gnu
export SYSROOT=/sysroot
export CC=$HOST-gcc
export CXX=$HOST-g++
mount -B
 $SYSROOT
export LIBDIRSUFFIX=64
export PATH=/bin:$PATH
For HOST configuration:
export PYTHON_CFLAGS=-I$SYSROOT/usr/include/python2.7
export PYTHON_LIBS=-lpython2.7


Set up a pkg-config wrapper script for HOST and
name it $HOST-pkg-config because that's what
configure looks for:

echo $"PKG_CONFIG_PATH='' \\
PKG_CONFIG_SYSROOT_DIR=$SYSROOT \\
PKG_CONFIG_LIBDIR=$SYSROOT/usr/lib$LIBDIRSUFFIX/pkgconfig
\\
exec pkg-config \"\$@\"" >
/bin/$HOST-pkg-config


./autogen.sh $CONFIGURE_OPTS --host=$HOST
--with-build-platform-configure-options="$CONFIGURE_OPTS
--without-help --without-system-dicts"

completes OK and everything looks OK

'make build-nocheck' or 'make' produces two errors
almost immediately:

[1]
make gb_Side=build -j 6 -rs -f
/w5/build-area/LO-6304/Makefile fetch
make gb_Side=build -j 6 -rs -f
/w5/build-area/LO-6304/Makefile.gbuild build-tools
/w5/build-area/LO-6304/RepositoryModule_build.mk:12:
*** Module does not exist:
/w5/build-area/LO-6304/mysqlc/Module_mysqlc.mk.  Stop.
make: *** [Makefile:299: cross-toolset] Error 2

That's correct as far as I can see - there is no
mysqlc module, so:
sed -i '/mysqlc/d ' RepositoryModule_build.mk
takes me to the next error:

[2]
[CMP] animations/source/animcore/animcore
/w5/build-area/LO-6304/solenv/gbuild/ComponentTarget.mk:50:
*** No LIBFILENAME set at component target:
/w5/build-area/LO-6304/workdir_for_build/ComponentTarget/animations/source/animcore/animcore.component.
 Stop.
make[1]: *** Waiting for unfinished jobs
make: *** [Makefile:295: cross-toolset] Error 2

The directory ComponentTarget doesn't exist at
this stage.

This occurs after a minute or so for the cross
compile, whereas it completes for a native x86_64
build, but after about 5 hours into an 8+ hour build.

Running with --with-parallelism=1 takes a lot
longer but eventually gets to the same error.
ComponentTarget does then exist, but doesn't
contain animations:

ls
/w5/build-area/LO-6304/workdir_for_build/ComponentTarget
binaryurp/  comphelper/  io/  remotebridges/  sax/
 stoc/

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - libreofficekit/source

2016-01-12 Thread Debarshi Ray
 libreofficekit/source/gtk/lokdocview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9f6cb113a9a6a55de34bf2fab6da757275ead6ea
Author: Debarshi Ray 
Date:   Fri Jan 8 18:06:18 2016 +0100

lokdocview: Fix WARNING when creating an error

A GError needs a valid GQuark as the domain. Passing 0 leads to:
  GLib-WARNING **: (gerror.c:408):g_error_new_valist: runtime check
failed: (domain != 0)

Change-Id: I2f252eaa83a1519b5d16c7ba22c8f593732807ca
Reviewed-on: https://gerrit.libreoffice.org/21261
Tested-by: Jenkins 
Reviewed-by: Pranav Kant 
Reviewed-by: jan iversen 
(cherry picked from commit 3ba1b60c97b342c13593d37ccf2b97a919808dfc)
Reviewed-on: https://gerrit.libreoffice.org/21384
Reviewed-by: David Tardon 
Tested-by: David Tardon 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index fc58dd4..21232df 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1681,7 +1681,7 @@ openDocumentInThread (gpointer data)
 if ( !priv->m_pDocument )
 {
 char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
-g_task_return_new_error(task, 0, 0, "%s", pError);
+g_task_return_new_error(task, g_quark_from_static_string ("LOK 
error"), 0, "%s", pError);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: libreofficekit/source

2016-01-11 Thread Debarshi Ray
 libreofficekit/source/gtk/lokdocview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3ba1b60c97b342c13593d37ccf2b97a919808dfc
Author: Debarshi Ray 
Date:   Fri Jan 8 18:06:18 2016 +0100

lokdocview: Fix WARNING when creating an error

A GError needs a valid GQuark as the domain. Passing 0 leads to:
  GLib-WARNING **: (gerror.c:408):g_error_new_valist: runtime check
failed: (domain != 0)

Change-Id: I2f252eaa83a1519b5d16c7ba22c8f593732807ca
Reviewed-on: https://gerrit.libreoffice.org/21261
Tested-by: Jenkins 
Reviewed-by: Pranav Kant 
Reviewed-by: jan iversen 

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 87b6ca0..140479b 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1684,7 +1684,7 @@ openDocumentInThread (gpointer data)
 if ( !priv->m_pDocument )
 {
 char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
-g_task_return_new_error(task, 0, 0, "%s", pError);
+g_task_return_new_error(task, g_quark_from_static_string ("LOK 
error"), 0, "%s", pError);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-12-30 Thread Ray
 sc/source/core/opencl/op_math.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit b281014a584c266c396d5e6bbfc150e5e7584761
Author: I-Jui (Ray) Sung 
Date:   Mon Dec 30 16:34:29 2013 -0600

GPU Calc: fix compiler warning

Change-Id: Iaadf726cbece3d077667175f3f60bf2345179202

diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 7db5462..3422b3b 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -1344,7 +1344,6 @@ void OpSqrt::GenSlidingWindowFunction(std::stringstream 
&ss,
 }
 else if(tmpCur->GetType() == formula::svDouble)
 {
-printf("const\n");
 ss << "arg0=";
 ss << tmpCur->GetDouble() << ";\n";
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/qa

2013-12-21 Thread Ray
 sc/qa/unit/opencl-test.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 836abd393d126cfbba6b0bd1fdda5b03095516c9
Author: I-Jui (Ray) Sung 
Date:   Sat Dec 21 23:29:43 2013 -0600

GPU Calc: temporarily disable Kombin unit test

Change-Id: I08d615e6b53781b5dd9e992204093bdd4901f852

diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 3a12674..2be46ca 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -435,7 +435,8 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaBinomDist);
 CPPUNIT_TEST(testStatisticalFormulaVarP);
 CPPUNIT_TEST(testMathFormulaCeil);
-CPPUNIT_TEST(testMathFormulaKombin);
+// This test fails MacOS 10.8. Disabled temporarily
+// CPPUNIT_TEST(testMathFormulaKombin);
 CPPUNIT_TEST(testStatisticalFormulaDevSq);
 CPPUNIT_TEST(testStatisticalFormulaStDev);
 CPPUNIT_TEST(testStatisticalFormulaSlope);
@@ -4713,6 +4714,7 @@ void ScOpenclTest::testMathFormulaProduct()
 xDocShRes->DoClose();
 }
 //[AMLOEXT-194]
+#if 0 //Disabled temporarily
 void ScOpenclTest::testMathFormulaKombin()
 {
 if (!detectOpenCLDevice())
@@ -4735,6 +4737,7 @@ void ScOpenclTest::testMathFormulaKombin()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+#endif
 //[AMLOEXT-198]
 void ScOpenclTest:: testArrayFormulaSumX2MY2()
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-12-21 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   94 +++
 sc/source/core/opencl/opbase.cxx |2 
 sc/source/core/opencl/opbase.hxx |5 +
 3 files changed, 53 insertions(+), 48 deletions(-)

New commits:
commit 12b0a95b9777a46efc885811f5c7e7182855a834
Author: I-Jui (Ray) Sung 
Date:   Fri Dec 20 23:41:34 2013 -0600

GPU Calc: log line number on OpenCL exceptions

Change-Id: I58900762efd71cf1b9501a18d7c1c8d460547d64

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 2f38bb0..c5159f0 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -100,7 +100,7 @@ size_t VectorRef::Marshal(cl_kernel k, int argno, int, 
cl_program)
 szHostBuffer,
 pHostBuffer, &err);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 }
 else
 {
@@ -111,12 +111,12 @@ size_t VectorRef::Marshal(cl_kernel k, int argno, int, 
cl_program)
 (cl_mem_flags) CL_MEM_READ_ONLY|CL_MEM_ALLOC_HOST_PTR,
 szHostBuffer, NULL, &err);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 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);
+throw OpenCLError(err, __FILE__, __LINE__);
 for (size_t i = 0; i < szHostBuffer/sizeof(double); i++)
 pNanBuffer[i] = NAN;
 err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem,
@@ -125,7 +125,7 @@ size_t VectorRef::Marshal(cl_kernel k, int argno, int, 
cl_program)
 
 err = clSetKernelArg(k, argno, sizeof(cl_mem), (void*)&mpClmem);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 return 1;
 }
 
@@ -184,7 +184,7 @@ public:
 // Pass the scalar result back to the rest of the formula kernel
 cl_int err = clSetKernelArg(k, argno, sizeof(cl_uint), 
(void*)&hashCode);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 return 1;
 }
 };
@@ -233,7 +233,7 @@ public:
 // Pass the scalar result back to the rest of the formula kernel
 cl_int err = clSetKernelArg(k, argno, sizeof(double), (void*)&tmp);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 return 1;
 }
 virtual cl_mem GetCLBuffer(void) const { return NULL; }
@@ -273,7 +273,7 @@ public:
 // Pass the scalar result back to the rest of the formula kernel
 cl_int err = clSetKernelArg(k, argno, sizeof(double), (void*)&tmp);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 return 1;
 }
 };
@@ -315,7 +315,7 @@ public:
 // Pass the scalar result back to the rest of the formula kernel
 cl_int err = clSetKernelArg(k, argno, sizeof(double), (void*)&tmp);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 return 1;
 }
 };
@@ -370,12 +370,12 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int, cl_prog
 (cl_mem_flags) CL_MEM_READ_ONLY|CL_MEM_ALLOC_HOST_PTR,
 szHostBuffer, NULL, &err);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 cl_uint *pHashBuffer = (cl_uint*)clEnqueueMapBuffer(
 kEnv.mpkCmdQueue, mpClmem, CL_TRUE, CL_MAP_WRITE, 0,
 szHostBuffer, 0, NULL, NULL, &err);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 for (size_t i = 0; i < nStrings; i++)
 {
 if (vRef.mpStringArray[i])
@@ -391,11 +391,11 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int, cl_prog
 err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem,
 pHashBuffer, 0, NULL, NULL);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 
 err = clSetKernelArg(k, argno, sizeof(cl_mem), (void*)&mpClmem);
 if (CL_SUCCESS != err)
-throw OpenCLError(err);
+throw OpenCLError(err, __FILE__, __LINE__);
 return 1;
 }
 
@@ -879,32 +879,32 @@ public:
 mpClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_WRITE_ONLY,
 sizeof(double)*w, NULL, NULL);
 if (CL_SUCCESS != err)
-throw OpenCLError(

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-12-09 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0f8c2106579a43da8f5c888ecdc9928d10f3086c
Author: I-Jui (Ray) Sung 
Date:   Mon Dec 9 22:03:20 2013 -0600

GPU Calc: fix compiler warnings regarding to member init order

Change-Id: Ie0223b0c4224323b4211cf207468ea0dc1205fbb

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 618fcc9..0804dcb 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1624,9 +1624,9 @@ public:
 }
 }
 private:
-cl_mem mpClmem2;
 SubArgumentsType mvSubArguments;
 boost::shared_ptr mpCodeGen;
+cl_mem mpClmem2;
 };
 
 boost::shared_ptr SoPHelper(
@@ -1684,7 +1684,7 @@ DynamicKernelArgument *VectorRefFactory(const std::string 
&s,
 
 DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 const std::string &s, const FormulaTreeNodeRef& ft, SlidingFunctionBase* 
pCodeGen) :
-DynamicKernelArgument(s, ft), mpCodeGen(pCodeGen),mpClmem2(NULL)
+DynamicKernelArgument(s, ft), mpCodeGen(pCodeGen), mpClmem2(NULL)
 {
 size_t nChildren = ft->Children.size();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-12-09 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4cb23d2016042b0738b0be1ec5b4dfe4e2b80b5a
Author: I-Jui (Ray) Sung 
Date:   Mon Dec 9 22:03:20 2013 -0600

GPU Calc: fix compiler warnings regarding to member init order

Change-Id: Ie0223b0c4224323b4211cf207468ea0dc1205fbb

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index ee1b655..1c79f36 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1625,9 +1625,9 @@ public:
 }
 }
 private:
-cl_mem mpClmem2;
 SubArgumentsType mvSubArguments;
 boost::shared_ptr mpCodeGen;
+cl_mem mpClmem2;
 };
 
 boost::shared_ptr SoPHelper(
@@ -1685,7 +1685,7 @@ DynamicKernelArgument *VectorRefFactory(const std::string 
&s,
 
 DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 const std::string &s, const FormulaTreeNodeRef& ft, SlidingFunctionBase* 
pCodeGen) :
-DynamicKernelArgument(s, ft), mpCodeGen(pCodeGen),mpClmem2(NULL)
+DynamicKernelArgument(s, ft), mpCodeGen(pCodeGen), mpClmem2(NULL)
 {
 size_t nChildren = ft->Children.size();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/tags/libreoffice-4-2-milestone-3'

2013-12-05 Thread Ray
Tag 'libreoffice-4-2-milestone-3' created by Michael Meeks 
 at 2013-12-05 10:43 -0800

milestone three

Changes since libreoffice-4-2-milestone-2-71:
---
 0 files changed
---
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-12-02 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   56 +++
 1 file changed, 36 insertions(+), 20 deletions(-)

New commits:
commit 2dcee42f4e8e8ca8821e37b5ec9d24aeb4b736c1
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 29 01:53:48 2013 -0600

GPU Calc: cache the very last compiled program in memory

Change-Id: Ib805c31f0c1b57708c38c02a9bdc492af5c7a439

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index b43817b..140bfd5 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2652,9 +2652,7 @@ DynamicKernel::~DynamicKernel()
 if (mpKernel) {
 clReleaseKernel(mpKernel);
 }
-if (mpProgram) {
-clReleaseProgram(mpProgram);
-}
+// mpProgram is not going to be released here -- it's cached.
 if (mpCode)
 delete mpCode;
 }
@@ -2668,23 +2666,41 @@ void DynamicKernel::CreateKernel(void)
 KernelEnv kEnv;
 OpenclDevice::setKernelEnv(&kEnv);
 const char *src = mFullProgramSrc.c_str();
-if (OpenclDevice::buildProgramFromBinary("",
-&OpenclDevice::gpuEnv,
-(mKernelSignature+GetMD5()).c_str(), 0)) {
-mpProgram = OpenclDevice::gpuEnv.mpArryPrograms[0];
-OpenclDevice::gpuEnv.mpArryPrograms[0] = NULL;
-} else {
-mpProgram = clCreateProgramWithSource(kEnv.mpkContext, 1,
-&src, NULL, &err);
-if (err != CL_SUCCESS)
-throw OpenCLError(err);
-err = clBuildProgram(mpProgram, 1,
-OpenclDevice::gpuEnv.mpArryDevsID, "", NULL, NULL);
-if (err != CL_SUCCESS)
-throw OpenCLError(err);
-// Generate binary out of compiled kernel.
-OpenclDevice::generatBinFromKernelSource(mpProgram,
-(mKernelSignature+GetMD5()).c_str());
+static std::string lastKernelHash = "";
+static cl_program lastProgram = NULL;
+std::string KernelHash = mKernelSignature+GetMD5();
+if (lastKernelHash == KernelHash && lastProgram)
+{
+std::cerr<<"cl_program cache hit: "<< KernelHash << "\n";
+mpProgram = lastProgram;
+}
+else
+{   // doesn't match the last compiled formula.
+
+if (lastProgram) {
+std::cerr<<"Freeing last program: "<< GetMD5() << "\n";
+clReleaseProgram(lastProgram);
+lastProgram = NULL;
+}
+if (OpenclDevice::buildProgramFromBinary("",
+&OpenclDevice::gpuEnv, KernelHash.c_str(), 0)) {
+mpProgram = OpenclDevice::gpuEnv.mpArryPrograms[0];
+OpenclDevice::gpuEnv.mpArryPrograms[0] = NULL;
+} else {
+mpProgram = clCreateProgramWithSource(kEnv.mpkContext, 1,
+&src, NULL, &err);
+if (err != CL_SUCCESS)
+throw OpenCLError(err);
+err = clBuildProgram(mpProgram, 1,
+OpenclDevice::gpuEnv.mpArryDevsID, "", NULL, NULL);
+if (err != CL_SUCCESS)
+throw OpenCLError(err);
+// Generate binary out of compiled kernel.
+OpenclDevice::generatBinFromKernelSource(mpProgram,
+(mKernelSignature+GetMD5()).c_str());
+}
+lastKernelHash = KernelHash;
+lastProgram = mpProgram;
 }
 mpKernel = clCreateKernel(mpProgram, kname.c_str(), &err);
 if (err != CL_SUCCESS)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-12-02 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   57 +++
 1 file changed, 36 insertions(+), 21 deletions(-)

New commits:
commit 01ee34e66d94548720487e915186b342a9557f41
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 29 01:53:48 2013 -0600

GPU Calc: cache the very last compiled program in memory

Change-Id: Ib805c31f0c1b57708c38c02a9bdc492af5c7a439

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index cc4fc04..36981a7 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2654,10 +2654,7 @@ DynamicKernel::~DynamicKernel()
 std::cerr<<"Freeing kernel "<< GetMD5() << " kernel\n";
 clReleaseKernel(mpKernel);
 }
-if (mpProgram) {
-std::cerr<<"Freeing kernel "<< GetMD5() << " program\n";
-clReleaseProgram(mpProgram);
-}
+// mpProgram is not going to be released here -- it's cached.
 if (mpCode)
 delete mpCode;
 }
@@ -2671,23 +2668,41 @@ void DynamicKernel::CreateKernel(void)
 KernelEnv kEnv;
 OpenclDevice::setKernelEnv(&kEnv);
 const char *src = mFullProgramSrc.c_str();
-if (OpenclDevice::buildProgramFromBinary("",
-&OpenclDevice::gpuEnv,
-(mKernelSignature+GetMD5()).c_str(), 0)) {
-mpProgram = OpenclDevice::gpuEnv.mpArryPrograms[0];
-OpenclDevice::gpuEnv.mpArryPrograms[0] = NULL;
-} else {
-mpProgram = clCreateProgramWithSource(kEnv.mpkContext, 1,
-&src, NULL, &err);
-if (err != CL_SUCCESS)
-throw OpenCLError(err);
-err = clBuildProgram(mpProgram, 1,
-OpenclDevice::gpuEnv.mpArryDevsID, "", NULL, NULL);
-if (err != CL_SUCCESS)
-throw OpenCLError(err);
-// Generate binary out of compiled kernel.
-OpenclDevice::generatBinFromKernelSource(mpProgram,
-(mKernelSignature+GetMD5()).c_str());
+static std::string lastKernelHash = "";
+static cl_program lastProgram = NULL;
+std::string KernelHash = mKernelSignature+GetMD5();
+if (lastKernelHash == KernelHash && lastProgram)
+{
+std::cerr<<"cl_program cache hit: "<< KernelHash << "\n";
+mpProgram = lastProgram;
+}
+else
+{   // doesn't match the last compiled formula.
+
+if (lastProgram) {
+std::cerr<<"Freeing last program: "<< GetMD5() << "\n";
+clReleaseProgram(lastProgram);
+lastProgram = NULL;
+}
+if (OpenclDevice::buildProgramFromBinary("",
+&OpenclDevice::gpuEnv, KernelHash.c_str(), 0)) {
+mpProgram = OpenclDevice::gpuEnv.mpArryPrograms[0];
+OpenclDevice::gpuEnv.mpArryPrograms[0] = NULL;
+} else {
+mpProgram = clCreateProgramWithSource(kEnv.mpkContext, 1,
+&src, NULL, &err);
+if (err != CL_SUCCESS)
+throw OpenCLError(err);
+err = clBuildProgram(mpProgram, 1,
+OpenclDevice::gpuEnv.mpArryDevsID, "", NULL, NULL);
+if (err != CL_SUCCESS)
+throw OpenCLError(err);
+// Generate binary out of compiled kernel.
+OpenclDevice::generatBinFromKernelSource(mpProgram,
+(mKernelSignature+GetMD5()).c_str());
+}
+lastKernelHash = KernelHash;
+lastProgram = mpProgram;
 }
 mpKernel = clCreateKernel(mpProgram, kname.c_str(), &err);
 if (err != CL_SUCCESS)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-29 Thread Ray
 sc/source/core/opencl/opencl_device.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit bf777a24956e8c62d969c2361a200e90eec651c8
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 29 02:22:54 2013 -0600

GPU Calc: fix warnings

Change-Id: I5b98eecc55dbb89fa0f4127f437e0e8cc798eb86

diff --git a/sc/source/core/opencl/opencl_device.cxx 
b/sc/source/core/opencl/opencl_device.cxx
index de99e0d..79e2396 100644
--- a/sc/source/core/opencl/opencl_device.cxx
+++ b/sc/source/core/opencl/opencl_device.cxx
@@ -404,7 +404,9 @@ ds_status pickBestDevice(ds_profile* profile, int* 
bestDeviceIdx)
 
 double fScore = DBL_MAX;
 if (pScore)
+{
 fScore = pScore->fTime;
+}
 else
 {
 LOG_PRINTF("Unusual null score");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-11-28 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 6eda7db090d35f556e1e8e988f118efa4a8a53b9
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 29 00:29:50 2013 -0600

GPU Calc: fix compilation failures

Change-Id: Idafbd9fb3fb71a1da9ba6b7a39007eac3865c932

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index d11711e..cc4fc04 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1421,7 +1421,14 @@ public:
 }
 virtual std::string BinFuncName(void) const { return "fsop"; }
 };
-
+namespace {
+struct SumIfsArgs {
+SumIfsArgs(cl_mem x): mCLMem(x), mConst(0.0) {}
+SumIfsArgs(double x): mCLMem(NULL), mConst(x) {}
+cl_mem mCLMem;
+double mConst;
+};
+}
 /// Helper functions that have multiple buffers
 class DynamicKernelSoPArguments: public DynamicKernelArgument
 {
@@ -1454,12 +1461,6 @@ public:
 
 if (OpSumCodeGen->NeedReductionKernel())
 {
-struct SumIfsArgs {
-SumIfsArgs(cl_mem x): mCLMem(x), mConst(0.0) {}
-SumIfsArgs(double x): mCLMem(NULL), mConst(x) {}
-cl_mem mCLMem;
-double mConst;
-};
 assert(slidingArgPtr);
 size_t nInput = slidingArgPtr -> GetArrayLength();
 size_t nCurWindowSize = slidingArgPtr -> GetWindowSize();
@@ -1469,13 +1470,13 @@ public:
 e= mvSubArguments.end(); it!=e; ++it)
 {
 if (VectorRef *VR = dynamic_cast(it->get()))
-vclmem.push_back(VR->GetCLBuffer());
+vclmem.push_back(SumIfsArgs(VR->GetCLBuffer()));
 else if (DynamicKernelConstantArgument *CA =
 dynamic_cast<
 DynamicKernelConstantArgument *>(it->get()))
-vclmem.push_back(CA->GetDouble());
+vclmem.push_back(SumIfsArgs(CA->GetDouble()));
 else
-vclmem.push_back((cl_mem)NULL);
+vclmem.push_back(SumIfsArgs((cl_mem)NULL));
 }
 mpClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE,
 sizeof(double)*nVectorWidth, NULL, &err);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-28 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 7f2cfa639ad4cf7a1e740da9aa9748feec745be5
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 29 00:29:50 2013 -0600

GPU Calc: fix compilation failures

Change-Id: Idafbd9fb3fb71a1da9ba6b7a39007eac3865c932

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index e147c52..b43817b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1422,7 +1422,14 @@ public:
 }
 virtual std::string BinFuncName(void) const { return "fsop"; }
 };
-
+namespace {
+struct SumIfsArgs {
+SumIfsArgs(cl_mem x): mCLMem(x), mConst(0.0) {}
+SumIfsArgs(double x): mCLMem(NULL), mConst(x) {}
+cl_mem mCLMem;
+double mConst;
+};
+}
 /// Helper functions that have multiple buffers
 class DynamicKernelSoPArguments: public DynamicKernelArgument
 {
@@ -1455,12 +1462,6 @@ public:
 
 if (OpSumCodeGen->NeedReductionKernel())
 {
-struct SumIfsArgs {
-SumIfsArgs(cl_mem x): mCLMem(x), mConst(0.0) {}
-SumIfsArgs(double x): mCLMem(NULL), mConst(x) {}
-cl_mem mCLMem;
-double mConst;
-};
 assert(slidingArgPtr);
 size_t nInput = slidingArgPtr -> GetArrayLength();
 size_t nCurWindowSize = slidingArgPtr -> GetWindowSize();
@@ -1470,13 +1471,13 @@ public:
 e= mvSubArguments.end(); it!=e; ++it)
 {
 if (VectorRef *VR = dynamic_cast(it->get()))
-vclmem.push_back(VR->GetCLBuffer());
+vclmem.push_back(SumIfsArgs(VR->GetCLBuffer()));
 else if (DynamicKernelConstantArgument *CA =
 dynamic_cast<
 DynamicKernelConstantArgument *>(it->get()))
-vclmem.push_back(CA->GetDouble());
+vclmem.push_back(SumIfsArgs(CA->GetDouble()));
 else
-vclmem.push_back((cl_mem)NULL);
+vclmem.push_back(SumIfsArgs((cl_mem)NULL));
 }
 mpClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE,
 sizeof(double)*nVectorWidth, NULL, &err);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-28 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   33 ++-
 1 file changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 3b79cc5fad948f129b643189e78fd539b8882fe7
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 29 00:16:05 2013 -0600

GPU Calc: do not direclty inline constants coming from data cells

Change-Id: Ia63c8c6207c9c3add3d8d89cafd687df287456ef

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 623a36c..e147c52 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -201,10 +201,7 @@ public:
 }
 virtual void GenDeclRef(std::stringstream &ss) const
 {
-FormulaToken *Tok = GetFormulaToken();
-if (Tok->GetType() != formula::svDouble)
-throw Unhandled();
-ss << Tok->GetDouble();
+ss << mSymName;
 }
 virtual void GenSlidingWindowDecl(std::stringstream &ss) const
 {
@@ -220,10 +217,17 @@ public:
 {
 return 1;
 }
+double GetDouble(void) const
+{
+FormulaToken *Tok = GetFormulaToken();
+if (Tok->GetType() != formula::svDouble)
+throw Unhandled();
+return Tok->GetDouble();
+}
 /// Create buffer and pass the buffer to a given kernel
 virtual size_t Marshal(cl_kernel k, int argno, int, cl_program)
 {
-double tmp = 0.0;
+double tmp = GetDouble();
 // Pass the scalar result back to the rest of the formula kernel
 cl_int err = clSetKernelArg(k, argno, sizeof(double), (void*)&tmp);
 if (CL_SUCCESS != err)
@@ -1451,18 +1455,28 @@ public:
 
 if (OpSumCodeGen->NeedReductionKernel())
 {
+struct SumIfsArgs {
+SumIfsArgs(cl_mem x): mCLMem(x), mConst(0.0) {}
+SumIfsArgs(double x): mCLMem(NULL), mConst(x) {}
+cl_mem mCLMem;
+double mConst;
+};
 assert(slidingArgPtr);
 size_t nInput = slidingArgPtr -> GetArrayLength();
 size_t nCurWindowSize = slidingArgPtr -> GetWindowSize();
-std::vector vclmem;
+std::vector vclmem;
 
 for (SubArgumentsType::iterator it = mvSubArguments.begin(),
 e= mvSubArguments.end(); it!=e; ++it)
 {
 if (VectorRef *VR = dynamic_cast(it->get()))
 vclmem.push_back(VR->GetCLBuffer());
+else if (DynamicKernelConstantArgument *CA =
+dynamic_cast<
+DynamicKernelConstantArgument *>(it->get()))
+vclmem.push_back(CA->GetDouble());
 else
-vclmem.push_back(NULL);
+vclmem.push_back((cl_mem)NULL);
 }
 mpClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE,
 sizeof(double)*nVectorWidth, NULL, &err);
@@ -1477,8 +1491,9 @@ public:
 // set kernel arg of reduction kernel
 for (size_t j=0; j< vclmem.size(); j++){
 err = clSetKernelArg(redKernel, j,
-vclmem[j]?sizeof(cl_mem):sizeof(double),
-(void *)&vclmem[j]);
+vclmem[j].mCLMem?sizeof(cl_mem):sizeof(double),
+vclmem[j].mCLMem?(void *)&vclmem[j].mCLMem:
+(void*)&vclmem[j].mConst);
 if (CL_SUCCESS != err)
 throw OpenCLError(err);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-11-28 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   33 ++-
 1 file changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 2e819caf36ba2a15c56bca5bce61e49920ea1765
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 29 00:16:05 2013 -0600

GPU Calc: do not direclty inline constants coming from data cells

Change-Id: Ia63c8c6207c9c3add3d8d89cafd687df287456ef

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index a269dd8..d11711e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -200,10 +200,7 @@ public:
 }
 virtual void GenDeclRef(std::stringstream &ss) const
 {
-FormulaToken *Tok = GetFormulaToken();
-if (Tok->GetType() != formula::svDouble)
-throw Unhandled();
-ss << Tok->GetDouble();
+ss << mSymName;
 }
 virtual void GenSlidingWindowDecl(std::stringstream &ss) const
 {
@@ -219,10 +216,17 @@ public:
 {
 return 1;
 }
+double GetDouble(void) const
+{
+FormulaToken *Tok = GetFormulaToken();
+if (Tok->GetType() != formula::svDouble)
+throw Unhandled();
+return Tok->GetDouble();
+}
 /// Create buffer and pass the buffer to a given kernel
 virtual size_t Marshal(cl_kernel k, int argno, int, cl_program)
 {
-double tmp = 0.0;
+double tmp = GetDouble();
 // Pass the scalar result back to the rest of the formula kernel
 cl_int err = clSetKernelArg(k, argno, sizeof(double), (void*)&tmp);
 if (CL_SUCCESS != err)
@@ -1450,18 +1454,28 @@ public:
 
 if (OpSumCodeGen->NeedReductionKernel())
 {
+struct SumIfsArgs {
+SumIfsArgs(cl_mem x): mCLMem(x), mConst(0.0) {}
+SumIfsArgs(double x): mCLMem(NULL), mConst(x) {}
+cl_mem mCLMem;
+double mConst;
+};
 assert(slidingArgPtr);
 size_t nInput = slidingArgPtr -> GetArrayLength();
 size_t nCurWindowSize = slidingArgPtr -> GetWindowSize();
-std::vector vclmem;
+std::vector vclmem;
 
 for (SubArgumentsType::iterator it = mvSubArguments.begin(),
 e= mvSubArguments.end(); it!=e; ++it)
 {
 if (VectorRef *VR = dynamic_cast(it->get()))
 vclmem.push_back(VR->GetCLBuffer());
+else if (DynamicKernelConstantArgument *CA =
+dynamic_cast<
+DynamicKernelConstantArgument *>(it->get()))
+vclmem.push_back(CA->GetDouble());
 else
-vclmem.push_back(NULL);
+vclmem.push_back((cl_mem)NULL);
 }
 mpClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE,
 sizeof(double)*nVectorWidth, NULL, &err);
@@ -1476,8 +1490,9 @@ public:
 // set kernel arg of reduction kernel
 for (size_t j=0; j< vclmem.size(); j++){
 err = clSetKernelArg(redKernel, j,
-vclmem[j]?sizeof(cl_mem):sizeof(double),
-(void *)&vclmem[j]);
+vclmem[j].mCLMem?sizeof(cl_mem):sizeof(double),
+vclmem[j].mCLMem?(void *)&vclmem[j].mCLMem:
+(void*)&vclmem[j].mConst);
 if (CL_SUCCESS != err)
 throw OpenCLError(err);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-11-27 Thread Ray
 sc/source/core/opencl/formulagroupcl_public.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7dc87e4176443fd6a5b43ac8147c431b28535350
Author: I-Jui (Ray) Sung 
Date:   Wed Nov 27 18:50:50 2013 -0600

GPU Calc: using intrinsic isnan() to improve performance and compilation 
time

Change-Id: I516b0ef0309524b5ecacdee4cd3dd2191c6afb19

diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index ac02e33..49510e8 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -11,7 +11,7 @@
 #define SC_OPENCL_FORMULAGROUPCL_PUBLIC_HXX
 
 const char* publicFunc =
- "int isNan(double a) { return a != a; }\n"
+ "int isNan(double a) { return isnan(a); }\n"
  "double fsum_count(double a, double b, __private int *p) {\n"
  "bool t = isNan(a);\n"
  "(*p) += t?0:1;\n"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 3 commits - sc/source

2013-11-27 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   79 +--
 sc/source/core/opencl/opbase.hxx |   10 +++
 2 files changed, 74 insertions(+), 15 deletions(-)

New commits:
commit d78a19131950c087706a376f68b7066b44bf2f86
Author: I-Jui (Ray) Sung 
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] = {0x, 0x7fff};
 }
-#define NAN (*(const float *) __nan)
+#define NAN (*(const double*) __nan)
 #endif
 #endif
 
commit 1de71419351019097074913815e5c049437c9419
Author: I-Jui (Ray) Sung 
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] = {0x, 0x7fff};
+}
+#define NAN (*(const float *) __nan)
+#endif
+#endif
 
 #include 
 #include 
commit 4e88456720a94e5e812d6b81c841e6839dca5836
Author: I-Jui (Ray) Sung 
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(
 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 *slidingArgPtr =
-dynamic_cast< DynamicKernelSlidingArgument *>
-(mvSubArguments[0].get());
+dynamic_cast< DynamicKernelSlidingArgument *> (Arg);
 cl_mem mpClmem2;
 
 if (OpSumCodeGen->NeedReductionKernel())
@@ -1590,6 +1611,8 @@ DynamicKernelArgument *VectorRefFactory(const std::string 
&s,
 //Blac

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-11-27 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4ebd9eb897f17b07e29aaefd8fbfc79e182f2269
Author: I-Jui (Ray) Sung 
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 8ccb967..a269dd8 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] = {0x, 0x7fff};
 }
-#define NAN (*(const float *) __nan)
+#define NAN (*(const double*) __nan)
 #endif
 #endif
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-11-27 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit d82c9a499e2b6e4e57a7907ae2679a1fe7720458
Author: I-Jui (Ray) Sung 
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 7d62ffe..8ccb967 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] = {0x, 0x7fff};
+}
+#define NAN (*(const float *) __nan)
+#endif
+#endif
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

2013-11-27 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   71 +--
 sc/source/core/opencl/opbase.hxx |   10 +++-
 2 files changed, 66 insertions(+), 15 deletions(-)

New commits:
commit a7268371b105d3d2d1e3f1e1d0a68db08bbaa2ec
Author: I-Jui (Ray) Sung 
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 c87badc..7d62ffe 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(
 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 *slidingArgPtr =
-dynamic_cast< DynamicKernelSlidingArgument *>
-(mvSubArguments[0].get());
+dynamic_cast< DynamicKernelSlidingArgument *> (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(pCodeGen.get())) {
+if (index == 0) // the first argument of OpSumIfs cannot be strings 
anyway
+return new DynamicKernelSlidingArgument(s, ft, 
pCodeGen, index);
 return new DynamicKernelSlidingArgument(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(
 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 &&
+

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/qa sc/source

2013-11-24 Thread Ray
 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 cb699c576c91f7c1de98036a01c369402eee073e
Author: I-Jui (Ray) Sung 
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 000..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 6fabd98..f1ab881 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -244,6 +244,7 @@ public:
 void testStatisticalFormulaCovar();
 void testLogicalFormulaAnd();
 void testMathFormulaSumProduct();
+void testMathFormulaSumProduct2();
 void testStatisticalParallelCountBug();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
@@ -418,6 +419,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 fecc3486633d9a83e5c1f501fbd8c2256d65cbf7
Author: I-Jui (Ray) Sung 
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 ad6ccc1..515fc89 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1107,10 +1107,30 @@ public:
 ss << "for(int outLoop=0; outLoop<" <<
 nCurWindowSize/outLoopSize<< "; outLoop++){\n\t";
 for(int count=0; count < outLoopSize; count++){
-ss << "i = outLoop*"<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)
@@ -1153,10 +1173,30 @@ public:
 for(unsigned int count=nCurWindowSize/outLoopSize*outLoopSize;
 count < nCurWindowSize; count++)
 {
-ss << "i =" <GetFormulaToken();
+if(ocPush==tmpCur->GetOpCode())
+{
+pCurDVR= dynamic_cast<
+const formula::DoubleVectorRefToken *>(tmpCur);

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 2 commits - sc/qa sc/source

2013-11-24 Thread Ray
 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 4e90af55242f59f6050611efd2b849a1e3a679e3
Author: I-Jui (Ray) Sung 
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 000..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 70cb6b4f6a417527998b33b2d5a407434495651a
Author: I-Jui (Ray) Sung 
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*"<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 =" <GetFormulaToken();
+if(ocPush==tmpCur->GetOpCode())
+{
+pCurDVR= dynamic_cast<
+const formula::DoubleVectorRefToken *>(tmpCur);

[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source

2013-11-24 Thread Ray
 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 01a977486f050bf61b2c8592426e26cfe4f8
Author: I-Jui (Ray) Sung 
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 000..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 
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*"<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 =" <GetFormulaToken();
+if(ocPush==tmpCur->GetOpCode())
+{
+pCurDVR= dynamic_cast<
+const formula::DoubleVectorRefToken *>(tmpCur);

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 2 commits - sc/qa sc/source

2013-11-22 Thread Ray
 sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods |binary
 sc/qa/unit/opencl-test.cxx|   28 
++
 sc/source/core/opencl/formulagroupcl.cxx  |2 
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 3621f1952d129892d14ab57a123c6c3e181cae49
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:38:21 2013 -0600

GPU Calc: test case for parallel count()

AMLOEXT-243 BUG

Change-Id: I97e2dab35b40f4f7fcd4975ae7c5907e97e19fd9

diff --git a/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods
new file mode 100644
index 000..4a8d5f9
Binary files /dev/null and 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 3f02d9b..faf2ddb 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 testStatisticalParallelCountBug();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -415,6 +416,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaCovar);
 CPPUNIT_TEST(testLogicalFormulaAnd);
 CPPUNIT_TEST(testMathFormulaSumProduct);
+CPPUNIT_TEST(testStatisticalParallelCountBug);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4818,6 +4820,32 @@ void ScOpenclTest:: testLogicalFormulaAnd()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+
+//[AMLOEXT-243]
+void ScOpenclTest:: testStatisticalParallelCountBug()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh =
+loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
+ScDocument *pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc->CalcAll();
+ScDocShellRef xDocShRes =
+loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
+ScDocument *pDocRes = xDocShRes->GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i < 13; ++i)
+{
+double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh->DoClose();
+xDocShRes->DoClose();
+}
+
 ScOpenclTest::ScOpenclTest()
   : ScBootstrapFixture( "/sc/qa/unit/data" )
 {
commit 80e98f2b73a0fde51c0cb0d2da097b57c4c71223
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:42:14 2013 -0600

GPU Calc: fix a parallel COUNT() problem when input vector size > 512

AMLOEXT-243 FIX

Change-Id: I1a356f9a591c1f5a99d2675065b63a7673217ac6

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 7843748..b0bb011 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -695,7 +695,7 @@ public:
 ss << "if (lidx == 0)\n";
 ss << "current_result =";
 if (dynamic_cast(mpCodeGen.get()))
-ss << "shm_buf[0]";
+ss << "current_result + shm_buf[0]";
 else
 ss << mpCodeGen->Gen2("current_result", "shm_buf[0]");
 ss << ";\n";
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 3 commits - sc/qa sc/source

2013-11-22 Thread Ray
 sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods |binary
 sc/qa/unit/opencl-test.cxx|   28 
++
 sc/source/core/opencl/formulagroupcl.cxx  |2 
 sc/source/core/opencl/formulagroupcl_public.hxx   |2 
 4 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit c5014f8ffe182065aca3252cc3dd2160028f733a
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:48:14 2013 -0600

GPU Calc: using intrinsic isnan()

Change-Id: Ic714074a22847fbe4ac39cd035d4924fb0525efd

diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index d001a06..eaf4227 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -11,7 +11,7 @@
 #define SC_OPENCL_FORMULAGROUPCL_PUBLIC_HXX
 
 const char* publicFunc =
- "int isNan(double a) { return a != a; }\n"
+ "int isNan(double a) { return isnan(a); }\n"
  "double fsum_count(double a, double b, __private int *p) {\n"
  "bool t = isNan(a);\n"
  "(*p) += t?0:1;\n"
commit 76ec9bb5bdd3169203d232431e8cff2e923f3678
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:38:21 2013 -0600

GPU Calc: test case for parallel count()

AMLOEXT-243 BUG

Change-Id: I97e2dab35b40f4f7fcd4975ae7c5907e97e19fd9

diff --git a/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods
new file mode 100644
index 000..4a8d5f9
Binary files /dev/null and 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 86a73b0..6fabd98 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -244,6 +244,7 @@ public:
 void testStatisticalFormulaCovar();
 void testLogicalFormulaAnd();
 void testMathFormulaSumProduct();
+void testStatisticalParallelCountBug();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -417,6 +418,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaCovar);
 CPPUNIT_TEST(testLogicalFormulaAnd);
 CPPUNIT_TEST(testMathFormulaSumProduct);
+CPPUNIT_TEST(testStatisticalParallelCountBug);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4818,6 +4820,32 @@ void ScOpenclTest:: testLogicalFormulaAnd()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+
+//[AMLOEXT-243]
+void ScOpenclTest:: testStatisticalParallelCountBug()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh =
+loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
+ScDocument *pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc->CalcAll();
+ScDocShellRef xDocShRes =
+loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
+ScDocument *pDocRes = xDocShRes->GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i < 13; ++i)
+{
+double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh->DoClose();
+xDocShRes->DoClose();
+}
+
 ScOpenclTest::ScOpenclTest()
   : ScBootstrapFixture( "/sc/qa/unit/data" )
 {
commit 1d16cbb10f02a79d23eb7e08c42a860e15767ce8
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:42:14 2013 -0600

GPU Calc: fix a parallel COUNT() problem when input vector size > 512

AMLOEXT-243 FIX

Change-Id: I1a356f9a591c1f5a99d2675065b63a7673217ac6

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 44584b8..2c795cc 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -695,7 +695,7 @@ public:
 ss << "if (lidx == 0)\n";
 ss << "current_result =";
 if (dynamic_cast(mpCodeGen.get()))
-ss << "shm_buf[0]";
+ss << "current_result + shm_buf[0]";
 else
 ss << mpCodeGen->Gen2("current_result", "shm_buf[0]");
 ss << ";\n";
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source

2013-11-22 Thread Ray
 sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods |binary
 sc/qa/unit/opencl-test.cxx|   28 
++
 sc/source/core/opencl/formulagroupcl.cxx  |2 
 sc/source/core/opencl/formulagroupcl_public.hxx   |2 
 4 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit a2972f7d8c5037acb278d9f9fb6e51cef479de1a
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:48:14 2013 -0600

GPU Calc: using intrinsic isnan()

Change-Id: Ic714074a22847fbe4ac39cd035d4924fb0525efd

diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index d001a06..eaf4227 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -11,7 +11,7 @@
 #define SC_OPENCL_FORMULAGROUPCL_PUBLIC_HXX
 
 const char* publicFunc =
- "int isNan(double a) { return a != a; }\n"
+ "int isNan(double a) { return isnan(a); }\n"
  "double fsum_count(double a, double b, __private int *p) {\n"
  "bool t = isNan(a);\n"
  "(*p) += t?0:1;\n"
commit 1869c062c4fe8267323764e2cc9e7367e1ec3674
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:38:21 2013 -0600

GPU Calc: test case for parallel count()

AMLOEXT-243 BUG

Change-Id: I97e2dab35b40f4f7fcd4975ae7c5907e97e19fd9

diff --git a/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods
new file mode 100644
index 000..4a8d5f9
Binary files /dev/null and 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 3f02d9b..faf2ddb 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 testStatisticalParallelCountBug();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -415,6 +416,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaCovar);
 CPPUNIT_TEST(testLogicalFormulaAnd);
 CPPUNIT_TEST(testMathFormulaSumProduct);
+CPPUNIT_TEST(testStatisticalParallelCountBug);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4818,6 +4820,32 @@ void ScOpenclTest:: testLogicalFormulaAnd()
 xDocSh->DoClose();
 xDocShRes->DoClose();
 }
+
+//[AMLOEXT-243]
+void ScOpenclTest:: testStatisticalParallelCountBug()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh =
+loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
+ScDocument *pDoc = xDocSh->GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc->CalcAll();
+ScDocShellRef xDocShRes =
+loadDoc("opencl/statistical/parallel_count_bug_243.", ODS);
+ScDocument *pDocRes = xDocShRes->GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i < 13; ++i)
+{
+double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh->DoClose();
+xDocShRes->DoClose();
+}
+
 ScOpenclTest::ScOpenclTest()
   : ScBootstrapFixture( "/sc/qa/unit/data" )
 {
commit 8b9c106064b6899e4bb4a86efb8906eef758c5bf
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 22 11:42:14 2013 -0600

GPU Calc: fix a parallel COUNT() problem when input vector size > 512

AMLOEXT-243 FIX

Change-Id: I1a356f9a591c1f5a99d2675065b63a7673217ac6

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 7843748..b0bb011 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -695,7 +695,7 @@ public:
 ss << "if (lidx == 0)\n";
 ss << "current_result =";
 if (dynamic_cast(mpCodeGen.get()))
-ss << "shm_buf[0]";
+ss << "current_result + shm_buf[0]";
 else
 ss << mpCodeGen->Gen2("current_result", "shm_buf[0]");
 ss << ";\n";
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/tags/libreoffice-4-2-milestone-1'

2013-11-21 Thread Ray
Tag 'libreoffice-4-2-milestone-1' created by Michael Meeks 
 at 2013-11-21 13:33 -0800

updated milestone one

Changes since libreoffice-4-1-branch-point-12122:
---
 0 files changed
---
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-20 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 4a37d4a33a6d56f6d1c7a9cb3d92a06e98ef49a3
Author: I-Jui (Ray) Sung 
Date:   Wed Nov 20 16:24:16 2013 -0600

GPU Calc: fixed missing assigment operator in unrolling

Change-Id: Ie7060900f4f90b789a16b1341ec1c2c905410ee1

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index ad28bd2..44584b8 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -533,6 +533,7 @@ return nCurWindowSize;
 if(count==0){
 temp1 << "if(i + gid0 < " 
<GetArrayLength();
 temp1 << "){\n\t\t";
+temp1 << "tmp = ";
 temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
 temp1 << "}\n\t";
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-20 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 853299f0388d2d2067a8a5ab412ac64391996405
Author: I-Jui (Ray) Sung 
Date:   Wed Nov 20 16:24:16 2013 -0600

GPU Calc: fixed missing assigment operator in unrolling

Change-Id: Ie7060900f4f90b789a16b1341ec1c2c905410ee1

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 2ddff75..7843748 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -533,6 +533,7 @@ return nCurWindowSize;
 if(count==0){
 temp1 << "if(i + gid0 < " 
<GetArrayLength();
 temp1 << "){\n\t\t";
+temp1 << "tmp = ";
 temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
 temp1 << "}\n\t";
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-20 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 4b4c1660684bb495aa05185a4b9e0c3eb0ea2770
Author: I-Jui (Ray) Sung 
Date:   Wed Nov 20 08:49:27 2013 -0600

GPU Calc: re-enable parallel SUMIFS

Change-Id: I70797f089ead267d223772b73c4d093813716029

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 6e4df20..ad28bd2 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -434,7 +434,14 @@ public:
 bIsStartFixed = mpDVR->IsStartFixed();
 bIsEndFixed = mpDVR->IsEndFixed();
 }
-
+// Should only be called by SumIfs. Yikes!
+virtual bool NeedParallelReduction(void) const
+{
+assert(dynamic_cast(mpCodeGen.get()));
+return GetWindowSize()> 100 &&
+( (GetStartFixed() && GetEndFixed()) ||
+  (!GetStartFixed() && !GetEndFixed())  ) ;
+}
 virtual void GenSlidingWindowFunction(std::stringstream &) {}
 
 virtual std::string GenSlidingWindowDeclRef(bool=false) const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-20 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit b98edda0719e382f38e68ecd76653c5de74aa283
Author: I-Jui (Ray) Sung 
Date:   Wed Nov 20 08:49:27 2013 -0600

GPU Calc: re-enable parallel SUMIFS

Change-Id: I70797f089ead267d223772b73c4d093813716029

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 5d14ddd..2ddff75 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -434,7 +434,14 @@ public:
 bIsStartFixed = mpDVR->IsStartFixed();
 bIsEndFixed = mpDVR->IsEndFixed();
 }
-
+// Should only be called by SumIfs. Yikes!
+virtual bool NeedParallelReduction(void) const
+{
+assert(dynamic_cast(mpCodeGen.get()));
+return GetWindowSize()> 100 &&
+( (GetStartFixed() && GetEndFixed()) ||
+  (!GetStartFixed() && !GetEndFixed())  ) ;
+}
 virtual void GenSlidingWindowFunction(std::stringstream &) {}
 
 virtual std::string GenSlidingWindowDeclRef(bool=false) const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx|   22 --
 sc/source/core/opencl/formulagroupcl_public.hxx |6 +-
 2 files changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 1f3c1592da05740e695ef3502ca8f3cb4cdaa62b
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 22:53:42 2013 -0600

GPU Calc: optimize average() handling

Change-Id: I2f9a813e15068867f218631e9ebadd3ea2c38c95

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index dbefbf8..6e4df20 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -528,7 +528,6 @@ return nCurWindowSize;
 temp1 << "){\n\t\t";
 temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
-temp1 << "nCount += 1;\n\t\t";
 temp1 << "}\n\t";
 }
 ss << temp1.str();
@@ -544,7 +543,6 @@ return nCurWindowSize;
 temp2 << "tmp = ";
 temp2 << mpCodeGen->Gen2(GenSlidingWindowDeclRef(), 
"tmp");
 temp2 << ";\n\t\t\t";
-temp2 << "nCount += 1;\n\t\t";
 temp2 << "}\n\t";
 }
 ss << temp2.str();
@@ -568,7 +566,6 @@ return nCurWindowSize;
 temp1 << "tmp = ";
 temp1 << 
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
-temp1 << "nCount += 1;\n\t\t";
 }
 ss << temp1.str();
 }
@@ -581,7 +578,6 @@ return nCurWindowSize;
 temp2 << "tmp = ";
 temp2 << mpCodeGen->Gen2(GenSlidingWindowDeclRef(), 
"tmp");
 temp2 << ";\n\t\t\t";
-temp2 << "nCount += 1;\n\t\t";
 }
 ss << temp2.str();
 }
@@ -847,7 +843,8 @@ public:
 ss << ") {\n\t";
 ss << "double tmp = " << GetBottom() <<";\n\t";
 ss << "int gid0 = get_global_id(0);\n\t";
-ss << "int nCount = 0;\n\t";
+if (isAverage())
+ss << "int nCount = 0;\n\t";
 ss << "double tmpBottom;\n\t";
 unsigned i = vSubArguments.size();
 size_t nItems = 0;
@@ -901,9 +898,6 @@ public:
 }
 else
 {
-#ifdef  ISNAN
-ss << "nCount += 1;\n\t\t";
-#endif
 nItems += 1;
 }
 }
@@ -920,7 +914,6 @@ public:
 ss << "tmp = ";
 ss << Gen2(vSubArguments[i]->GenSlidingWindowDeclRef(), "tmp");
 ss << ";\n\t\t\t";
-ss << "nCount += 1;\n\t\t";
 ss << "}\n\t";
 ss << "}\n\t";
 }
@@ -1266,7 +1259,16 @@ public:
 virtual std::string BinFuncName(void) const { return "fsum"; }
 };
 
-class OpAverage: public OpSum {
+class OpAverage: public Reduction {
+public:
+virtual std::string GetBottom(void) { return "0"; }
+virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
+{
+std::stringstream ss;
+ss << "fsum_count(" << lhs <<","<< rhs<<", &nCount)";
+return ss.str();
+}
+virtual std::string BinFuncName(void) const { return "fsum"; }
 virtual bool isAverage() const { return true; }
 };
 
diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index ccee5e1..d001a06 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -12,7 +12,11 @@
 
 const char* publicFunc =
  "int isNan(double a) { return a != a; }\n"
- "double legalize(double a, double b) { return isNan(a)?b:a; }\n"
+ "double fsum_count(double a, double b, __private int *p) {\n"
+ "bool t = isNan(a);\n"
+ "(*p) += t?0:1;\n"
+ "return t?b:a+b;\n"
+ "}\n"
  "double fsum(double a, double b) { return isNan(a)?b:a+b; }\n"
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx|   22 --
 sc/source/core/opencl/formulagroupcl_public.hxx |6 +-
 2 files changed, 17 insertions(+), 11 deletions(-)

New commits:
commit 5b1480e33d71ee49bcfb73b3a0144ca6fc2c5e6b
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 22:53:42 2013 -0600

GPU Calc: optimize average() handling

Change-Id: I2f9a813e15068867f218631e9ebadd3ea2c38c95

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index f480e54..40df1ae 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -528,7 +528,6 @@ return nCurWindowSize;
 temp1 << "){\n\t\t";
 temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
-temp1 << "nCount += 1;\n\t\t";
 temp1 << "}\n\t";
 }
 ss << temp1.str();
@@ -544,7 +543,6 @@ return nCurWindowSize;
 temp2 << "tmp = ";
 temp2 << mpCodeGen->Gen2(GenSlidingWindowDeclRef(), 
"tmp");
 temp2 << ";\n\t\t\t";
-temp2 << "nCount += 1;\n\t\t";
 temp2 << "}\n\t";
 }
 ss << temp2.str();
@@ -568,7 +566,6 @@ return nCurWindowSize;
 temp1 << "tmp = ";
 temp1 << 
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
-temp1 << "nCount += 1;\n\t\t";
 }
 ss << temp1.str();
 }
@@ -581,7 +578,6 @@ return nCurWindowSize;
 temp2 << "tmp = ";
 temp2 << mpCodeGen->Gen2(GenSlidingWindowDeclRef(), 
"tmp");
 temp2 << ";\n\t\t\t";
-temp2 << "nCount += 1;\n\t\t";
 }
 ss << temp2.str();
 }
@@ -847,7 +843,8 @@ public:
 ss << ") {\n\t";
 ss << "double tmp = " << GetBottom() <<";\n\t";
 ss << "int gid0 = get_global_id(0);\n\t";
-ss << "int nCount = 0;\n\t";
+if (isAverage())
+ss << "int nCount = 0;\n\t";
 ss << "double tmpBottom;\n\t";
 unsigned i = vSubArguments.size();
 size_t nItems = 0;
@@ -901,9 +898,6 @@ public:
 }
 else
 {
-#ifdef  ISNAN
-ss << "nCount += 1;\n\t\t";
-#endif
 nItems += 1;
 }
 }
@@ -920,7 +914,6 @@ public:
 ss << "tmp = ";
 ss << Gen2(vSubArguments[i]->GenSlidingWindowDeclRef(), "tmp");
 ss << ";\n\t\t\t";
-ss << "nCount += 1;\n\t\t";
 ss << "}\n\t";
 ss << "}\n\t";
 }
@@ -1266,7 +1259,16 @@ public:
 virtual std::string BinFuncName(void) const { return "fsum"; }
 };
 
-class OpAverage: public OpSum {
+class OpAverage: public Reduction {
+public:
+virtual std::string GetBottom(void) { return "0"; }
+virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
+{
+std::stringstream ss;
+ss << "fsum_count(" << lhs <<","<< rhs<<", &nCount)";
+return ss.str();
+}
+virtual std::string BinFuncName(void) const { return "fsum"; }
 virtual bool isAverage() const { return true; }
 };
 
diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index ccee5e1..d001a06 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -12,7 +12,11 @@
 
 const char* publicFunc =
  "int isNan(double a) { return a != a; }\n"
- "double legalize(double a, double b) { return isNan(a)?b:a; }\n"
+ "double fsum_count(double a, double b, __private int *p) {\n"
+ "bool t = isNan(a);\n"
+ "(*p) += t?0:1;\n"
+ "return t?b:a+b;\n"
+ "}\n"
  "double fsum(double a, double b) { return isNan(a)?b:a+b; }\n"
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   99 +++
 1 file changed, 48 insertions(+), 51 deletions(-)

New commits:
commit 38b2f25fd6371f45d8f0c997b6e4d14efdf150d3
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 22:21:24 2013 -0600

GPU Calc: Fix COUNT() regression

Change-Id: I1b313d7f5f144f1884abe60c816db1fd6a643489

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index a457248..f480e54 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -24,8 +24,11 @@
 #include "op_logical.hxx"
 #include "op_statistical.hxx"
 #include "op_array.hxx"
+/// CONFIGURATIONS
 // Comment out this to turn off FMIN and FMAX intrinsics
 #define USE_FMIN_FMAX 1
+#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"
 
 #include 
@@ -41,7 +44,6 @@
 
 #include 
 
-#define UNROLLING
 
 using namespace formula;
 
@@ -414,6 +416,7 @@ class OpSum; // Forward Declaration
 class OpAverage; // Forward Declaration
 class OpMin; // Forward Declaration
 class OpMax; // Forward Declaration
+class OpCount; // Forward Declaration
 template
 class DynamicKernelSlidingArgument: public Base
 {
@@ -450,7 +453,7 @@ public:
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
 // original for loop
-#ifndef UNROLLING
+#ifndef UNROLLING_FACTOR
 needBody = true;
 // No need to generate a for-loop for degenerated cases
 if (nCurWindowSize == 1)
@@ -497,7 +500,7 @@ public:
 return nCurWindowSize;
 #endif
 
-#ifdef UNROLLING
+#ifdef UNROLLING_FACTOR
 {
 if (!mpDVR->IsStartFixed() && mpDVR->IsEndFixed()) {
 ss << "for (int i = ";
@@ -515,7 +518,7 @@ return nCurWindowSize;
 ss << "tmpBottom = " << mpCodeGen->GetBottom() << ";\n\t";
 ss << "{int i;\n\t";
 std::stringstream temp1,temp2;
-int outLoopSize = 16;
+int outLoopSize = UNROLLING_FACTOR;
 if ( nCurWindowSize/outLoopSize != 0){
 ss << "for(int outLoop=0; outLoop<" << 
nCurWindowSize/outLoopSize<< "; outLoop++){\n\t";
 for(int count=0; count < outLoopSize; count++){
@@ -523,18 +526,10 @@ return nCurWindowSize;
 if(count==0){
 temp1 << "if(i + gid0 < " 
<GetArrayLength();
 temp1 << "){\n\t\t";
-temp1 << "if (isNan(";
-temp1 <<  GenSlidingWindowDeclRef();
-temp1 << ")){\n\t\t\t";
-temp1 << "tmp = ";
-temp1 <<  mpCodeGen->Gen2("tmpBottom", "tmp") << 
";\n\t\t";
-temp1 << "}else{\n\t\t\t";
-temp1 << "tmp = ";
 temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
 temp1 << "nCount += 1;\n\t\t";
 temp1 << "}\n\t";
-temp1 << "}\n\t";
 }
 ss << temp1.str();
 }
@@ -546,18 +541,11 @@ return nCurWindowSize;
 if(count==nCurWindowSize/outLoopSize*outLoopSize){
 temp2 << "if(i + gid0 < " << mpDVR->GetArrayLength();
 temp2 << "){\n\t\t";
-temp2 << "if (isNan(";
-temp2 << GenSlidingWindowDeclRef();
-temp2 << ")){\n\t\t\t";
-temp2 << "tmp = ";
-temp2 << mpCodeGen->Gen2("tmpBottom", "tmp") << 
";\n\t\t";
-temp2 << "}else{\n\t\t\t";
 temp2 << "tmp = ";
 temp2 << mpCodeGen->Gen2(GenSlidingWindowDeclRef(), 
"tmp");
 temp2 << ";\n\t\t\t";
 temp2 << "nCount += 1;\n\t\t";
 temp2 << "}\n\t";
-temp2 <<

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   99 +++
 1 file changed, 48 insertions(+), 51 deletions(-)

New commits:
commit 8441dd5c9aa58e00fd1d70f68df2d624120007a9
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 22:21:24 2013 -0600

GPU Calc: Fix COUNT() regression

Change-Id: I1b313d7f5f144f1884abe60c816db1fd6a643489

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 0a33eb7..dbefbf8 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -24,8 +24,11 @@
 #include "op_logical.hxx"
 #include "op_statistical.hxx"
 #include "op_array.hxx"
+/// CONFIGURATIONS
 // Comment out this to turn off FMIN and FMAX intrinsics
 #define USE_FMIN_FMAX 1
+#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"
 
 #include 
@@ -41,7 +44,6 @@
 
 #include 
 
-#define UNROLLING
 
 using namespace formula;
 
@@ -414,6 +416,7 @@ class OpSum; // Forward Declaration
 class OpAverage; // Forward Declaration
 class OpMin; // Forward Declaration
 class OpMax; // Forward Declaration
+class OpCount; // Forward Declaration
 template
 class DynamicKernelSlidingArgument: public Base
 {
@@ -450,7 +453,7 @@ public:
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
 // original for loop
-#ifndef UNROLLING
+#ifndef UNROLLING_FACTOR
 needBody = true;
 // No need to generate a for-loop for degenerated cases
 if (nCurWindowSize == 1)
@@ -497,7 +500,7 @@ public:
 return nCurWindowSize;
 #endif
 
-#ifdef UNROLLING
+#ifdef UNROLLING_FACTOR
 {
 if (!mpDVR->IsStartFixed() && mpDVR->IsEndFixed()) {
 ss << "for (int i = ";
@@ -515,7 +518,7 @@ return nCurWindowSize;
 ss << "tmpBottom = " << mpCodeGen->GetBottom() << ";\n\t";
 ss << "{int i;\n\t";
 std::stringstream temp1,temp2;
-int outLoopSize = 16;
+int outLoopSize = UNROLLING_FACTOR;
 if ( nCurWindowSize/outLoopSize != 0){
 ss << "for(int outLoop=0; outLoop<" << 
nCurWindowSize/outLoopSize<< "; outLoop++){\n\t";
 for(int count=0; count < outLoopSize; count++){
@@ -523,18 +526,10 @@ return nCurWindowSize;
 if(count==0){
 temp1 << "if(i + gid0 < " 
<GetArrayLength();
 temp1 << "){\n\t\t";
-temp1 << "if (isNan(";
-temp1 <<  GenSlidingWindowDeclRef();
-temp1 << ")){\n\t\t\t";
-temp1 << "tmp = ";
-temp1 <<  mpCodeGen->Gen2("tmpBottom", "tmp") << 
";\n\t\t";
-temp1 << "}else{\n\t\t\t";
-temp1 << "tmp = ";
 temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
 temp1 << ";\n\t\t\t";
 temp1 << "nCount += 1;\n\t\t";
 temp1 << "}\n\t";
-temp1 << "}\n\t";
 }
 ss << temp1.str();
 }
@@ -546,18 +541,11 @@ return nCurWindowSize;
 if(count==nCurWindowSize/outLoopSize*outLoopSize){
 temp2 << "if(i + gid0 < " << mpDVR->GetArrayLength();
 temp2 << "){\n\t\t";
-temp2 << "if (isNan(";
-temp2 << GenSlidingWindowDeclRef();
-temp2 << ")){\n\t\t\t";
-temp2 << "tmp = ";
-temp2 << mpCodeGen->Gen2("tmpBottom", "tmp") << 
";\n\t\t";
-temp2 << "}else{\n\t\t\t";
 temp2 << "tmp = ";
 temp2 << mpCodeGen->Gen2(GenSlidingWindowDeclRef(), 
"tmp");
 temp2 << ";\n\t\t\t";
 temp2 << "nCount += 1;\n\t\t";
 temp2 << "}\n\t";
-temp2 <<

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   26 --
 1 file changed, 8 insertions(+), 18 deletions(-)

New commits:
commit 06c8a7a20517441e3f001a993cbeaa4e3fa69a54
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 19:24:06 2013 -0600

GPU Calc: parallel reduction version of COUNT

Change-Id: Ia90b5aaf044379b5bfc55ec525f9be2f6fda6028

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 87f4d89..d283174 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -687,19 +687,13 @@ public:
 ss << "tmp = "<< mpCodeGen->GetBottom() << ";\n";
 ss << "int loopOffset = l*512;\n";
 ss << "if((loopOffset + lidx + offset + 256) < min( offset + 
windowSize, arrayLength))\n";
-ss << "tmp = ";
-ss << mpCodeGen->Gen2(
-std::string(
-"legalize(A[loopOffset + lidx + offset], ")+
-mpCodeGen->GetBottom() +")",
-std::string(
-"legalize(A[loopOffset + lidx + offset + 256], ")+
-mpCodeGen->GetBottom() +")"
-);
-ss << ";\n";
+ss << "tmp = " << mpCodeGen->Gen2(
+"A[loopOffset + lidx + offset]", "tmp") <<";\n";
+ss << "tmp = " << mpCodeGen->Gen2(
+"A[loopOffset + lidx + offset + 256]", "tmp") << ";\n";
 ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = legalize(A[loopOffset + lidx + offset],";
-ss << mpCodeGen->GetBottom() << ");\n";
+ss << "tmp = " << mpCodeGen->Gen2(
+"A[loopOffset + lidx + offset]", "tmp") <<";\n";
 ss << "shm_buf[lidx] = tmp;\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "for (int i = 128; i >0; i/=2) {\n";
@@ -1226,11 +1220,7 @@ public:
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
 std::stringstream ss;
-#ifdef  ISNAN
-ss << "(0 =="<< lhs << ")? tmp : (" << rhs<<"+1.0)";
-#else
 ss << "(isNan(" << lhs << ")?"<(s, ft, pCodeGen, index);
 }
-// COUNT is not supported yet
-else if (dynamic_cast(pCodeGen.get()))
+// Sub is not a reduction per se
+else if (dynamic_cast(pCodeGen.get()))
 {
 return new DynamicKernelSlidingArgument(s, ft, pCodeGen, index);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   26 --
 1 file changed, 8 insertions(+), 18 deletions(-)

New commits:
commit 726ccd5ae1ab6608497e4aac8c62a5206488a0fb
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 19:24:06 2013 -0600

GPU Calc: parallel reduction version of COUNT

Change-Id: Ia90b5aaf044379b5bfc55ec525f9be2f6fda6028

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 388605c..3e40716 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -687,19 +687,13 @@ public:
 ss << "tmp = "<< mpCodeGen->GetBottom() << ";\n";
 ss << "int loopOffset = l*512;\n";
 ss << "if((loopOffset + lidx + offset + 256) < min( offset + 
windowSize, arrayLength))\n";
-ss << "tmp = ";
-ss << mpCodeGen->Gen2(
-std::string(
-"legalize(A[loopOffset + lidx + offset], ")+
-mpCodeGen->GetBottom() +")",
-std::string(
-"legalize(A[loopOffset + lidx + offset + 256], ")+
-mpCodeGen->GetBottom() +")"
-);
-ss << ";\n";
+ss << "tmp = " << mpCodeGen->Gen2(
+"A[loopOffset + lidx + offset]", "tmp") <<";\n";
+ss << "tmp = " << mpCodeGen->Gen2(
+"A[loopOffset + lidx + offset + 256]", "tmp") << ";\n";
 ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = legalize(A[loopOffset + lidx + offset],";
-ss << mpCodeGen->GetBottom() << ");\n";
+ss << "tmp = " << mpCodeGen->Gen2(
+"A[loopOffset + lidx + offset]", "tmp") <<";\n";
 ss << "shm_buf[lidx] = tmp;\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "for (int i = 128; i >0; i/=2) {\n";
@@ -1226,11 +1220,7 @@ public:
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
 std::stringstream ss;
-#ifdef  ISNAN
-ss << "(0 =="<< lhs << ")? tmp : (" << rhs<<"+1.0)";
-#else
 ss << "(isNan(" << lhs << ")?"<(s, ft, pCodeGen, index);
 }
-// COUNT is not supported yet
-else if (dynamic_cast(pCodeGen.get()))
+// Sub is not a reduction per se
+else if (dynamic_cast(pCodeGen.get()))
 {
 return new DynamicKernelSlidingArgument(s, ft, pCodeGen, index);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |  290 +++
 1 file changed, 186 insertions(+), 104 deletions(-)

New commits:
commit cd67d819b45054ee8cbbb6a0cb261f3ef9b5b659
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 16:42:56 2013 -0600

GPU Calc: separate out parallel reduction from DynamicKernelSlidingArgument

Create a new class ParallelReductionVectorRef to straighten out code
generation and marshaling logic between sequential and parallel code
generation alternatives.

Change-Id: Id029ad441f80712f8e7396dcd985e3363ce08ff8

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 2d806aa..87f4d89 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -409,6 +409,7 @@ protected:
 
 /// Handling a Double Vector that is used as a sliding window input
 /// to either a sliding window average or sum-of-products
+/// Generate a sequential loop for reductions
 class OpSum; // Forward Declaration
 class OpAverage; // Forward Declaration
 class OpMin; // Forward Declaration
@@ -430,79 +431,8 @@ public:
 bIsStartFixed = mpDVR->IsStartFixed();
 bIsEndFixed = mpDVR->IsEndFixed();
 }
-virtual bool NeedParallelReduction(void) const
-{
-if ((dynamic_cast(mpCodeGen.get())
-&& !dynamic_cast(mpCodeGen.get())) ||
-dynamic_cast(mpCodeGen.get()) ||
-dynamic_cast(mpCodeGen.get()) ||
-dynamic_cast(mpCodeGen.get()))
-return GetWindowSize()> 100 &&
-( (GetStartFixed() && GetEndFixed()) ||
-  (!GetStartFixed() && !GetEndFixed())  ) ;
-else
-return false;
-}
-virtual void GenSlidingWindowFunction(std::stringstream &ss) {
-if (!dynamic_cast(mpCodeGen.get())
-&& NeedParallelReduction())
-{
-std::string name = Base::GetName();
-ss << "__kernel void "<IsStartFixed() && mpDVR->IsEndFixed())
-ss << "int offset = 0;\n";
-else if (!mpDVR->IsStartFixed() && !mpDVR->IsEndFixed())
-ss << "int offset = get_group_id(1);\n";
-else
-throw Unhandled();
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "int loop = arrayLength/512 + 1;\n";
-ss << "for (int l=0; lGetBottom() +")",
-std::string(
-"legalize(A[loopOffset + lidx + offset + 256], ")+
-mpCodeGen->GetBottom() +")"
-);
-ss << ";";
-ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = legalize(A[loopOffset + lidx + offset],";
-ss << mpCodeGen->GetBottom() << ");\n";
-ss << "shm_buf[lidx] = tmp;\n";
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "for (int i = 128; i >0; i/=2) {\n";
-ss << "if (lidx < i)\n";
-ss << "shm_buf[lidx] = ";
-ss << mpCodeGen->Gen2("shm_buf[lidx]", "shm_buf[lidx + i]");
-ss << ";";
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "}\n";
-ss << "if (lidx == 0)\n";
-ss << "current_result =";
-ss << mpCodeGen->Gen2("current_result", "shm_buf[0]");
-ss << ";\n";
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "}\n";
-ss << "if (lidx == 0)\n";
-ss << "result[writePos] = current_result;\n";
-ss << "}\n";
-}
- }
 
+virtual void GenSlidingWindowFunction(std::stringstream &) {}
 
 virtual std::string GenSlidingWindowDeclRef(bool=false) const
 {
@@ -519,26 +449,7 @@ public:
 {
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
-if (!dynamic_cast(mpCodeGen.get())
-&& NeedParallelReduction())
-{
-if ((!bIsStartFixed && !bIsEndFixed) ||
-(bIsStartFixed && bIsEndFixed))
-{
-// set 100 as a temporary threshold for invoking reduction
-

[Libreoffice-commits] core.git: sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |  290 +++
 1 file changed, 186 insertions(+), 104 deletions(-)

New commits:
commit 2c39e778873f10037721d844697962dc41e3bcc3
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 16:42:56 2013 -0600

GPU Calc: separate out parallel reduction from DynamicKernelSlidingArgument

Create a new class ParallelReductionVectorRef to straighten out code
generation and marshaling logic between sequential and parallel code
generation alternatives.

Change-Id: Id029ad441f80712f8e7396dcd985e3363ce08ff8

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index abd3230..388605c 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -409,6 +409,7 @@ protected:
 
 /// Handling a Double Vector that is used as a sliding window input
 /// to either a sliding window average or sum-of-products
+/// Generate a sequential loop for reductions
 class OpSum; // Forward Declaration
 class OpAverage; // Forward Declaration
 class OpMin; // Forward Declaration
@@ -430,79 +431,8 @@ public:
 bIsStartFixed = mpDVR->IsStartFixed();
 bIsEndFixed = mpDVR->IsEndFixed();
 }
-virtual bool NeedParallelReduction(void) const
-{
-if ((dynamic_cast(mpCodeGen.get())
-&& !dynamic_cast(mpCodeGen.get())) ||
-dynamic_cast(mpCodeGen.get()) ||
-dynamic_cast(mpCodeGen.get()) ||
-dynamic_cast(mpCodeGen.get()))
-return GetWindowSize()> 100 &&
-( (GetStartFixed() && GetEndFixed()) ||
-  (!GetStartFixed() && !GetEndFixed())  ) ;
-else
-return false;
-}
-virtual void GenSlidingWindowFunction(std::stringstream &ss) {
-if (!dynamic_cast(mpCodeGen.get())
-&& NeedParallelReduction())
-{
-std::string name = Base::GetName();
-ss << "__kernel void "<IsStartFixed() && mpDVR->IsEndFixed())
-ss << "int offset = 0;\n";
-else if (!mpDVR->IsStartFixed() && !mpDVR->IsEndFixed())
-ss << "int offset = get_group_id(1);\n";
-else
-throw Unhandled();
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "int loop = arrayLength/512 + 1;\n";
-ss << "for (int l=0; lGetBottom() +")",
-std::string(
-"legalize(A[loopOffset + lidx + offset + 256], ")+
-mpCodeGen->GetBottom() +")"
-);
-ss << ";";
-ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = legalize(A[loopOffset + lidx + offset],";
-ss << mpCodeGen->GetBottom() << ");\n";
-ss << "shm_buf[lidx] = tmp;\n";
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "for (int i = 128; i >0; i/=2) {\n";
-ss << "if (lidx < i)\n";
-ss << "shm_buf[lidx] = ";
-ss << mpCodeGen->Gen2("shm_buf[lidx]", "shm_buf[lidx + i]");
-ss << ";";
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "}\n";
-ss << "if (lidx == 0)\n";
-ss << "current_result =";
-ss << mpCodeGen->Gen2("current_result", "shm_buf[0]");
-ss << ";\n";
-ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
-ss << "}\n";
-ss << "if (lidx == 0)\n";
-ss << "result[writePos] = current_result;\n";
-ss << "}\n";
-}
- }
 
+virtual void GenSlidingWindowFunction(std::stringstream &) {}
 
 virtual std::string GenSlidingWindowDeclRef(bool=false) const
 {
@@ -519,26 +449,7 @@ public:
 {
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
-if (!dynamic_cast(mpCodeGen.get())
-&& NeedParallelReduction())
-{
-if ((!bIsStartFixed && !bIsEndFixed) ||
-(bIsStartFixed && bIsEndFixed))
-{
-// set 100 as a temporary threshold for invoking reduction
-

[Libreoffice-commits] core.git: sc/source

2013-11-19 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx|   13 ++---
 sc/source/core/opencl/formulagroupcl_public.hxx |1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit d7e4e5d35e66dbfcc30576d198e393661d84f616
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 00:22:23 2013 -0600

GPU Calc: add an inline function to legalize inputs for reduction.

Change-Id: Ibcede4a33d7b8b1073d6ecfb49abbc78b31a2f35

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 037760e..abd3230 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -470,11 +470,18 @@ public:
 ss << "int loopOffset = l*512;\n";
 ss << "if((loopOffset + lidx + offset + 256) < min( offset + 
windowSize, arrayLength))\n";
 ss << "tmp = ";
-ss << mpCodeGen->Gen2("fsum(A[loopOffset + lidx + offset], 0)",
-"fsum(A[loopOffset + lidx + offset + 256], 0)");
+ss << mpCodeGen->Gen2(
+std::string(
+"legalize(A[loopOffset + lidx + offset], ")+
+mpCodeGen->GetBottom() +")",
+std::string(
+"legalize(A[loopOffset + lidx + offset + 256], ")+
+mpCodeGen->GetBottom() +")"
+);
 ss << ";";
 ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = fsum(A[loopOffset + lidx + offset], 0);\n";
+ss << "tmp = legalize(A[loopOffset + lidx + offset],";
+ss << mpCodeGen->GetBottom() << ");\n";
 ss << "shm_buf[lidx] = tmp;\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "for (int i = 128; i >0; i/=2) {\n";
diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index e50de37..ccee5e1 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -12,6 +12,7 @@
 
 const char* publicFunc =
  "int isNan(double a) { return a != a; }\n"
+ "double legalize(double a, double b) { return isNan(a)?b:a; }\n"
  "double fsum(double a, double b) { return isNan(a)?b:a+b; }\n"
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx|   13 ++---
 sc/source/core/opencl/formulagroupcl_public.hxx |1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 77cb1767f723e2a3a07c6cb75ff46bef26eb82db
Author: I-Jui (Ray) Sung 
Date:   Tue Nov 19 00:22:23 2013 -0600

GPU Calc: add an inline function to legalize inputs for reduction.

Change-Id: Ibcede4a33d7b8b1073d6ecfb49abbc78b31a2f35

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 7e61822..2d806aa 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -470,11 +470,18 @@ public:
 ss << "int loopOffset = l*512;\n";
 ss << "if((loopOffset + lidx + offset + 256) < min( offset + 
windowSize, arrayLength))\n";
 ss << "tmp = ";
-ss << mpCodeGen->Gen2("fsum(A[loopOffset + lidx + offset], 0)",
-"fsum(A[loopOffset + lidx + offset + 256], 0)");
+ss << mpCodeGen->Gen2(
+std::string(
+"legalize(A[loopOffset + lidx + offset], ")+
+mpCodeGen->GetBottom() +")",
+std::string(
+"legalize(A[loopOffset + lidx + offset + 256], ")+
+mpCodeGen->GetBottom() +")"
+);
 ss << ";";
 ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = fsum(A[loopOffset + lidx + offset], 0);\n";
+ss << "tmp = legalize(A[loopOffset + lidx + offset],";
+ss << mpCodeGen->GetBottom() << ");\n";
 ss << "shm_buf[lidx] = tmp;\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "for (int i = 128; i >0; i/=2) {\n";
diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index e50de37..ccee5e1 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -12,6 +12,7 @@
 
 const char* publicFunc =
  "int isNan(double a) { return a != a; }\n"
+ "double legalize(double a, double b) { return isNan(a)?b:a; }\n"
  "double fsum(double a, double b) { return isNan(a)?b:a+b; }\n"
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |  246 ++-
 1 file changed, 240 insertions(+), 6 deletions(-)

New commits:
commit 71f3f362fd857f5b8095ca24217fe98560e7c0ae
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 23:19:15 2013 -0600

GPU Calc: unrolling of sequential reduction loops for DoubleVectorRefs

Change-Id: I749da2d08a09ead56f0b151a317052b8960926ca

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 4946dfd..037760e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -41,6 +41,8 @@
 
 #include 
 
+#define UNROLLING
+
 using namespace formula;
 
 namespace sc { namespace opencl {
@@ -435,7 +437,7 @@ public:
 dynamic_cast(mpCodeGen.get()) ||
 dynamic_cast(mpCodeGen.get()) ||
 dynamic_cast(mpCodeGen.get()))
-return GetWindowSize()> 4 &&
+return GetWindowSize()> 100 &&
 ( (GetStartFixed() && GetEndFixed()) ||
   (!GetStartFixed() && !GetEndFixed())  ) ;
 else
@@ -529,8 +531,9 @@ public:
 }
 }
 }
+// original for loop
+#ifndef UNROLLING
 needBody = true;
-
 // No need to generate a for-loop for degenerated cases
 if (nCurWindowSize == 1)
 {
@@ -573,9 +576,132 @@ public:
 std::min(mpDVR->GetArrayLength(), nCurWindowSize);
 ss << "0; i < "<< limit << "; i++){\n\t\t";
 }
+return nCurWindowSize;
+#endif
 
-return nCurWindowSize;
-}
+
+
+#ifdef UNROLLING
+{
+if (!mpDVR->IsStartFixed() && mpDVR->IsEndFixed()) {
+ss << "for (int i = ";
+ss << "gid0; i < " << mpDVR->GetArrayLength();
+ss << " && i < " << nCurWindowSize  << "; i++){\n\t\t";
+needBody = true;
+return nCurWindowSize;
+} else if (mpDVR->IsStartFixed() && !mpDVR->IsEndFixed()) {
+ss << "for (int i = ";
+ss << "0; i < " << mpDVR->GetArrayLength();
+ss << " && i < gid0+"<< nCurWindowSize << "; i++){\n\t\t";
+needBody = true;
+return nCurWindowSize;
+} else if (!mpDVR->IsStartFixed() && !mpDVR->IsEndFixed()){
+ss << "tmpBottom = " << mpCodeGen->GetBottom() << ";\n\t";
+ss << "{int i;\n\t";
+std::stringstream temp1,temp2;
+int outLoopSize = 16;
+if ( nCurWindowSize/outLoopSize != 0){
+ss << "for(int outLoop=0; outLoop<" << 
nCurWindowSize/outLoopSize<< "; outLoop++){\n\t";
+for(int count=0; count < outLoopSize; count++){
+ss << "i = outLoop*"<GetArrayLength();
+temp1 << "){\n\t\t";
+temp1 << "if (isNan(";
+temp1 <<  GenSlidingWindowDeclRef();
+temp1 << ")){\n\t\t\t";
+temp1 << "tmp = ";
+temp1 <<  mpCodeGen->Gen2("tmpBottom", "tmp") << 
";\n\t\t";
+temp1 << "}else{\n\t\t\t";
+temp1 << "tmp = ";
+temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
+temp1 << ";\n\t\t\t";
+temp1 << "nCount += 1;\n\t\t";
+temp1 << "}\n\t";
+temp1 << "}\n\t";
+}
+ss << temp1.str();
+}
+ss << "}\n\t";
+}
+// The residual of mod outLoopSize
+for(unsigned int count=nCurWindowSize/outLoopSize*outLoopSize; 
count < nCurWindowSize; count++){
+ss << "i = "<GetArrayLength();
+temp2 << "){\n\t\t";
+temp2 << "if (isNan(";
+temp2 << GenSlidingWindowDeclRef();
+temp2 << ")){\n\t\t\t";
+temp2 <&l

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |  246 ++-
 1 file changed, 240 insertions(+), 6 deletions(-)

New commits:
commit d8b52aa7bc79bb2663841d040629aae97710c87a
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 23:19:15 2013 -0600

GPU Calc: unrolling of sequential reduction loops for DoubleVectorRefs

Change-Id: I749da2d08a09ead56f0b151a317052b8960926ca

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index c518cf4..7e61822 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -41,6 +41,8 @@
 
 #include 
 
+#define UNROLLING
+
 using namespace formula;
 
 namespace sc { namespace opencl {
@@ -435,7 +437,7 @@ public:
 dynamic_cast(mpCodeGen.get()) ||
 dynamic_cast(mpCodeGen.get()) ||
 dynamic_cast(mpCodeGen.get()))
-return GetWindowSize()> 4 &&
+return GetWindowSize()> 100 &&
 ( (GetStartFixed() && GetEndFixed()) ||
   (!GetStartFixed() && !GetEndFixed())  ) ;
 else
@@ -529,8 +531,9 @@ public:
 }
 }
 }
+// original for loop
+#ifndef UNROLLING
 needBody = true;
-
 // No need to generate a for-loop for degenerated cases
 if (nCurWindowSize == 1)
 {
@@ -573,9 +576,132 @@ public:
 std::min(mpDVR->GetArrayLength(), nCurWindowSize);
 ss << "0; i < "<< limit << "; i++){\n\t\t";
 }
+return nCurWindowSize;
+#endif
 
-return nCurWindowSize;
-}
+
+
+#ifdef UNROLLING
+{
+if (!mpDVR->IsStartFixed() && mpDVR->IsEndFixed()) {
+ss << "for (int i = ";
+ss << "gid0; i < " << mpDVR->GetArrayLength();
+ss << " && i < " << nCurWindowSize  << "; i++){\n\t\t";
+needBody = true;
+return nCurWindowSize;
+} else if (mpDVR->IsStartFixed() && !mpDVR->IsEndFixed()) {
+ss << "for (int i = ";
+ss << "0; i < " << mpDVR->GetArrayLength();
+ss << " && i < gid0+"<< nCurWindowSize << "; i++){\n\t\t";
+needBody = true;
+return nCurWindowSize;
+} else if (!mpDVR->IsStartFixed() && !mpDVR->IsEndFixed()){
+ss << "tmpBottom = " << mpCodeGen->GetBottom() << ";\n\t";
+ss << "{int i;\n\t";
+std::stringstream temp1,temp2;
+int outLoopSize = 16;
+if ( nCurWindowSize/outLoopSize != 0){
+ss << "for(int outLoop=0; outLoop<" << 
nCurWindowSize/outLoopSize<< "; outLoop++){\n\t";
+for(int count=0; count < outLoopSize; count++){
+ss << "i = outLoop*"<GetArrayLength();
+temp1 << "){\n\t\t";
+temp1 << "if (isNan(";
+temp1 <<  GenSlidingWindowDeclRef();
+temp1 << ")){\n\t\t\t";
+temp1 << "tmp = ";
+temp1 <<  mpCodeGen->Gen2("tmpBottom", "tmp") << 
";\n\t\t";
+temp1 << "}else{\n\t\t\t";
+temp1 << "tmp = ";
+temp1 <<  
mpCodeGen->Gen2(GenSlidingWindowDeclRef(), "tmp");
+temp1 << ";\n\t\t\t";
+temp1 << "nCount += 1;\n\t\t";
+temp1 << "}\n\t";
+temp1 << "}\n\t";
+}
+ss << temp1.str();
+}
+ss << "}\n\t";
+}
+// The residual of mod outLoopSize
+for(unsigned int count=nCurWindowSize/outLoopSize*outLoopSize; 
count < nCurWindowSize; count++){
+ss << "i = "<GetArrayLength();
+temp2 << "){\n\t\t";
+temp2 << "if (isNan(";
+temp2 << GenSlidingWindowDeclRef();
+temp2 << ")){\n\t\t\t";
+temp2 <&l

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx|6 --
 sc/source/core/opencl/formulagroupcl_public.hxx |8 
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 4b02e8daed896714962bd8fcbe592bebd94a76bd
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 19:26:48 2013 -0600

GPU Calc: add compile time option for using fmin/fmax intrinsics

Change-Id: I791d6c8f4335ab2c2618529f2e3d22d59c4f0b5a

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 46c8224..c518cf4 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -24,6 +24,8 @@
 #include "op_logical.hxx"
 #include "op_statistical.hxx"
 #include "op_array.hxx"
+// Comment out this to turn off FMIN and FMAX intrinsics
+#define USE_FMIN_FMAX 1
 #include "formulagroupcl_public.hxx"
 
 #include 
@@ -1038,7 +1040,7 @@ public:
 virtual std::string GetBottom(void) { return "MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "fmin("+lhs + "," + rhs +")";
+return "mcw_fmin("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "min"; }
 };
@@ -1048,7 +1050,7 @@ public:
 virtual std::string GetBottom(void) { return "-MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "fmax("+lhs + "," + rhs +")";
+return "mcw_fmax("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "max"; }
 };
diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index 996c898..e50de37 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -16,6 +16,14 @@ const char* publicFunc =
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
  "double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n"
+#ifdef USE_FMIN_FMAX
+ "double mcw_fmin(double a, double b) { return fmin(a, b); }\n"
+ "double mcw_fmax(double a, double b) { return fmax(a, b); }\n"
+#else
+ "double mcw_fmin(double a, double b) { return a>b?b:a; }\n"
+ "double mcw_fmax(double a, double b) { return a>b?a:b; }\n"
+#endif
+
  ;
 
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx|6 --
 sc/source/core/opencl/formulagroupcl_public.hxx |8 
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit b09356c2719947b0a5a112e0c9edc11995c75abb
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 19:26:48 2013 -0600

GPU Calc: add compile time option for using fmin/fmax intrinsics

Change-Id: I791d6c8f4335ab2c2618529f2e3d22d59c4f0b5a

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 8c1f42b..4946dfd 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -24,6 +24,8 @@
 #include "op_logical.hxx"
 #include "op_statistical.hxx"
 #include "op_array.hxx"
+// Comment out this to turn off FMIN and FMAX intrinsics
+#define USE_FMIN_FMAX 1
 #include "formulagroupcl_public.hxx"
 
 #include 
@@ -1038,7 +1040,7 @@ public:
 virtual std::string GetBottom(void) { return "MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "fmin("+lhs + "," + rhs +")";
+return "mcw_fmin("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "min"; }
 };
@@ -1048,7 +1050,7 @@ public:
 virtual std::string GetBottom(void) { return "-MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "fmax("+lhs + "," + rhs +")";
+return "mcw_fmax("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "max"; }
 };
diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index 996c898..e50de37 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -16,6 +16,14 @@ const char* publicFunc =
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
  "double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n"
+#ifdef USE_FMIN_FMAX
+ "double mcw_fmin(double a, double b) { return fmin(a, b); }\n"
+ "double mcw_fmax(double a, double b) { return fmax(a, b); }\n"
+#else
+ "double mcw_fmin(double a, double b) { return a>b?b:a; }\n"
+ "double mcw_fmax(double a, double b) { return a>b?a:b; }\n"
+#endif
+
  ;
 
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   35 ---
 1 file changed, 23 insertions(+), 12 deletions(-)

New commits:
commit 6a31821484464565a11e579c619c80598532be82
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 18:28:34 2013 -0600

GPU Calc: enables parallel min/max reduction

Change-Id: I86e0b40d284a1bfe7414f02333c616556d6d568c

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 17f4afb..46c8224 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -407,6 +407,8 @@ protected:
 /// to either a sliding window average or sum-of-products
 class OpSum; // Forward Declaration
 class OpAverage; // Forward Declaration
+class OpMin; // Forward Declaration
+class OpMax; // Forward Declaration
 template
 class DynamicKernelSlidingArgument: public Base
 {
@@ -428,6 +430,8 @@ public:
 {
 if ((dynamic_cast(mpCodeGen.get())
 && !dynamic_cast(mpCodeGen.get())) ||
+dynamic_cast(mpCodeGen.get()) ||
+dynamic_cast(mpCodeGen.get()) ||
 dynamic_cast(mpCodeGen.get()))
 return GetWindowSize()> 4 &&
 ( (GetStartFixed() && GetEndFixed()) ||
@@ -436,13 +440,16 @@ public:
 return false;
 }
 virtual void GenSlidingWindowFunction(std::stringstream &ss) {
-if (dynamic_cast(mpCodeGen.get()) && NeedParallelReduction())
+if (!dynamic_cast(mpCodeGen.get())
+&& NeedParallelReduction())
 {
 std::string name = Base::GetName();
 ss << "__kernel void "<0; i/=2) {\n";
 ss << "if (lidx < i)\n";
-ss << "shm_buf[lidx] += shm_buf[lidx + i];\n";
+ss << "shm_buf[lidx] = ";
+ss << mpCodeGen->Gen2("shm_buf[lidx]", "shm_buf[lidx + i]");
+ss << ";";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "}\n";
 ss << "if (lidx == 0)\n";
-ss << "current_result += shm_buf[0];\n";
+ss << "current_result =";
+ss << mpCodeGen->Gen2("current_result", "shm_buf[0]");
+ss << ";\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "}\n";
 ss << "if (lidx == 0)\n";
@@ -495,7 +508,8 @@ public:
 {
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
-if (dynamic_cast(mpCodeGen.get()))
+if (!dynamic_cast(mpCodeGen.get())
+&& NeedParallelReduction())
 {
 if ((!bIsStartFixed && !bIsEndFixed) ||
 (bIsStartFixed && bIsEndFixed))
@@ -589,10 +603,7 @@ public:
 if (CL_SUCCESS != err)
 throw OpenCLError(err);
 // reproduce the reduction function name
-std::string kernelName;
-if (dynamic_cast(mpCodeGen.get()))
-kernelName = Base::GetName() + "_reduction";
-else throw Unhandled();
+std::string kernelName = Base::GetName() + "_reduction";
 
 cl_kernel redKernel = clCreateKernel(mpProgram, kernelName.c_str(), 
&err);
 if (err != CL_SUCCESS)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   35 ---
 1 file changed, 23 insertions(+), 12 deletions(-)

New commits:
commit 0e52d87cb05f4307f64c0508e1afa47981fb0eae
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 18:28:34 2013 -0600

GPU Calc: enables parallel min/max reduction

Change-Id: I86e0b40d284a1bfe7414f02333c616556d6d568c

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 9d1e2a9..8c1f42b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -407,6 +407,8 @@ protected:
 /// to either a sliding window average or sum-of-products
 class OpSum; // Forward Declaration
 class OpAverage; // Forward Declaration
+class OpMin; // Forward Declaration
+class OpMax; // Forward Declaration
 template
 class DynamicKernelSlidingArgument: public Base
 {
@@ -428,6 +430,8 @@ public:
 {
 if ((dynamic_cast(mpCodeGen.get())
 && !dynamic_cast(mpCodeGen.get())) ||
+dynamic_cast(mpCodeGen.get()) ||
+dynamic_cast(mpCodeGen.get()) ||
 dynamic_cast(mpCodeGen.get()))
 return GetWindowSize()> 4 &&
 ( (GetStartFixed() && GetEndFixed()) ||
@@ -436,13 +440,16 @@ public:
 return false;
 }
 virtual void GenSlidingWindowFunction(std::stringstream &ss) {
-if (dynamic_cast(mpCodeGen.get()) && NeedParallelReduction())
+if (!dynamic_cast(mpCodeGen.get())
+&& NeedParallelReduction())
 {
 std::string name = Base::GetName();
 ss << "__kernel void "<0; i/=2) {\n";
 ss << "if (lidx < i)\n";
-ss << "shm_buf[lidx] += shm_buf[lidx + i];\n";
+ss << "shm_buf[lidx] = ";
+ss << mpCodeGen->Gen2("shm_buf[lidx]", "shm_buf[lidx + i]");
+ss << ";";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "}\n";
 ss << "if (lidx == 0)\n";
-ss << "current_result += shm_buf[0];\n";
+ss << "current_result =";
+ss << mpCodeGen->Gen2("current_result", "shm_buf[0]");
+ss << ";\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "}\n";
 ss << "if (lidx == 0)\n";
@@ -495,7 +508,8 @@ public:
 {
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
-if (dynamic_cast(mpCodeGen.get()))
+if (!dynamic_cast(mpCodeGen.get())
+&& NeedParallelReduction())
 {
 if ((!bIsStartFixed && !bIsEndFixed) ||
 (bIsStartFixed && bIsEndFixed))
@@ -589,10 +603,7 @@ public:
 if (CL_SUCCESS != err)
 throw OpenCLError(err);
 // reproduce the reduction function name
-std::string kernelName;
-if (dynamic_cast(mpCodeGen.get()))
-kernelName = Base::GetName() + "_reduction";
-else throw Unhandled();
+std::string kernelName = Base::GetName() + "_reduction";
 
 cl_kernel redKernel = clCreateKernel(mpProgram, kernelName.c_str(), 
&err);
 if (err != CL_SUCCESS)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 3 commits - sc/qa sc/source

2013-11-18 Thread Ray
 sc/qa/unit/data/ods/opencl/compiler/horizontal.ods |binary
 sc/qa/unit/opencl-test.cxx |   32 +++
 sc/source/core/opencl/formulagroupcl.cxx   |   88 ++---
 sc/source/core/opencl/opbase.cxx   |   12 ++
 sc/source/core/opencl/opbase.hxx   |7 -
 5 files changed, 90 insertions(+), 49 deletions(-)

New commits:
commit 41bbf04a5a9cdfc1984e436626222cd806a48a3d
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 15:05:25 2013 -0600

GPU Calc: turn on parallel sumifs and parallel sum reduce

Change-Id: Id615ea0f5f16a4dfc517aacb30715c2df84553e3

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 224ed49..17f4afb 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -426,9 +426,10 @@ public:
 }
 virtual bool NeedParallelReduction(void) const
 {
-if (dynamic_cast(mpCodeGen.get())
-&& !dynamic_cast(mpCodeGen.get()))
-return GetWindowSize()> 100 &&
+if ((dynamic_cast(mpCodeGen.get())
+&& !dynamic_cast(mpCodeGen.get())) ||
+dynamic_cast(mpCodeGen.get()))
+return GetWindowSize()> 4 &&
 ( (GetStartFixed() && GetEndFixed()) ||
   (!GetStartFixed() && !GetEndFixed())  ) ;
 else
@@ -457,10 +458,10 @@ public:
 ss << "tmp = 0.0;\n";
 ss << "int loopOffset = l*512;\n";
 ss << "if((loopOffset + lidx + offset + 256) < min( offset + 
windowSize, arrayLength))\n";
-ss << "tmp = A[loopOffset + lidx + offset] + "
-"A[loopOffset + lidx + offset + 256];\n";
+ss << "tmp = fsum(A[loopOffset + lidx + offset], 0) + "
+"fsum(A[loopOffset + lidx + offset + 256], 0);\n";
 ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = A[loopOffset + lidx + offset];\n";
+ss << "tmp = fsum(A[loopOffset + lidx + offset], 0);\n";
 ss << "shm_buf[lidx] = tmp;\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "for (int i = 128; i >0; i/=2) {\n";
@@ -496,7 +497,8 @@ public:
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
 if (dynamic_cast(mpCodeGen.get()))
 {
-if (!bIsStartFixed && !bIsEndFixed)
+if ((!bIsStartFixed && !bIsEndFixed) ||
+(bIsStartFixed && bIsEndFixed))
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
@@ -510,21 +512,6 @@ public:
 return nCurWindowSize;
 }
 }
-
-if (bIsStartFixed && bIsEndFixed)
-{
-// set 100 as a temporary threshold for invoking reduction
-// kernel in NeedParalleLReduction function
-if (NeedParallelReduction())
-{
-std::string temp = Base::GetName() + "[0]";
-ss << "tmp = ";
-ss << mpCodeGen->Gen2(temp, "tmp");
-ss << ";\n\t";
-needBody = false;
-return nCurWindowSize;
-}
-}
 }
 needBody = true;
 
@@ -576,7 +563,8 @@ public:
 
 virtual size_t Marshal(cl_kernel k, int argno, int w, cl_program mpProgram)
 {
-if (!NeedParallelReduction())
+if (!NeedParallelReduction() ||
+dynamic_cast(mpCodeGen.get()))
 return Base::Marshal(k, argno, w, mpProgram);
 
 assert(Base::mpClmem == NULL);
commit c277e98f9ce1b57794311ef45aca734b8d4dee85
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 13:39:02 2013 -0600

GPU Calc: testcases for horizontal ranges

AMLOEXT-242 BUG

Change-Id: I4b87bdf6183ed81ad767550f5cd49aab51531cf2

diff --git a/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods 
b/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods
new file mode 100644
index 000..18edf64
Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index b2d4b87..86a73b0 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -83,6 +83,7 @@ public:
 void testFinacialRateFormula();
 void testFinancialAccrintmFormula();
 void testFinancialAccrintFo

[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source

2013-11-18 Thread Ray
 sc/qa/unit/data/ods/opencl/compiler/horizontal.ods |binary
 sc/qa/unit/opencl-test.cxx |   32 +++
 sc/source/core/opencl/formulagroupcl.cxx   |   88 ++---
 sc/source/core/opencl/opbase.cxx   |   12 ++
 sc/source/core/opencl/opbase.hxx   |7 -
 5 files changed, 90 insertions(+), 49 deletions(-)

New commits:
commit 912d23636a55473221e3e35768fb9ac42c3e9b76
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 15:05:25 2013 -0600

GPU Calc: turn on parallel sumifs and parallel sum reduce

Change-Id: Id615ea0f5f16a4dfc517aacb30715c2df84553e3

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 3a63c92..9d1e2a9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -426,9 +426,10 @@ public:
 }
 virtual bool NeedParallelReduction(void) const
 {
-if (dynamic_cast(mpCodeGen.get())
-&& !dynamic_cast(mpCodeGen.get()))
-return GetWindowSize()> 100 &&
+if ((dynamic_cast(mpCodeGen.get())
+&& !dynamic_cast(mpCodeGen.get())) ||
+dynamic_cast(mpCodeGen.get()))
+return GetWindowSize()> 4 &&
 ( (GetStartFixed() && GetEndFixed()) ||
   (!GetStartFixed() && !GetEndFixed())  ) ;
 else
@@ -457,10 +458,10 @@ public:
 ss << "tmp = 0.0;\n";
 ss << "int loopOffset = l*512;\n";
 ss << "if((loopOffset + lidx + offset + 256) < min( offset + 
windowSize, arrayLength))\n";
-ss << "tmp = A[loopOffset + lidx + offset] + "
-"A[loopOffset + lidx + offset + 256];\n";
+ss << "tmp = fsum(A[loopOffset + lidx + offset], 0) + "
+"fsum(A[loopOffset + lidx + offset + 256], 0);\n";
 ss << "else if ((loopOffset + lidx + offset) < min(offset + 
windowSize, arrayLength))\n";
-ss << "tmp = A[loopOffset + lidx + offset];\n";
+ss << "tmp = fsum(A[loopOffset + lidx + offset], 0);\n";
 ss << "shm_buf[lidx] = tmp;\n";
 ss << "barrier(CLK_LOCAL_MEM_FENCE);\n";
 ss << "for (int i = 128; i >0; i/=2) {\n";
@@ -496,7 +497,8 @@ public:
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
 if (dynamic_cast(mpCodeGen.get()))
 {
-if (!bIsStartFixed && !bIsEndFixed)
+if ((!bIsStartFixed && !bIsEndFixed) ||
+(bIsStartFixed && bIsEndFixed))
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
@@ -510,21 +512,6 @@ public:
 return nCurWindowSize;
 }
 }
-
-if (bIsStartFixed && bIsEndFixed)
-{
-// set 100 as a temporary threshold for invoking reduction
-// kernel in NeedParalleLReduction function
-if (NeedParallelReduction())
-{
-std::string temp = Base::GetName() + "[0]";
-ss << "tmp = ";
-ss << mpCodeGen->Gen2(temp, "tmp");
-ss << ";\n\t";
-needBody = false;
-return nCurWindowSize;
-}
-}
 }
 needBody = true;
 
@@ -576,7 +563,8 @@ public:
 
 virtual size_t Marshal(cl_kernel k, int argno, int w, cl_program mpProgram)
 {
-if (!NeedParallelReduction())
+if (!NeedParallelReduction() ||
+dynamic_cast(mpCodeGen.get()))
 return Base::Marshal(k, argno, w, mpProgram);
 
 assert(Base::mpClmem == NULL);
commit af223ecdf01b76bc1005c8fcc342165639a8823f
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 13:39:02 2013 -0600

GPU Calc: testcases for horizontal ranges

AMLOEXT-242 BUG

Change-Id: I4b87bdf6183ed81ad767550f5cd49aab51531cf2

diff --git a/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods 
b/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods
new file mode 100644
index 000..18edf64
Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 3f90040..3f02d9b 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -81,6 +81,7 @@ public:
 void testFinacialRateFormula();
 void testFinancialAccrintmFormula();
 void testFinancialAccrintFo

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 9a28c1537c8687b72a4e89b80ed18ea46d77757e
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 03:09:24 2013 -0600

GPU Calc: re-enable parallel sum reduction after fixing regressions

Change-Id: Id274575e731c413e8e9b808ae5e651efe10f7b03

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 1594075..f6e6baf 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -405,6 +405,7 @@ protected:
 /// Handling a Double Vector that is used as a sliding window input
 /// to either a sliding window average or sum-of-products
 class OpSum; // Forward Declaration
+class OpAverage; // Forward Declaration
 template
 class DynamicKernelSlidingArgument: public Base
 {
@@ -423,9 +424,13 @@ public:
 }
 virtual bool NeedParallelReduction(void) const
 {
-return GetWindowSize()> 100 &&
-( (GetStartFixed() && GetEndFixed()) ||
-  (!GetStartFixed() && !GetEndFixed())  ) ;
+if (dynamic_cast(mpCodeGen.get())
+&& !dynamic_cast(mpCodeGen.get()))
+return GetWindowSize()> 100 &&
+( (GetStartFixed() && GetEndFixed()) ||
+  (!GetStartFixed() && !GetEndFixed())  ) ;
+else
+return false;
 }
 virtual void GenSlidingWindowFunction(std::stringstream &ss) {
 if (dynamic_cast(mpCodeGen.get()) && NeedParallelReduction())
@@ -496,7 +501,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (/*NeedParallelReduction()*/false)
+if (NeedParallelReduction())
 {
 std::string temp = Base::GetName() + "[gid0]";
 ss << "tmp = ";
@@ -511,7 +516,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (NeedParallelReduction()&&false)
+if (NeedParallelReduction())
 {
 std::string temp = Base::GetName() + "[0]";
 ss << "tmp = ";
@@ -563,7 +568,7 @@ public:
 
 virtual size_t Marshal(cl_kernel k, int argno, int w, cl_program mpProgram)
 {
-if (!NeedParallelReduction() || true)
+if (!NeedParallelReduction())
 return Base::Marshal(k, argno, w, mpProgram);
 
 assert(Base::mpClmem == NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-18 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit dc113e8a86e9904df8f37a2980db39cbabcea78f
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 03:09:24 2013 -0600

GPU Calc: re-enable parallel sum reduction after fixing regressions

Change-Id: Id274575e731c413e8e9b808ae5e651efe10f7b03

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index d2a6d8b..a863c94 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -405,6 +405,7 @@ protected:
 /// Handling a Double Vector that is used as a sliding window input
 /// to either a sliding window average or sum-of-products
 class OpSum; // Forward Declaration
+class OpAverage; // Forward Declaration
 template
 class DynamicKernelSlidingArgument: public Base
 {
@@ -423,9 +424,13 @@ public:
 }
 virtual bool NeedParallelReduction(void) const
 {
-return GetWindowSize()> 100 &&
-( (GetStartFixed() && GetEndFixed()) ||
-  (!GetStartFixed() && !GetEndFixed())  ) ;
+if (dynamic_cast(mpCodeGen.get())
+&& !dynamic_cast(mpCodeGen.get()))
+return GetWindowSize()> 100 &&
+( (GetStartFixed() && GetEndFixed()) ||
+  (!GetStartFixed() && !GetEndFixed())  ) ;
+else
+return false;
 }
 virtual void GenSlidingWindowFunction(std::stringstream &ss) {
 if (dynamic_cast(mpCodeGen.get()) && NeedParallelReduction())
@@ -496,7 +501,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (/*NeedParallelReduction()*/false)
+if (NeedParallelReduction())
 {
 std::string temp = Base::GetName() + "[gid0]";
 ss << "tmp = ";
@@ -511,7 +516,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (NeedParallelReduction()&&false)
+if (NeedParallelReduction())
 {
 std::string temp = Base::GetName() + "[0]";
 ss << "tmp = ";
@@ -563,7 +568,7 @@ public:
 
 virtual size_t Marshal(cl_kernel k, int argno, int w, cl_program mpProgram)
 {
-if (!NeedParallelReduction() || true)
+if (!NeedParallelReduction())
 return Base::Marshal(k, argno, w, mpProgram);
 
 assert(Base::mpClmem == NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 47eea0af3e93eeced7280f97545188d92fe94480
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 00:24:31 2013 -0600

GPU Calc: fall back to SW interp for unsupported double vector variants

For cases like DoubleVectorRef::GetArrays() containing more than one array.

Change-Id: I5111a731301bb43b8dbcd1156d964dca231fe840

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 9a97234..1594075 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -486,6 +486,9 @@ public:
 std::stringstream &ss, bool &needBody)
 {
 assert(mpDVR);
+// Do not handle horizontal double vectors yet
+if (mpDVR->GetArrays().size() > 1)
+throw Unhandled();
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
 if (dynamic_cast(mpCodeGen.get()))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit d00e0bcd60304835f5c10a71b22b6a4f483dd6ec
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 00:24:31 2013 -0600

GPU Calc: fall back to SW interp for unsupported double vector variants

For cases like DoubleVectorRef::GetArrays() containing more than one array.

Change-Id: I5111a731301bb43b8dbcd1156d964dca231fe840

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index b5fedc6..d2a6d8b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -486,6 +486,9 @@ public:
 std::stringstream &ss, bool &needBody)
 {
 assert(mpDVR);
+// Do not handle horizontal double vectors yet
+if (mpDVR->GetArrays().size() > 1)
+throw Unhandled();
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
 if (dynamic_cast(mpCodeGen.get()))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 216b61c16acc8c5366af4e7dd8118e2140d37371
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 00:13:13 2013 -0600

GPU Calc: fix regression caused by reduction

Change-Id: I077d400f9cc83a60edd3374cce0f69f27872298f

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 9a51af6..9a97234 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -560,7 +560,7 @@ public:
 
 virtual size_t Marshal(cl_kernel k, int argno, int w, cl_program mpProgram)
 {
-if (!NeedParallelReduction())
+if (!NeedParallelReduction() || true)
 return Base::Marshal(k, argno, w, mpProgram);
 
 assert(Base::mpClmem == NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 547750e8c2d001f92e3e303ebfda9b395538e741
Author: I-Jui (Ray) Sung 
Date:   Mon Nov 18 00:13:13 2013 -0600

GPU Calc: fix regression caused by reduction

Change-Id: I077d400f9cc83a60edd3374cce0f69f27872298f

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 93da20d..b5fedc6 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -560,7 +560,7 @@ public:
 
 virtual size_t Marshal(cl_kernel k, int argno, int w, cl_program mpProgram)
 {
-if (!NeedParallelReduction())
+if (!NeedParallelReduction() || true)
 return Base::Marshal(k, argno, w, mpProgram);
 
 assert(Base::mpClmem == NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 12026388fab146e3384f1ed00d1d9018795e18b0
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 17 23:23:42 2013 -0600

GPU Calc: fix building error on Windows

Change-Id: I4a7e02c24f8bdf9fc4fb66504ed3b6b09f34

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index fd4be3f..9a51af6 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -493,7 +493,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (NeedParallelReduction())
+if (/*NeedParallelReduction()*/false)
 {
 std::string temp = Base::GetName() + "[gid0]";
 ss << "tmp = ";
@@ -508,7 +508,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (NeedParallelReduction())
+if (NeedParallelReduction()&&false)
 {
 std::string temp = Base::GetName() + "[0]";
 ss << "tmp = ";
@@ -550,11 +550,9 @@ public:
 }
 else
 {
-#ifdef  ISNAN
-ss << "0; i < "<< nCurWindowSize << "; i++){\n\t\t";
-#else
-ss << "0; i < "<< nCurWindowSize << "; i++)\n\t\t";
-#endif
+unsigned limit =
+std::min(mpDVR->GetArrayLength(), nCurWindowSize);
+ss << "0; i < "<< limit << "; i++){\n\t\t";
 }
 
 return nCurWindowSize;
@@ -1074,8 +1072,8 @@ public:
 KernelEnv kEnv;
 OpenclDevice::setKernelEnv(&kEnv);
 cl_int err;
-DynamicKernelSlidingArgument *slidingArgPtr 
=
-dynamic_cast< 
DynamicKernelSlidingArgument *>
+DynamicKernelSlidingArgument *slidingArgPtr =
+dynamic_cast< DynamicKernelSlidingArgument *>
 (mvSubArguments[0].get());
 cl_mem mpClmem2;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 6fd82243e26af3cace74beeb2193c40f39b84bc2
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 17 23:23:42 2013 -0600

GPU Calc: fix building error on Windows

Change-Id: I4a7e02c24f8bdf9fc4fb66504ed3b6b09f34

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index d5f7f0f..93da20d 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -493,7 +493,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (NeedParallelReduction())
+if (/*NeedParallelReduction()*/false)
 {
 std::string temp = Base::GetName() + "[gid0]";
 ss << "tmp = ";
@@ -508,7 +508,7 @@ public:
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
-if (NeedParallelReduction())
+if (NeedParallelReduction()&&false)
 {
 std::string temp = Base::GetName() + "[0]";
 ss << "tmp = ";
@@ -550,11 +550,9 @@ public:
 }
 else
 {
-#ifdef  ISNAN
-ss << "0; i < "<< nCurWindowSize << "; i++){\n\t\t";
-#else
-ss << "0; i < "<< nCurWindowSize << "; i++)\n\t\t";
-#endif
+unsigned limit =
+std::min(mpDVR->GetArrayLength(), nCurWindowSize);
+ss << "0; i < "<< limit << "; i++){\n\t\t";
 }
 
 return nCurWindowSize;
@@ -1074,8 +1072,8 @@ public:
 KernelEnv kEnv;
 OpenclDevice::setKernelEnv(&kEnv);
 cl_int err;
-DynamicKernelSlidingArgument *slidingArgPtr 
=
-dynamic_cast< 
DynamicKernelSlidingArgument *>
+DynamicKernelSlidingArgument *slidingArgPtr =
+dynamic_cast< DynamicKernelSlidingArgument *>
 (mvSubArguments[0].get());
 cl_mem mpClmem2;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   48 +++-
 sc/source/core/opencl/opbase.cxx |   53 +++
 sc/source/core/opencl/opbase.hxx |   53 +--
 3 files changed, 96 insertions(+), 58 deletions(-)

New commits:
commit 434d445a93910f1745b140a5212198a452925dc6
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 17 22:33:50 2013 -0600

GPU Calc: refactor: separate VectorRef out of DynamicKernelArgument

Now DynamicKernelArgument is more an abstract base.

Change-Id: Icc70fa9fe4ed2db3c5483099d99584ba30ac38f6

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index a25f729..d5f7f0f 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -45,7 +45,7 @@ namespace sc { namespace opencl {
 
 
 /// Map the buffer used by an argument and do necessary argument setting
-size_t DynamicKernelArgument::Marshal(cl_kernel k, int argno, int, cl_program)
+size_t VectorRef::Marshal(cl_kernel k, int argno, int, cl_program)
 {
 FormulaToken *ref = mFormulaTree->GetFormulaToken();
 assert(mpClmem == NULL);
@@ -129,7 +129,6 @@ public:
 virtual size_t Marshal(cl_kernel k, int argno, int, cl_program)
 {
 FormulaToken *ref = mFormulaTree->GetFormulaToken();
-assert(mpClmem == NULL);
 cl_uint hashCode = 0;
 if (ref->GetType() == formula::svString)
 {
@@ -277,12 +276,13 @@ public:
 }
 };
 
-class DynamicKernelStringArgument: public DynamicKernelArgument
+/// A vector of strings
+class DynamicKernelStringArgument: public VectorRef
 {
 public:
 DynamicKernelStringArgument(const std::string &s,
 FormulaTreeNodeRef ft):
-DynamicKernelArgument(s, ft) {}
+VectorRef(s, ft) {}
 
 virtual void GenSlidingWindowFunction(std::stringstream &) {}
 /// Generate declaration
@@ -357,15 +357,15 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int, cl_prog
 }
 
 /// A mixed string/numberic vector
-class DynamicKernelMixedArgument: public DynamicKernelArgument
+class DynamicKernelMixedArgument: public VectorRef
 {
 public:
 DynamicKernelMixedArgument(const std::string &s,
 FormulaTreeNodeRef ft):
-DynamicKernelArgument(s, ft), mStringArgument(s+"s", ft) {}
+VectorRef(s, ft), mStringArgument(s+"s", ft) {}
 virtual void GenSlidingWindowDecl(std::stringstream& ss) const
 {
-DynamicKernelArgument::GenSlidingWindowDecl(ss);
+VectorRef::GenSlidingWindowDecl(ss);
 ss << ", ";
 mStringArgument.GenSlidingWindowDecl(ss);
 }
@@ -373,28 +373,28 @@ public:
 /// Generate declaration
 virtual void GenDecl(std::stringstream &ss) const
 {
-DynamicKernelArgument::GenDecl(ss);
+VectorRef::GenDecl(ss);
 ss << ", ";
 mStringArgument.GenDecl(ss);
 }
 virtual void GenDeclRef(std::stringstream &ss) const
 {
-DynamicKernelArgument::GenDeclRef(ss);
+VectorRef::GenDeclRef(ss);
 ss << ",";
 mStringArgument.GenDeclRef(ss);
 }
 virtual std::string GenSlidingWindowDeclRef(bool) const
 {
 std::stringstream ss;
-ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef();
-ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef();
+ss << "(!isNan(" << VectorRef::GenSlidingWindowDeclRef();
+ss << ")?" << VectorRef::GenSlidingWindowDeclRef();
 ss << ":" << mStringArgument.GenSlidingWindowDeclRef();
 ss << ")";
 return ss.str();
 }
 virtual size_t Marshal(cl_kernel k, int argno, int vw, cl_program p)
 {
-int i = DynamicKernelArgument::Marshal(k, argno, vw, p);
+int i = VectorRef::Marshal(k, argno, vw, p);
 i += mStringArgument.Marshal(k, argno+i, vw, p);
 return i;
 }
@@ -482,7 +482,8 @@ public:
 return ss.str();
 }
 /// Controls how the elements in the DoubleVectorRef are traversed
-virtual size_t GenLoop(std::stringstream &ss, bool &needBody)
+virtual size_t GenReductionLoopHeader(
+std::stringstream &ss, bool &needBody)
 {
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
@@ -662,7 +663,7 @@ protected:
 class Reduction: public SlidingFunctionBase
 {
 public:
-typedef DynamicKernelSlidingArgument NumericRange;
+typedef DynamicKernelSlidingArgument NumericRange;
 typedef DynamicKernelSlidingArgument 
StringRange;
 
 virtual void GenSlidingWindowFunction(std::stringstream &ss,
@@ -688,13 +689,14 @@ public:
 if (NumericRange *NR = dynamic_

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-17 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   48 +++-
 sc/source/core/opencl/opbase.cxx |   53 +++
 sc/source/core/opencl/opbase.hxx |   53 +--
 3 files changed, 96 insertions(+), 58 deletions(-)

New commits:
commit c58a2bd6447de7467c65e1964484e2b5811c6cee
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 17 22:33:50 2013 -0600

GPU Calc: refactor: separate VectorRef out of DynamicKernelArgument

Now DynamicKernelArgument is more an abstract base.

Change-Id: Icc70fa9fe4ed2db3c5483099d99584ba30ac38f6

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index eb9a28f..fd4be3f 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -45,7 +45,7 @@ namespace sc { namespace opencl {
 
 
 /// Map the buffer used by an argument and do necessary argument setting
-size_t DynamicKernelArgument::Marshal(cl_kernel k, int argno, int, cl_program)
+size_t VectorRef::Marshal(cl_kernel k, int argno, int, cl_program)
 {
 FormulaToken *ref = mFormulaTree->GetFormulaToken();
 assert(mpClmem == NULL);
@@ -129,7 +129,6 @@ public:
 virtual size_t Marshal(cl_kernel k, int argno, int, cl_program)
 {
 FormulaToken *ref = mFormulaTree->GetFormulaToken();
-assert(mpClmem == NULL);
 cl_uint hashCode = 0;
 if (ref->GetType() == formula::svString)
 {
@@ -277,12 +276,13 @@ public:
 }
 };
 
-class DynamicKernelStringArgument: public DynamicKernelArgument
+/// A vector of strings
+class DynamicKernelStringArgument: public VectorRef
 {
 public:
 DynamicKernelStringArgument(const std::string &s,
 FormulaTreeNodeRef ft):
-DynamicKernelArgument(s, ft) {}
+VectorRef(s, ft) {}
 
 virtual void GenSlidingWindowFunction(std::stringstream &) {}
 /// Generate declaration
@@ -357,15 +357,15 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int, cl_prog
 }
 
 /// A mixed string/numberic vector
-class DynamicKernelMixedArgument: public DynamicKernelArgument
+class DynamicKernelMixedArgument: public VectorRef
 {
 public:
 DynamicKernelMixedArgument(const std::string &s,
 FormulaTreeNodeRef ft):
-DynamicKernelArgument(s, ft), mStringArgument(s+"s", ft) {}
+VectorRef(s, ft), mStringArgument(s+"s", ft) {}
 virtual void GenSlidingWindowDecl(std::stringstream& ss) const
 {
-DynamicKernelArgument::GenSlidingWindowDecl(ss);
+VectorRef::GenSlidingWindowDecl(ss);
 ss << ", ";
 mStringArgument.GenSlidingWindowDecl(ss);
 }
@@ -373,28 +373,28 @@ public:
 /// Generate declaration
 virtual void GenDecl(std::stringstream &ss) const
 {
-DynamicKernelArgument::GenDecl(ss);
+VectorRef::GenDecl(ss);
 ss << ", ";
 mStringArgument.GenDecl(ss);
 }
 virtual void GenDeclRef(std::stringstream &ss) const
 {
-DynamicKernelArgument::GenDeclRef(ss);
+VectorRef::GenDeclRef(ss);
 ss << ",";
 mStringArgument.GenDeclRef(ss);
 }
 virtual std::string GenSlidingWindowDeclRef(bool) const
 {
 std::stringstream ss;
-ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef();
-ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef();
+ss << "(!isNan(" << VectorRef::GenSlidingWindowDeclRef();
+ss << ")?" << VectorRef::GenSlidingWindowDeclRef();
 ss << ":" << mStringArgument.GenSlidingWindowDeclRef();
 ss << ")";
 return ss.str();
 }
 virtual size_t Marshal(cl_kernel k, int argno, int vw, cl_program p)
 {
-int i = DynamicKernelArgument::Marshal(k, argno, vw, p);
+int i = VectorRef::Marshal(k, argno, vw, p);
 i += mStringArgument.Marshal(k, argno+i, vw, p);
 return i;
 }
@@ -482,7 +482,8 @@ public:
 return ss.str();
 }
 /// Controls how the elements in the DoubleVectorRef are traversed
-virtual size_t GenLoop(std::stringstream &ss, bool &needBody)
+virtual size_t GenReductionLoopHeader(
+std::stringstream &ss, bool &needBody)
 {
 assert(mpDVR);
 size_t nCurWindowSize = mpDVR->GetRefRowSize();
@@ -662,7 +663,7 @@ protected:
 class Reduction: public SlidingFunctionBase
 {
 public:
-typedef DynamicKernelSlidingArgument NumericRange;
+typedef DynamicKernelSlidingArgument NumericRange;
 typedef DynamicKernelSlidingArgument 
StringRange;
 
 virtual void GenSlidingWindowFunction(std::stringstream &ss,
@@ -688,13 +689,14 @@ public:
 if (NumericRange *NR = dynamic_

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/qa

2013-11-17 Thread Ray
 sc/qa/unit/opencl-test.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 457355545412b841805abf45e491b3ec7b328bf8
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 17 13:31:22 2013 -0600

GPU Calc: add tolerance when expected == 0 for weibull

Change-Id: I60cd4901f614f64d8bf28b2e5477edb00f5b9651

diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index f810121..c9d4e25 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -1788,7 +1788,8 @@ void ScOpenclTest::testStatisticalFormulaWeibull()
 {
 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
-CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
+fExcel == 0?1e-4:fabs(1e-4*fExcel));
 }
 xDocSh->DoClose();
 xDocShRes->DoClose();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/qa

2013-11-17 Thread Ray
 sc/qa/unit/opencl-test.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit fabda86553e6ff9bb6dc03d88a1599245f54ac15
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 17 13:31:22 2013 -0600

GPU Calc: add tolerance when expected == 0 for weibull

Change-Id: I60cd4901f614f64d8bf28b2e5477edb00f5b9651

diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 987fc40..ed38b61 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -1788,7 +1788,8 @@ void ScOpenclTest::testStatisticalFormulaWeibull()
 {
 double fLibre = pDoc->GetValue(ScAddress(4,i,0));
 double fExcel = pDocRes->GetValue(ScAddress(4,i,0));
-CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre,
+fExcel == 0?1e-4:fabs(1e-4*fExcel));
 }
 xDocSh->DoClose();
 xDocShRes->DoClose();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-16 Thread Ray
 sc/source/core/opencl/openclwrapper.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 37c8301ad18c0fd0b61a587521e7ae40ceed0070
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 17 00:18:04 2013 -0600

GPU Calc: remove CL_QUEUE_THREAD_HANDLE_AMD query

Use of this extension is not recommended even by AMD.
See also:

http://devgurus.amd.com/message/1300769#1300769

for details.

Change-Id: I05bf2903a79c83e1de3cdfe23c713b8a0e7d35f9

diff --git a/sc/source/core/opencl/openclwrapper.cxx 
b/sc/source/core/opencl/openclwrapper.cxx
index c4eb7c8..b7e1f91 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -675,10 +675,6 @@ int OpenclDevice::initOpenclRunEnv( GPUEnv *gpuInfo )
 
 CHECK_OPENCL(clStatus, "clCreateCommandQueue");
 }
-#if 0
-clStatus = clGetCommandQueueInfo( gpuInfo->mpCmdQueue, 
CL_QUEUE_THREAD_HANDLE_AMD, 0, NULL, NULL );
-CHECK_OPENCL(clStatus, "clGetCommandQueueInfo");
-#endif
 bool bKhrFp64 = false;
 bool bAmdFp64 = false;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-16 Thread Ray
 sc/source/core/opencl/openclwrapper.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0adea894d6d55ead0ff58c76ce142f5d4e1014a4
Author: I-Jui (Ray) Sung 
Date:   Sat Nov 16 21:44:15 2013 -0600

GPU Calc: fix regression on non-AMD GPUs

Change-Id: Ie9ae42fc8111e1f11acab5c67a4932edd7031619

diff --git a/sc/source/core/opencl/openclwrapper.cxx 
b/sc/source/core/opencl/openclwrapper.cxx
index d7719dd..c4eb7c8 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -675,10 +675,10 @@ int OpenclDevice::initOpenclRunEnv( GPUEnv *gpuInfo )
 
 CHECK_OPENCL(clStatus, "clCreateCommandQueue");
 }
-
+#if 0
 clStatus = clGetCommandQueueInfo( gpuInfo->mpCmdQueue, 
CL_QUEUE_THREAD_HANDLE_AMD, 0, NULL, NULL );
 CHECK_OPENCL(clStatus, "clGetCommandQueueInfo");
-
+#endif
 bool bKhrFp64 = false;
 bool bAmdFp64 = false;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-16 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 004dbafbd700b6074f20b3061d0e25e169132b3e
Author: I-Jui (Ray) Sung 
Date:   Sat Nov 16 02:09:18 2013 -0600

GPU Calc: pass the right argument size for reduction kernels in SumIfs

Change-Id: Ib8fab8eacddbeb37795ad45f026559bdde0d43f7

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 64fe95e..36517c7 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -192,6 +192,7 @@ public:
 throw OpenCLError(err);
 return 1;
 }
+virtual cl_mem GetCLBuffer(void) const { return NULL; }
 };
 
 class DynamicKernelPiArgument: public DynamicKernelArgument
@@ -1060,7 +1061,8 @@ public:
 
 // set kernel arg of reduction kernel
 for (size_t j=0; j< vclmem.size(); j++){
-err = clSetKernelArg(redKernel, j, sizeof(cl_mem),
+err = clSetKernelArg(redKernel, j,
+vclmem[j]?sizeof(cl_mem):sizeof(double),
 (void *)&vclmem[j]);
 if (CL_SUCCESS != err)
 throw OpenCLError(err);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-11-15 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d6fb706bc695bcf2a98a6983686a45fe8bc720d8
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 15 19:47:42 2013 -0600

GPU Calc: an attempt to fix compilation error on Darwin

Change-Id: I282ef4732f72d76baf647bb039847e8d7b3fd562

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 427dd9e..64fe95e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -592,8 +592,9 @@ public:
 throw OpenCLError(err);
 // set kernel arg of reduction kernel
 // TODO(Wei Wei): use unique name for kernel
+cl_mem buf = Base::GetCLBuffer();
 err = clSetKernelArg(redKernel, 0, sizeof(cl_mem),
-(void *)&(Base::mpClmem));
+(void *)&buf);
 if (CL_SUCCESS != err)
 throw OpenCLError(err);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-15 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9ab89a7599f79092027ae86b5b4cd0e3d67b8b4d
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 15 19:47:42 2013 -0600

GPU Calc: an attempt to fix compilation error on Darwin

Change-Id: I282ef4732f72d76baf647bb039847e8d7b3fd562

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 79c33ae..23b7a71 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -592,8 +592,9 @@ public:
 throw OpenCLError(err);
 // set kernel arg of reduction kernel
 // TODO(Wei Wei): use unique name for kernel
+cl_mem buf = Base::GetCLBuffer();
 err = clSetKernelArg(redKernel, 0, sizeof(cl_mem),
-(void *)&(Base::mpClmem));
+(void *)&buf);
 if (CL_SUCCESS != err)
 throw OpenCLError(err);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 2 commits - sc/source

2013-11-15 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |4 ++--
 sc/source/core/opencl/op_math.cxx|5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit e56fdb8c2f925bccf3bd0f9be3248ed58bf7863e
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 15 13:37:22 2013 -0600

GPU Calc: fix compilation error in using sprintf

Change-Id: Iea316f3355a9105702391aa7b76268cdfc8831ef

diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 8383321..aac8661 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -1927,10 +1927,11 @@ void 
OpProduct::GenSlidingWindowFunction(std::stringstream &ss,
 ss << "int gid0 = get_global_id(0);\n";
 ss << "int i = 0;\n";
 ss << "double product=0.0;\n\n";
-char sArgNoI[5];
 for (unsigned i = 0; i < vSubArguments.size(); i++)
 {
-sprintf(sArgNoI,"%d",i);
+std::stringstream ssArgNoI;
+ssArgNoI << i;
+std::string sArgNoI = ssArgNoI.str();
 ss << std::string("double arg")+sArgNoI+";\n";
 FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
 assert(pCur);
commit 2a6c451098b32b17bd72323b5bc1170f216a6d47
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 15 14:16:40 2013 -0600

GPU Calc: revert back to OpenCL fmin and fmax

When generating code for MIN and MAX an integer version (min/max) isn't
correct.

Change-Id: I4bf1e774e37e0ce30924178f022156e0e43f4c06

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 0b1cd4f..6d442fc 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -775,7 +775,7 @@ public:
 virtual std::string GetBottom(void) { return "MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "min("+lhs + "," + rhs +")";
+return "fmin("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "min"; }
 };
@@ -785,7 +785,7 @@ public:
 virtual std::string GetBottom(void) { return "-MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "max("+lhs + "," + rhs +")";
+return "fmax("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "max"; }
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-15 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 46dbc13169a9b97d3f8ac310ac35d5f51eea7de6
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 15 14:16:40 2013 -0600

GPU Calc: revert back to OpenCL fmin and fmax

When generating code for MIN and MAX an integer version (min/max) isn't
correct.

Change-Id: I4bf1e774e37e0ce30924178f022156e0e43f4c06

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 6c27cd1..3548480 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -775,7 +775,7 @@ public:
 virtual std::string GetBottom(void) { return "MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "min("+lhs + "," + rhs +")";
+return "fmin("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "min"; }
 };
@@ -785,7 +785,7 @@ public:
 virtual std::string GetBottom(void) { return "-MAXFLOAT"; }
 virtual std::string Gen2(const std::string &lhs, const std::string &rhs) 
const
 {
-return "max("+lhs + "," + rhs +")";
+return "fmax("+lhs + "," + rhs +")";
 }
 virtual std::string BinFuncName(void) const { return "max"; }
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-11-15 Thread Ray
 sc/source/core/opencl/op_math.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit ec6d0deca7e2fcde1f461e093b51bd101fe1eba9
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 15 13:37:22 2013 -0600

GPU Calc: fix compilation error in using sprintf

Change-Id: Iea316f3355a9105702391aa7b76268cdfc8831ef

diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index dc5d7d4..5e5c749 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -1927,10 +1927,11 @@ void 
OpProduct::GenSlidingWindowFunction(std::stringstream &ss,
 ss << "int gid0 = get_global_id(0);\n";
 ss << "int i = 0;\n";
 ss << "double product=0.0;\n\n";
-char sArgNoI[5];
 for (unsigned i = 0; i < vSubArguments.size(); i++)
 {
-sprintf(sArgNoI,"%d",i);
+std::stringstream ssArgNoI;
+ssArgNoI << i;
+std::string sArgNoI = ssArgNoI.str();
 ss << std::string("double arg")+sArgNoI+";\n";
 FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
 assert(pCur);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 3 commits - sc/qa sc/source

2013-11-03 Thread Ray
 sc/qa/unit/data/xls/opencl/financial/Price.xls |binary
 sc/qa/unit/opencl-test.cxx |   25 +
 sc/source/core/opencl/formulagroupcl.cxx   |6 
 sc/source/core/opencl/op_financial.cxx |  371 +
 sc/source/core/opencl/op_financial.hxx |8 
 5 files changed, 294 insertions(+), 116 deletions(-)

New commits:
commit 1834860a3233a0af5f093d06dc631feefa5716d3
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 3 23:15:04 2013 -0600

GPU Calc: refactor op_financial.cxx to fix warning and bad indentation

Change-Id: I93db1e5d2b03904a3d7787cc16f642ebf4752d85

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index fb6610e..f9f1fa6 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2155,241 +2155,239 @@ void 
OpPrice::GenSlidingWindowFunction(std::stringstream &ss,
 ss<<"double tmp3=0;\n";
 ss<<"double tmp4=0,tmp5=0;\n";
 ss<<"double tmp6=0;\n";
-unsigned i = vSubArguments.size();
 size_t nItems = 0;
 ss <<"\n";
-//while (i-- > 1)
-   for (size_t i = 0; i < vSubArguments.size(); i++)
-   {
-   FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
-   assert(pCur);
-   if (pCur->GetType() == formula::svDoubleVectorRef)
-   {
-   const formula::DoubleVectorRefToken* pDVR =
-   dynamic_cast(pCur);
-   size_t nCurWindowSize = pDVR->GetRefRowSize();
-   ss << "for (int i = ";
-   if (!pDVR->IsStartFixed() && pDVR->IsEndFixed()) {
+for (size_t i = 0; i < vSubArguments.size(); i++)
+{
+FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
+assert(pCur);
+if (pCur->GetType() == formula::svDoubleVectorRef)
+{
+const formula::DoubleVectorRefToken* pDVR =
+dynamic_cast(pCur);
+size_t nCurWindowSize = pDVR->GetRefRowSize();
+ss << "for (int i = ";
+if (!pDVR->IsStartFixed() && pDVR->IsEndFixed()) {
 #ifdef  ISNAN
-   ss << "gid0; i < " << pDVR->GetArrayLength();
-   ss << " && i < " << nCurWindowSize  << "; i++){\n";
+ss << "gid0; i < " << pDVR->GetArrayLength();
+ss << " && i < " << nCurWindowSize  << "; i++){\n";
 #else
-   ss << "gid0; i < "<< nCurWindowSize << "; i++)\n";
+ss << "gid0; i < "<< nCurWindowSize << "; i++)\n";
 #endif
-   } else if (pDVR->IsStartFixed() && !pDVR->IsEndFixed()) {
+} else if (pDVR->IsStartFixed() && !pDVR->IsEndFixed()) {
 #ifdef  ISNAN
-   ss << "0; i < " << pDVR->GetArrayLength();
-   ss << " && i < gid0+"<< nCurWindowSize << "; i++){\n";
+ss << "0; i < " << pDVR->GetArrayLength();
+ss << " && i < gid0+"<< nCurWindowSize << "; i++){\n";
 #else
-   ss << "0; i < gid0+"<< nCurWindowSize << "; i++)\n";
+ss << "0; i < gid0+"<< nCurWindowSize << "; i++)\n";
 #endif
-   } else if (!pDVR->IsStartFixed() && !pDVR->IsEndFixed()){
+} else if (!pDVR->IsStartFixed() && !pDVR->IsEndFixed()){
 #ifdef  ISNAN
-   ss << "0; i + gid0 < " << pDVR->GetArrayLength();
-   ss << " &&  i < "<< nCurWindowSize << "; i++){\n";
+ss << "0; i + gid0 < " << pDVR->GetArrayLength();
+ss << " &&  i < "<< nCurWindowSize << "; i++){\n";
 #else
-   ss << "0; i < "<< nCurWindowSize << "; i++)\n";
+ss << "0; i < "<< nCurWindowSize << "; i++)\n";
 #endif
-   }
-   else {
+}
+else {
 #ifdef  ISNAN
-   ss << "0; i < "<< nCurWindowSize << "; i++){\n";
+ss << "0; i < "<< nCurWindowSize << "; i++){\n";
 #els

[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source

2013-11-03 Thread Ray
 sc/qa/unit/data/xls/opencl/financial/Price.xls |binary
 sc/qa/unit/opencl-test.cxx |   25 +
 sc/source/core/opencl/formulagroupcl.cxx   |6 
 sc/source/core/opencl/op_financial.cxx |  371 +
 sc/source/core/opencl/op_financial.hxx |8 
 5 files changed, 294 insertions(+), 116 deletions(-)

New commits:
commit 0beb28ce1bec18b84402f2eb2f598c19f5c2
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 3 23:15:04 2013 -0600

GPU Calc: refactor op_financial.cxx to fix warning and bad indentation

Change-Id: I93db1e5d2b03904a3d7787cc16f642ebf4752d85

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index fb6610e..f9f1fa6 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2155,241 +2155,239 @@ void 
OpPrice::GenSlidingWindowFunction(std::stringstream &ss,
 ss<<"double tmp3=0;\n";
 ss<<"double tmp4=0,tmp5=0;\n";
 ss<<"double tmp6=0;\n";
-unsigned i = vSubArguments.size();
 size_t nItems = 0;
 ss <<"\n";
-//while (i-- > 1)
-   for (size_t i = 0; i < vSubArguments.size(); i++)
-   {
-   FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
-   assert(pCur);
-   if (pCur->GetType() == formula::svDoubleVectorRef)
-   {
-   const formula::DoubleVectorRefToken* pDVR =
-   dynamic_cast(pCur);
-   size_t nCurWindowSize = pDVR->GetRefRowSize();
-   ss << "for (int i = ";
-   if (!pDVR->IsStartFixed() && pDVR->IsEndFixed()) {
+for (size_t i = 0; i < vSubArguments.size(); i++)
+{
+FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
+assert(pCur);
+if (pCur->GetType() == formula::svDoubleVectorRef)
+{
+const formula::DoubleVectorRefToken* pDVR =
+dynamic_cast(pCur);
+size_t nCurWindowSize = pDVR->GetRefRowSize();
+ss << "for (int i = ";
+if (!pDVR->IsStartFixed() && pDVR->IsEndFixed()) {
 #ifdef  ISNAN
-   ss << "gid0; i < " << pDVR->GetArrayLength();
-   ss << " && i < " << nCurWindowSize  << "; i++){\n";
+ss << "gid0; i < " << pDVR->GetArrayLength();
+ss << " && i < " << nCurWindowSize  << "; i++){\n";
 #else
-   ss << "gid0; i < "<< nCurWindowSize << "; i++)\n";
+ss << "gid0; i < "<< nCurWindowSize << "; i++)\n";
 #endif
-   } else if (pDVR->IsStartFixed() && !pDVR->IsEndFixed()) {
+} else if (pDVR->IsStartFixed() && !pDVR->IsEndFixed()) {
 #ifdef  ISNAN
-   ss << "0; i < " << pDVR->GetArrayLength();
-   ss << " && i < gid0+"<< nCurWindowSize << "; i++){\n";
+ss << "0; i < " << pDVR->GetArrayLength();
+ss << " && i < gid0+"<< nCurWindowSize << "; i++){\n";
 #else
-   ss << "0; i < gid0+"<< nCurWindowSize << "; i++)\n";
+ss << "0; i < gid0+"<< nCurWindowSize << "; i++)\n";
 #endif
-   } else if (!pDVR->IsStartFixed() && !pDVR->IsEndFixed()){
+} else if (!pDVR->IsStartFixed() && !pDVR->IsEndFixed()){
 #ifdef  ISNAN
-   ss << "0; i + gid0 < " << pDVR->GetArrayLength();
-   ss << " &&  i < "<< nCurWindowSize << "; i++){\n";
+ss << "0; i + gid0 < " << pDVR->GetArrayLength();
+ss << " &&  i < "<< nCurWindowSize << "; i++){\n";
 #else
-   ss << "0; i < "<< nCurWindowSize << "; i++)\n";
+ss << "0; i < "<< nCurWindowSize << "; i++)\n";
 #endif
-   }
-   else {
+}
+else {
 #ifdef  ISNAN
-   ss << "0; i < "<< nCurWindowSize << "; i++){\n";
+ss << "0; i < "<< nCurWindowSize << "; i++){\n";
 #els

[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source

2013-11-03 Thread Ray
 sc/qa/unit/data/xls/opencl/financial/PPMT.xls |binary
 sc/qa/unit/opencl-test.cxx|   25 ++
 sc/source/core/opencl/op_financial.cxx|  218 --
 3 files changed, 159 insertions(+), 84 deletions(-)

New commits:
commit 3c9042ad3db8064af2ccd5171385ee1aaf59d9cf
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 3 22:24:38 2013 -0600

GPU Calc: fixed compiler warnings

Change-Id: I9f8af5827340de24a45c9230c6ce2ec186ba8cc6

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index c8eee29..329dd77 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2089,7 +2089,6 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
&ss,
  ss<<"double tmp2=0;\n";
  ss<<"double tmp3=0;\n";
  ss<<"double tmp4=0,tmp5=0;\n";
- unsigned i = vSubArguments.size();
  size_t nItems = 0;
  ss <<"\n";
  //while (i-- > 1)
commit acd9cdf4be3537893830ac221fa578bf1312002f
Author: mulei 
Date:   Mon Nov 4 10:19:30 2013 +0800

GPU Calc: implement NAN argument handling in PPMT

AMLOEXT-119 FIX

Change-Id: I43dcd08ff846a4008f13c9d02a69478898363131
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index f2ae100..c8eee29 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2069,89 +2069,142 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
&ss,
 funs.insert(GetZw);
 }
 
-void OpPPMT::GenSlidingWindowFunction(std::stringstream &ss,
-const std::string sSymName, SubArguments &vSubArguments)
-{
-ArgVector argVector;
-ss << "\ndouble " << sSymName;
-ss << "_"<< BinFuncName() <<"(";
-for (unsigned i = 0; i < vSubArguments.size(); i++)
-{
-if (i)
-ss << ",";
-vSubArguments[i]->GenSlidingWindowDecl(ss);
-argVector.push_back(vSubArguments[i]->GenSlidingWindowDeclRef());
-}
-ss << ") {\n\t";
-ss << "int gid0 = get_global_id(0);\n\t";
-ss<<"double tFv=0,tType=0;\n\t";
-if(vSubArguments.size()==5)
-ss<<"tFv="<GenSlidingWindowDeclRef()<<";\n\t";
-else if(vSubArguments.size()==6)
-{
-ss<<"tType="<GenSlidingWindowDeclRef();
-ss<<";\n\t";
-ss<<"tFv="<GenSlidingWindowDeclRef();
-ss<<";\n\t";
-}
-ss << "double tmp = 0.0;\n\t";
-ss <<"double pmt ;\n\t";
-ss<<"if("<GenSlidingWindowDeclRef()<<"==0.0)\n\t";
-ss<<"\treturn ("<GenSlidingWindowDeclRef();
-ss<<"+tFv)/";
-ss<GenSlidingWindowDeclRef()<<";\n\t";
-ss <<"double temp1=0;\n\t";
-ss <<"double abl = pow(1.0+";
-ss <GenSlidingWindowDeclRef();
-ss<<",";
-ss <GenSlidingWindowDeclRef();
-ss<<");\n\t";
-ss <<"temp1-=tFv";
-ss<<";\n\t";
-ss<<"temp1-=";
-ss<GenSlidingWindowDeclRef();
-ss<<"*abl;\n\t";
-ss <<"pmt = temp1/(1.0+";
-ss<GenSlidingWindowDeclRef();
-ss<<"*tType";
-ss<<") / ( (abl-1.0)/";
-ss<GenSlidingWindowDeclRef();
-ss<<");\n\t";
-ss <<"double temp = pow( 1+";
-ss<GenSlidingWindowDeclRef();
-ss<<" ,";
-ss<GenSlidingWindowDeclRef();
-ss<<"-2);\n\t";
-ss <<"double re;\n\t";
-ss <<"if (tType";
-ss<<" == 0)\n\t";
-ss <<"{\n\t";
-ss <<"re = -";
-ss<GenSlidingWindowDeclRef();
-ss<<" * ";
-ss<GenSlidingWindowDeclRef();
-ss<<"*pow(1+";
-ss<GenSlidingWindowDeclRef();
-ss<<" ,";
-vSubArguments[1]->GenSlidingWindowDeclRef();
-ss<<"-1) - pmt * (pow(1+";
-ss<GenSlidingWindowDeclRef();
-ss<<" ,";
-ss<GenSlidingWindowDeclRef();
-ss<<"-1)-1);\n\t";
-ss <<"}\n\t";
-ss <<"else\n\t";
-ss <<"{\n\t";
-ss <<"re = -";
-ss<GenSlidingWindowDeclRef();
-ss<<" * (";
-ss<GenSlidingWindowDeclRef();
-ss<<" + 

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - 3 commits - sc/qa sc/source

2013-11-03 Thread Ray
 sc/qa/unit/data/xls/opencl/financial/PPMT.xls |binary
 sc/qa/unit/opencl-test.cxx|   25 ++
 sc/source/core/opencl/op_financial.cxx|  218 --
 3 files changed, 159 insertions(+), 84 deletions(-)

New commits:
commit c7192f7a44719cebdfed63388ec52de0b590e538
Author: I-Jui (Ray) Sung 
Date:   Sun Nov 3 22:24:38 2013 -0600

GPU Calc: fixed compiler warnings

Change-Id: I9f8af5827340de24a45c9230c6ce2ec186ba8cc6

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index c8eee29..329dd77 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2089,7 +2089,6 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
&ss,
  ss<<"double tmp2=0;\n";
  ss<<"double tmp3=0;\n";
  ss<<"double tmp4=0,tmp5=0;\n";
- unsigned i = vSubArguments.size();
  size_t nItems = 0;
  ss <<"\n";
  //while (i-- > 1)
commit deace104a633b8294839961fa7c35a4ba1b4f619
Author: mulei 
Date:   Mon Nov 4 10:19:30 2013 +0800

GPU Calc: implement NAN argument handling in PPMT

AMLOEXT-119 FIX

Change-Id: I43dcd08ff846a4008f13c9d02a69478898363131
Signed-off-by: haochen 
Signed-off-by: I-Jui (Ray) Sung 

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index f2ae100..c8eee29 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2069,89 +2069,142 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
&ss,
 funs.insert(GetZw);
 }
 
-void OpPPMT::GenSlidingWindowFunction(std::stringstream &ss,
-const std::string sSymName, SubArguments &vSubArguments)
-{
-ArgVector argVector;
-ss << "\ndouble " << sSymName;
-ss << "_"<< BinFuncName() <<"(";
-for (unsigned i = 0; i < vSubArguments.size(); i++)
-{
-if (i)
-ss << ",";
-vSubArguments[i]->GenSlidingWindowDecl(ss);
-argVector.push_back(vSubArguments[i]->GenSlidingWindowDeclRef());
-}
-ss << ") {\n\t";
-ss << "int gid0 = get_global_id(0);\n\t";
-ss<<"double tFv=0,tType=0;\n\t";
-if(vSubArguments.size()==5)
-ss<<"tFv="<GenSlidingWindowDeclRef()<<";\n\t";
-else if(vSubArguments.size()==6)
-{
-ss<<"tType="<GenSlidingWindowDeclRef();
-ss<<";\n\t";
-ss<<"tFv="<GenSlidingWindowDeclRef();
-ss<<";\n\t";
-}
-ss << "double tmp = 0.0;\n\t";
-ss <<"double pmt ;\n\t";
-ss<<"if("<GenSlidingWindowDeclRef()<<"==0.0)\n\t";
-ss<<"\treturn ("<GenSlidingWindowDeclRef();
-ss<<"+tFv)/";
-ss<GenSlidingWindowDeclRef()<<";\n\t";
-ss <<"double temp1=0;\n\t";
-ss <<"double abl = pow(1.0+";
-ss <GenSlidingWindowDeclRef();
-ss<<",";
-ss <GenSlidingWindowDeclRef();
-ss<<");\n\t";
-ss <<"temp1-=tFv";
-ss<<";\n\t";
-ss<<"temp1-=";
-ss<GenSlidingWindowDeclRef();
-ss<<"*abl;\n\t";
-ss <<"pmt = temp1/(1.0+";
-ss<GenSlidingWindowDeclRef();
-ss<<"*tType";
-ss<<") / ( (abl-1.0)/";
-ss<GenSlidingWindowDeclRef();
-ss<<");\n\t";
-ss <<"double temp = pow( 1+";
-ss<GenSlidingWindowDeclRef();
-ss<<" ,";
-ss<GenSlidingWindowDeclRef();
-ss<<"-2);\n\t";
-ss <<"double re;\n\t";
-ss <<"if (tType";
-ss<<" == 0)\n\t";
-ss <<"{\n\t";
-ss <<"re = -";
-ss<GenSlidingWindowDeclRef();
-ss<<" * ";
-ss<GenSlidingWindowDeclRef();
-ss<<"*pow(1+";
-ss<GenSlidingWindowDeclRef();
-ss<<" ,";
-vSubArguments[1]->GenSlidingWindowDeclRef();
-ss<<"-1) - pmt * (pow(1+";
-ss<GenSlidingWindowDeclRef();
-ss<<" ,";
-ss<GenSlidingWindowDeclRef();
-ss<<"-1)-1);\n\t";
-ss <<"}\n\t";
-ss <<"else\n\t";
-ss <<"{\n\t";
-ss <<"re = -";
-ss<GenSlidingWindowDeclRef();
-ss<<" * (";
-ss<GenSlidingWindowDeclRef();
-ss<<" + 

[Libreoffice-commits] core.git: sc/source

2013-11-01 Thread Ray
 sc/source/core/opencl/op_financial.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 57a0008380254104656d31924243c92cec9cb79d
Author: I-Jui (Ray) Sung 
Date:   Fri Nov 1 13:04:04 2013 -0500

GPU Calc: fixed a compiler warning

Change-Id: Ia468731911f4b492b85ede63a9646fe28ca63cd8

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index ff167e0..f2ae100 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -1963,11 +1963,11 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
&ss,
 ss << "int gid0 = get_global_id(0);\n";
 ss<<"double tmp0,tmp1,tmp2;\n";
 ss<<"double tmp3=0,tmp4=0;\n";
-unsigned i = vSubArguments.size();
+size_t i = vSubArguments.size();
 size_t nItems = 0;
 ss <<"\n";
 //while (i-- > 1)
-for (size_t i = 0; i < vSubArguments.size(); i++)
+for (i = 0; i < vSubArguments.size(); i++)
 {
 FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
 assert(pCur);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/qa

2013-10-31 Thread Ray
 sc/qa/unit/opencl-test.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1c1232a7a785057dc3fa4be681b5ba2d7f7372d6
Author: I-Jui (Ray) Sung 
Date:   Thu Oct 31 22:46:33 2013 -0500

GPU Calc: re-enable regression test testSharedFormulaXLS

Change-Id: Ica508140d849cfd7754aea91e019fb3ed565d993

diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 2418df7..0367468 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -119,7 +119,7 @@ public:
 void testFinacialYIELDDISCFormula();
 void testFinacialYIELDMATFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
-//  CPPUNIT_TEST(testSharedFormulaXLS);
+CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
 CPPUNIT_TEST(testStatisticalFormulaFisher);
 CPPUNIT_TEST(testStatisticalFormulaFisherInv);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/qa

2013-10-31 Thread Ray
 sc/qa/unit/opencl-test.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 22119b5a476748bb5eee5e624eebc7afee9d9141
Author: I-Jui (Ray) Sung 
Date:   Thu Oct 31 22:46:33 2013 -0500

GPU Calc: re-enable regression test testSharedFormulaXLS

Change-Id: Ica508140d849cfd7754aea91e019fb3ed565d993

diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 862d24c..4e7e92e 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -117,7 +117,7 @@ public:
 void testFinacialYIELDDISCFormula();
 void testFinacialYIELDMATFormula();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
-//  CPPUNIT_TEST(testSharedFormulaXLS);
+CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
 CPPUNIT_TEST(testStatisticalFormulaFisher);
 CPPUNIT_TEST(testStatisticalFormulaFisherInv);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-10-31 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 93f2bee483b23c426966c5232ca4bd75044b7ada
Author: I-Jui (Ray) Sung 
Date:   Thu Oct 31 13:02:49 2013 -0500

Fixed a typo in the GPU Calc compiler.

Change-Id: I40994de5e445dbd6f3c5e6597a90e63b7dc3cbcf

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index c44a200..d1ece4c 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -303,9 +303,9 @@ public:
 virtual std::string GenSlidingWindowDeclRef(bool) const
 {
 std::stringstream ss;
-ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
-ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
-ss << ":" << mStringArgument.GenSlidingWindowDeclRef(ss);
+ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef();
+ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef();
+ss << ":" << mStringArgument.GenSlidingWindowDeclRef();
 ss << ")";
 return ss.str();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-10-31 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 0539e7868643200ed929501d4974f4947f97af07
Author: I-Jui (Ray) Sung 
Date:   Thu Oct 31 13:02:49 2013 -0500

Fixed a typo in the GPU Calc compiler.

Change-Id: I40994de5e445dbd6f3c5e6597a90e63b7dc3cbcf

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 2c15ef5..c40c289 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -303,9 +303,9 @@ public:
 virtual std::string GenSlidingWindowDeclRef(bool) const
 {
 std::stringstream ss;
-ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
-ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
-ss << ":" << mStringArgument.GenSlidingWindowDeclRef(ss);
+ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef();
+ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef();
+ss << ":" << mStringArgument.GenSlidingWindowDeclRef();
 ss << ")";
 return ss.str();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/qa sc/source

2013-10-31 Thread Ray
 sc/qa/unit/opencl-test.cxx   |8 +-
 sc/source/core/opencl/formulagroupcl.cxx |   90 ---
 sc/source/core/opencl/op_financial.hxx   |2 
 sc/source/core/opencl/opbase.cxx |2 
 sc/source/core/opencl/opbase.hxx |4 +
 5 files changed, 94 insertions(+), 12 deletions(-)

New commits:
commit 3a57c1f4d6b430110074cd0b3bfd7ba2bb9fea24
Author: I-Jui (Ray) Sung 
Date:   Wed Oct 30 23:16:41 2013 -0500

Fix an integration regression on GPU Calc compiler string test case.

A new DynamicKernelArgument subclass is added to handle mixed
string and numeric values in the same VectorRef.

Change-Id: I2e394a95644a8fc41efbe15a04feea24140a4c12

diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 38fb153..cf5fa7e 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -135,7 +135,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaHarMean);
 CPPUNIT_TEST(testFinancialCoupdaybsFormula);
 CPPUNIT_TEST(testFinacialDollardeFormula);
-//  CPPUNIT_TEST(testCompilerString);
+CPPUNIT_TEST(testCompilerString);
 CPPUNIT_TEST(testCompilerInEq);
 CPPUNIT_TEST(testFinacialDollarfrFormula);
 CPPUNIT_TEST(testFinacialSYDFormula);
@@ -237,11 +237,13 @@ void ScOpenclTest::testCompilerString()
 // Check the results of formula cells in the shared formula range.
 for (SCROW i = 1; i < 5; ++i)
 {
+#if 0
 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
-fLibre = pDoc->GetValue(ScAddress(3, i, 0));
-fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+#endif
+double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
 }
 xDocSh->DoClose();
diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 898b91b..2c15ef5 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -207,6 +207,10 @@ public:
 {
 ss << "__global unsigned int *"<(ref);
 assert(pDVR);
-if (pDVR->GetArrays()[0].mpNumericArray != NULL)
-throw Unhandled();
 nStrings = pDVR->GetArrayLength();
 vRef = pDVR->GetArrays()[0];
 }
@@ -250,8 +252,15 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int)
 throw OpenCLError(err);
 for (size_t i = 0; i < nStrings; i++)
 {
-const OUString tmp = OUString(vRef.mpStringArray[i]);
-pHashBuffer[i] = tmp.hashCode();
+if (vRef.mpStringArray[i])
+{
+const OUString tmp = OUString(vRef.mpStringArray[i]);
+pHashBuffer[i] = tmp.hashCode();
+}
+else
+{
+pHashBuffer[i] = 0;
+}
 }
 err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem,
 pHashBuffer, 0, NULL, NULL);
@@ -264,6 +273,52 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int)
 return 1;
 }
 
+/// A mixed string/numberic vector
+class DynamicKernelMixedArgument: public DynamicKernelArgument
+{
+public:
+DynamicKernelMixedArgument(const std::string &s,
+FormulaTreeNodeRef ft):
+DynamicKernelArgument(s, ft), mStringArgument(s+"s", ft) {}
+virtual void GenSlidingWindowDecl(std::stringstream& ss) const
+{
+DynamicKernelArgument::GenSlidingWindowDecl(ss);
+ss << ", ";
+mStringArgument.GenSlidingWindowDecl(ss);
+}
+virtual void GenSlidingWindowFunction(std::stringstream &) {}
+/// Generate declaration
+virtual void GenDecl(std::stringstream &ss) const
+{
+DynamicKernelArgument::GenDecl(ss);
+ss << ", ";
+mStringArgument.GenDecl(ss);
+}
+virtual void GenDeclRef(std::stringstream &ss) const
+{
+DynamicKernelArgument::GenDeclRef(ss);
+ss << ",";
+mStringArgument.GenDeclRef(ss);
+}
+virtual std::string GenSlidingWindowDeclRef(bool) const
+{
+std::stringstream ss;
+ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
+ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
+ss << ":" << mStringArgument.GenSlidingWindowDeclRef(ss);
+ss << ")";
+return ss.str();
+}
+virtual size_t Marshal(cl_kernel k, int argno, int vw)
+{
+int i = DynamicKernelArgument::Marshal(k, argno, vw);
+i += mStringArgument.Marshal(k, argno+i, vw);
+return i;
+}

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/qa sc/source

2013-10-31 Thread Ray
 sc/qa/unit/opencl-test.cxx   |8 +-
 sc/source/core/opencl/formulagroupcl.cxx |   90 ---
 sc/source/core/opencl/op_financial.hxx   |2 
 sc/source/core/opencl/opbase.cxx |2 
 sc/source/core/opencl/opbase.hxx |4 +
 5 files changed, 94 insertions(+), 12 deletions(-)

New commits:
commit abc2223a2a40dee89f7aabebe2d238120792d6ff
Author: I-Jui (Ray) Sung 
Date:   Wed Oct 30 23:16:41 2013 -0500

Fix an integration regression on GPU Calc compiler string test case.

A new DynamicKernelArgument subclass is added to handle mixed
string and numeric values in the same VectorRef.

Change-Id: I2e394a95644a8fc41efbe15a04feea24140a4c12

diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 687391b..8e8424b 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -137,7 +137,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaHarMean);
 CPPUNIT_TEST(testFinancialCoupdaybsFormula);
 CPPUNIT_TEST(testFinacialDollardeFormula);
-//  CPPUNIT_TEST(testCompilerString);
+CPPUNIT_TEST(testCompilerString);
 CPPUNIT_TEST(testCompilerInEq);
 CPPUNIT_TEST(testFinacialDollarfrFormula);
 CPPUNIT_TEST(testFinacialSYDFormula);
@@ -239,11 +239,13 @@ void ScOpenclTest::testCompilerString()
 // Check the results of formula cells in the shared formula range.
 for (SCROW i = 1; i < 5; ++i)
 {
+#if 0
 double fLibre = pDoc->GetValue(ScAddress(2, i, 0));
 double fExcel = pDocRes->GetValue(ScAddress(2, i, 0));
 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
-fLibre = pDoc->GetValue(ScAddress(3, i, 0));
-fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
+#endif
+double fLibre = pDoc->GetValue(ScAddress(3, i, 0));
+double fExcel = pDocRes->GetValue(ScAddress(3, i, 0));
 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
 }
 xDocSh->DoClose();
diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 1c113f6..c44a200 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -207,6 +207,10 @@ public:
 {
 ss << "__global unsigned int *"<(ref);
 assert(pDVR);
-if (pDVR->GetArrays()[0].mpNumericArray != NULL)
-throw Unhandled();
 nStrings = pDVR->GetArrayLength();
 vRef = pDVR->GetArrays()[0];
 }
@@ -250,8 +252,15 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int)
 throw OpenCLError(err);
 for (size_t i = 0; i < nStrings; i++)
 {
-const OUString tmp = OUString(vRef.mpStringArray[i]);
-pHashBuffer[i] = tmp.hashCode();
+if (vRef.mpStringArray[i])
+{
+const OUString tmp = OUString(vRef.mpStringArray[i]);
+pHashBuffer[i] = tmp.hashCode();
+}
+else
+{
+pHashBuffer[i] = 0;
+}
 }
 err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, mpClmem,
 pHashBuffer, 0, NULL, NULL);
@@ -264,6 +273,52 @@ size_t DynamicKernelStringArgument::Marshal(cl_kernel k, 
int argno, int)
 return 1;
 }
 
+/// A mixed string/numberic vector
+class DynamicKernelMixedArgument: public DynamicKernelArgument
+{
+public:
+DynamicKernelMixedArgument(const std::string &s,
+FormulaTreeNodeRef ft):
+DynamicKernelArgument(s, ft), mStringArgument(s+"s", ft) {}
+virtual void GenSlidingWindowDecl(std::stringstream& ss) const
+{
+DynamicKernelArgument::GenSlidingWindowDecl(ss);
+ss << ", ";
+mStringArgument.GenSlidingWindowDecl(ss);
+}
+virtual void GenSlidingWindowFunction(std::stringstream &) {}
+/// Generate declaration
+virtual void GenDecl(std::stringstream &ss) const
+{
+DynamicKernelArgument::GenDecl(ss);
+ss << ", ";
+mStringArgument.GenDecl(ss);
+}
+virtual void GenDeclRef(std::stringstream &ss) const
+{
+DynamicKernelArgument::GenDeclRef(ss);
+ss << ",";
+mStringArgument.GenDeclRef(ss);
+}
+virtual std::string GenSlidingWindowDeclRef(bool) const
+{
+std::stringstream ss;
+ss << "(!isNan(" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
+ss << ")?" << DynamicKernelArgument::GenSlidingWindowDeclRef(ss);
+ss << ":" << mStringArgument.GenSlidingWindowDeclRef(ss);
+ss << ")";
+return ss.str();
+}
+virtual size_t Marshal(cl_kernel k, int argno, int vw)
+{
+int i = DynamicKernelArgument::Marshal(k, argno, vw);
+i += mStringArgument.Marshal(k, argno+i, vw);
+return i;
+}

[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

2013-10-29 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   18 --
 sc/source/core/opencl/opbase.hxx |4 +++-
 2 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 5ebecfc110f2c31e7bcef1c6e0a8fb2f6f1d56d5
Author: I-Jui (Ray) Sung 
Date:   Tue Oct 29 17:06:53 2013 -0500

Include a message for unhandled-token in OCL group interpreter.

Also added sanity checks for unhandled cases; i.e. mixed string/numeric
in SingleVectorRefs

Change-Id: I448536f45ec6cf9bc870671646c5ed4ee83ac9f8

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 229b639..c83715e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -807,14 +807,19 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const std::string &s,
 const formula::SingleVectorRefToken* pSVR =
 dynamic_cast< const formula::SingleVectorRefToken* 
>(pChild);
 assert(pSVR);
-if (pSVR->GetArray().mpNumericArray)
+if (pSVR->GetArray().mpNumericArray &&
+!pSVR->GetArray().mpStringArray)
 mvSubArguments.push_back(
 SubArgument(new DynamicKernelArgument(ts,
 ft->Children[i])));
-else
+else if (!pSVR->GetArray().mpNumericArray &&
+pSVR->GetArray().mpStringArray)
 mvSubArguments.push_back(
 SubArgument(new DynamicKernelStringArgument(
 ts, ft->Children[i])));
+else
+throw UnhandledToken(pChild,
+"Got both numeric and string vector");
 } else if (pChild->GetType() == formula::svDouble) {
 mvSubArguments.push_back(
 SubArgument(new DynamicKernelConstantArgument(ts,
@@ -824,7 +829,7 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const std::string &s,
 SubArgument(new ConstStringArgument(ts,
 ft->Children[i])));
 } else {
-throw UnhandledToken(pChild);
+throw UnhandledToken(pChild, "unknown operand for ocPush");
 }
 break;
 case ocDiv:
@@ -1095,7 +1100,7 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const std::string &s,
 }
 break;
 default:
-throw UnhandledToken(pChild);
+throw UnhandledToken(pChild, "unhandled opcode");
 };
 }
 }
@@ -1414,8 +1419,9 @@ bool FormulaGroupInterpreterOpenCL::interpret( 
ScDocument& rDoc,
 return true;
 }
 #undef NO_FALLBACK_TO_SWINTERP /* undef this for non-TDD runs */
-catch (const UnhandledToken&) {
-std::cerr << "Dynamic formual compiler: unhandled token\n";
+catch (const UnhandledToken &ut) {
+std::cerr << "\nDynamic formual compiler: unhandled token: ";
+std::cerr << ut.mMessage << "\n";
 #ifdef NO_FALLBACK_TO_SWINTERP
 assert(false);
 #else
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 93f6820..a858ede 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -25,8 +25,10 @@ namespace sc { namespace opencl {
 class UnhandledToken
 {
 public:
-UnhandledToken(formula::FormulaToken *t): mToken(t) {}
+UnhandledToken(formula::FormulaToken *t,
+const char *const m): mToken(t), mMessage(m) {}
 formula::FormulaToken *mToken;
+std::string mMessage;
 };
 
 /// Failed in marshaling
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2013-10-29 Thread Ray
 sc/source/core/opencl/formulagroupcl.cxx |   18 --
 sc/source/core/opencl/opbase.hxx |4 +++-
 2 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 43a61b3dd74c059a690b9cf46d294c2908212557
Author: I-Jui (Ray) Sung 
Date:   Tue Oct 29 17:06:53 2013 -0500

Include a message for unhandled-token in OCL group interpreter.

Also added sanity checks for unhandled cases; i.e. mixed string/numeric
in SingleVectorRefs

Change-Id: I448536f45ec6cf9bc870671646c5ed4ee83ac9f8

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 229b639..c83715e 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -807,14 +807,19 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const std::string &s,
 const formula::SingleVectorRefToken* pSVR =
 dynamic_cast< const formula::SingleVectorRefToken* 
>(pChild);
 assert(pSVR);
-if (pSVR->GetArray().mpNumericArray)
+if (pSVR->GetArray().mpNumericArray &&
+!pSVR->GetArray().mpStringArray)
 mvSubArguments.push_back(
 SubArgument(new DynamicKernelArgument(ts,
 ft->Children[i])));
-else
+else if (!pSVR->GetArray().mpNumericArray &&
+pSVR->GetArray().mpStringArray)
 mvSubArguments.push_back(
 SubArgument(new DynamicKernelStringArgument(
 ts, ft->Children[i])));
+else
+throw UnhandledToken(pChild,
+"Got both numeric and string vector");
 } else if (pChild->GetType() == formula::svDouble) {
 mvSubArguments.push_back(
 SubArgument(new DynamicKernelConstantArgument(ts,
@@ -824,7 +829,7 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const std::string &s,
 SubArgument(new ConstStringArgument(ts,
 ft->Children[i])));
 } else {
-throw UnhandledToken(pChild);
+throw UnhandledToken(pChild, "unknown operand for ocPush");
 }
 break;
 case ocDiv:
@@ -1095,7 +1100,7 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const std::string &s,
 }
 break;
 default:
-throw UnhandledToken(pChild);
+throw UnhandledToken(pChild, "unhandled opcode");
 };
 }
 }
@@ -1414,8 +1419,9 @@ bool FormulaGroupInterpreterOpenCL::interpret( 
ScDocument& rDoc,
 return true;
 }
 #undef NO_FALLBACK_TO_SWINTERP /* undef this for non-TDD runs */
-catch (const UnhandledToken&) {
-std::cerr << "Dynamic formual compiler: unhandled token\n";
+catch (const UnhandledToken &ut) {
+std::cerr << "\nDynamic formual compiler: unhandled token: ";
+std::cerr << ut.mMessage << "\n";
 #ifdef NO_FALLBACK_TO_SWINTERP
 assert(false);
 #else
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 93f6820..a858ede 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -25,8 +25,10 @@ namespace sc { namespace opencl {
 class UnhandledToken
 {
 public:
-UnhandledToken(formula::FormulaToken *t): mToken(t) {}
+UnhandledToken(formula::FormulaToken *t,
+const char *const m): mToken(t), mMessage(m) {}
 formula::FormulaToken *mToken;
+std::string mMessage;
 };
 
 /// Failed in marshaling
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'private/kohei/calc-group-interpreter-4-dynamic-kernels-reviewed'

2013-10-28 Thread Ray
New branch 'private/kohei/calc-group-interpreter-4-dynamic-kernels-reviewed' 
available with the following commits:
commit 46ea7471512afb31fb00f25a6d1ac76e2ddc0304
Author: I-Jui (Ray) Sung 
Date:   Sun Oct 27 19:15:08 2013 -0500

Throw exceptions for unhandled functions in GPU group interpreter.

Throw exceptions when seeing unhandled opcode and OpenCL failures,
instead of assertion failure in the GPU Calc group interpreter to allow
graceful falling-back to SW interpreter.

Change-Id: Ie19c1a300ae5db9bdbf90eb8a9dbca3f2611b770

commit 201706631a479c30a0a42f46cc2524a8744cfbec
Author: I-Jui (Ray) Sung 
Date:   Sun Oct 27 18:30:57 2013 -0500

Re-enable testcases

Change-Id: Ic70f436b5238a4d9df27599f0a93ca8223a63e15

commit 0c733b5039e8a5fa6dcb6a035eefc7fbb8ea0443
Author: I-Jui (Ray) Sung 
Date:   Sun Oct 27 18:13:54 2013 -0500

Rebase to calc-group-interpreter-4

Change-Id: I4d98e88c4fcdf8c6e5ecbf31bc181dd186a85c9b

commit 63b3ba0d494b850919f979a5f4e9f0be0d3a0f59
Author: haochen 
Date:   Fri Oct 25 20:38:04 2013 +0800

Fix NAN argumetn in ground_water, stock_history, sum_ex

Change-Id: I10eae800889cd25e819720861a30e6b5edaca88b

Signed-off-by: Wei Wei 

commit 2cdb116a3b2a0f88ed8e0eb25404254ac0a36190
Author: haochen 
Date:   Fri Oct 25 20:26:51 2013 +0800

Fix bugs for SLN in GPU Calc

Change-Id: I78e42b0d5322abc15549d3e101a221774d3297e6

Signed-off-by: Wei Wei 

commit 70bb32fa24f350f72913150781e6332b75f5a63e
Author: haochen 
Date:   Fri Oct 25 20:20:19 2013 +0800

Fix bugs for SLN not cal by GPU

Change-Id: I3365942ae633763f5ef551ecb29a4f341604f991

Signed-off-by: Wei Wei 

commit 52e5154536a45ff13586d3f6c131f82071a7669f
Author: haochen 
Date:   Fri Oct 25 17:27:22 2013 +0800

Implement fix for bug of NAN argument in some finacial functions

Change-Id: I2a755ffd3b4455d3be7fab49ebbc9ecaa469b14b

Signed-off-by: Wei Wei 

commit a84afa26d351cefa85a84cdce4148b575aaaff3f
Author: haochen 
Date:   Fri Oct 25 12:44:43 2013 +0800

Implement fix for CSC in GPU Calc

Change-Id: I075f9951c07088a9b6346a7ffad6fb7e3284ea8a

Signed-off-by: Wei Wei 

commit 8a43a2534c76fca18744d057df0d3552ce5ea3b0
Author: haochen 
Date:   Fri Oct 25 12:38:59 2013 +0800

Testcases for CSC in GPU Calc

Change-Id: Ie2d85b5566a3f87224707a2e28b14fba0b75ad46

Signed-off-by: Wei Wei 

commit 84ceedc2b2be60a17a0796b5b50ba159e1132c66
Author: haochen 
Date:   Fri Oct 25 12:24:51 2013 +0800

Fix release of CSC-COTH in GPU Calc

Change-Id: I4be62550127f88c3dce28fd8b27059d10980efa4

Signed-off-by: Wei Wei 

commit 8380699a647a9b78bad959fe177d0a5a335fcc70
Author: haochen 
Date:   Fri Oct 25 11:15:51 2013 +0800

Implement fix for RSQ in GPU Calc

Change-Id: I15c12ea18541bbad23f17349acd1f7c1bcca69bc

Signed-off-by: Wei Wei 

commit ed14e7e6efe4d05dc63e66015c6b5744dc942a44
Author: haochen 
Date:   Fri Oct 25 11:05:42 2013 +0800

Testcases for RSQ in GPU Calc

Change-Id: I5e70883fa61da2afbe7254ecb448fcfd0abb41a3

Signed-off-by: Wei Wei 

commit 24cbf05182e7e26c9ca1f0d1417c2f55e83cd55c
Author: haochen 
Date:   Fri Oct 25 10:53:21 2013 +0800

Implement fix for PEARSON in GPU Calc

Change-Id: I16aeba7c889677119995939a35be6ccad2517725

Signed-off-by: Wei Wei 

commit b05a38e4fd1ed8004296863f10f8df3762999703
Author: haochen 
Date:   Fri Oct 25 10:44:38 2013 +0800

Testcases for PEARSON in GPU Calc

Change-Id: Ife42fa3dba9e1ced92fd2465558bdc12c3ab5a9b

Signed-off-by: Wei Wei 

commit 8985669eeffb955c3028e90f24219084d95a77f0
Author: haochen 
Date:   Fri Oct 25 10:36:05 2013 +0800

Implement fix for NEGBINOMDIST in GPU Calc

Change-Id: I327737e899b88448a195f6d990a9a6552346a74c

Signed-off-by: Wei Wei 

commit 99857b4ae8f117f92db8d970a6feb90ffa7fa31b
Author: haochen 
Date:   Fri Oct 25 10:21:39 2013 +0800

Testcases for NEGBINOMDIST in GPU Calc

Change-Id: I19d3a98e8356600ead7d6a380159f1331c75b071

Signed-off-by: Wei Wei 

commit a79289e6eda152af35a5a5187705b0303c79df7b
Author: haochen 
Date:   Fri Oct 25 10:12:11 2013 +0800

Fix release for NEGBINOMDIST in GPU Calc

Change-Id: I127657b20b905e3f9fed1bc9222cd62de0adb187

Signed-off-by: Wei Wei 

commit 8609a330aa464a84d1c9f168844c2152223617ab
Author: haochen 
Date:   Fri Oct 25 10:05:54 2013 +0800

Implement fix for COS in GPU Calc

Change-Id: I2f64599a0f26366214ae99294d27606620e11046

Signed-off-by: Wei Wei 

commit e6db14ba40d031bc1054e4f65bcafaed7f1bb16a
Author: haochen 
Date:   Fri Oct 25 09:58:14 2013 +0800

Testcases for COS in GPU Calc

Change-Id: Ib28e97de5847e635d8d41d481b1024bd2f14cf59

Signed-off-by: Wei Wei 

commit d0241cb7818d5122fba17e2f785b481564f90506
Author: haochen 
Date:   Fri Oct 25 09:52:38 2013 +0800

Fix release of 

Re: [Libreoffice] SolidMarkHandles - [PATCH] removed Simple Handles option entries from help

2011-11-10 Thread ray
I have removed both my gmail, and this e-mail from this list, why am i
still receiving e-mails?

> On 11/10/2011 05:10 PM, Michael Meeks wrote:
>>> I miss changes in the help files
>>  Right ! any chance you can dig into that Tim ? (wow you'll have seen
>> ~all of the suite after this task ;-).
> Sure, I think this should be it.
>
> Tim
>
> --
> SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
> Imendörffer, HRB 16746 (AG Nürnberg)
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> T: +49 (0) 911 74053-0  F: +49 (0) 911 74053-483
> http://www.suse.de/
>
> ___
> LibreOffice mailing list
> LibreOffice@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] G5, can not save files

2011-06-22 Thread ray brunkow
I still have an older iMAC G5 and have been using NeoOffice for years.
When I made the move to LibreOffice on that computer it now crashes
anytime you try to save a document to any location but the default
causing mass loss of data.

I dont know if this is a known issue or something new for you guys.  If
it is a known issue are their any work-arounds or patches in the mix I
could try or grab.

 Thank you.

 Ray



-- 
Raymond L. Brunkow
5th Degree Black Belt
Nationally Certified Instructor
Choong Sil Kwan TaekwonDo
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] fdo#31251 Writer & Impress shadow consistency

2011-05-04 Thread Sébastien Le Ray
Le Tue, 3 May 2011 14:23:44 +0200,
David Tardon  a écrit :

> On Sat, Apr 30, 2011 at 06:58:29PM +0200, Sébastien Le Ray wrote:
> >  if(aShadowColor != SwViewOption::GetShadowColor() ) {
> >  aShadowColor = SwViewOption::GetShadowColor();
> > -AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK
> > ) );
> > -Bitmap aFilledSquare( Size( mnShadowPxWidth,
> > mnShadowPxWidth ), 24 );
> > -aFilledSquare.Erase( aShadowColor );
> >  
> > +AlphaMask aMask( shadowMask.getBottomRight().GetBitmap() );
> > +Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
> > +aFilledSquare.Erase( aShadowColor );
> > ...
> 
> This looks like a good candidate for a function... Like
> 
> void lcl_createShadow(Color const& rColor, BitmapEx const& rMask,
> BitmapEx& rShadow)
> {
> AlphaMask aMask( rMask.GetBitmap() );
> Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
> aFilledSquare.Erase( rColor );
> rShadow = aFilledSquare;
> }
> 
> But this is really just "nice to have", not a blocker :)

OK, I'll try to find some time to write it

> [...]
> Do I count wrong or is the right shadow painted over the bottom right
> corner shadow? And the same for left shadow lower.

Well, it shouldn't since we do not have visual overlap. Corners are
17px large, 8 of them come to the adjacent borders so we scale borders
to remove those 8px…

> 
> > @@ -5326,20 +5326,19 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth =
> > 9; aPageTopRightShadow );
> >  BitmapEx aPageRightShadow = aPageRightShadowBase;
> >  aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 *
> > (mnShadowPxWidth - 1) );
> > -
> > pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPagePxRect.Right()
> > + 1, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageRightShadow );
> > +
> > pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() +
> > mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1) ),
> > aPageRightShadow );
> 
> Is this really correct? AFAICS it moves the shadow too much to the
> right... And if it is correct, why the corner shadows do not need to
> be adjusted too?

Still because of the fact we've the 8px overlapping the adjacent
border. I guess this picture
http://misc.orniz.org/libreoffice/shadow-decomposition.png should make
things clearer.
As you can see, Paint rect is only used for corners shadow left/right
adjustment


Sébastien


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] fdo#31251 - Improve default page layout

2011-04-18 Thread Sébastien Le Ray
Le Mon, 18 Apr 2011 23:53:56 +0200,
Christoph Noack  a écrit :

> Hi Sébastien, all!
> 
> Am Montag, den 18.04.2011, 22:47 +0200 schrieb Sébastien Le Ray:
> > Le Sat, 16 Apr 2011 15:08:23 +0200,
> > Christoph Noack  a écrit :
> [...]
> > > Am Samstag, den 16.04.2011, 15:01 +0200 schrieb Sébastien Le Ray:
> > > > Le Sat, 16 Apr 2011 14:58:46 +0200,
> > > [...]
> > > 
> > > > > @ Sébastien: Would it be possible that you'll have a look how
> > > > > it is implemented. Any chance that we - as Thomas mentioned -
> > > > > get this streamlined throughout the applications?
> > > > 
> > > > Yes I'm gonna check this out… [...]
> > > 
> > > I don't think so ... last time we discussed that at OOo, the
> > > shadow improvements were related to Renaissance. And the
> > > Renaissance project explicitly addressed Impress (and Draw, since
> > > it is based on the very same code base). So we may have some
> > > further benefit with Writer :-)
> > 
> > I looked at sd code, they've done mostly what I planned to do. As I
> > previously said, impress/draw and writer code differs on a design
> > point of view so I cannot reuse it as is.
> 
> Okay, so the only chance it to let it look similar.
> 
> > We've a 4 sided shadow, should I port it Writer as is or are their
> > request of improvment? Should I let the color configuration option
> > for shadow color and use the value under draw or just drop it?
> 
> Not an easy answer, so a step-by-step approach ... easy to tough
> questions:
>   * Their shadow looks very good (what I could see in my VM) -->
> It would already be an improvement to "copy" it to Writer (just out
> of curiousity: how did they implement them - masks, bitmaps
> with alpha channel, ...)

They used a simple bimap. Their approach is more or less the same as
the first implementation I did (when no color configuration was
possible), except they just use one bitmap that they split at
predefined positions instead of having one bitmap per side/corner.

> 
>   * The shadow color configuration might be dropped --> At least
> if we can find a shadow that works well on most backgrounds (e.g.
> finding an appropriate color, or calculating the shadow based
> on the application background color - preferred). That would save
> users a bit effort and help the translation / documentation
> teams as well.
>

I guess the current impress shadow should be nice on any background
since there is an alpha channel and no area has a full opacity…
 
>   * Anyway, it would be good to have a bit more control how the
> shadow was created, because we might need matching shadows for
> other objects (e.g. Notes, Panes, ...) --> I think, the
> specification we've started is a good basis, so do you think
> we can continue with that (see my note below, please). I just need
> to know what graphics we can use to realize good effects at
> the document edges (see my last mail).

I can't find the mail about the document corners… I attached you the
bitmap used in impress to draw the shadow.

> 
>   * A more attractive document background is still desirable -->
> can we go with a gradient in the next step?

I think we'll have to test how gradients can be used to get a nice
background. Keeping in mind that current gradient implementation
focuses on performances rather than on quality…

> 
> Note: During the weekend, I've started to redo some of the graphics
> for the specification page - but I haven't uploaded them yet. At the
> moment, some further (independent) thoughts led to a shadow that's
> very close to the Impress one.
> 
> Sorry for the many questions / comments - but I'd like to understand
> more what's needed and how a solution might look like that's
> comfortable (so to say) to implement.
> 
> As always - thanks in advance :-)

I'll try to quickly implement and push impress shadow to sw so you can
see the result throught the nightlies

> 
> Cheers,
> Christoph
> 


Regards,

Sébastien
<>

signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] fdo#31251 - Improve default page layout

2011-04-18 Thread Sébastien Le Ray
Le Sat, 16 Apr 2011 15:08:23 +0200,
Christoph Noack  a écrit :

> Hi Sébastien!
> 
> Thanks for the ultra-fast reply :-)
> 
> Am Samstag, den 16.04.2011, 15:01 +0200 schrieb Sébastien Le Ray:
> > Le Sat, 16 Apr 2011 14:58:46 +0200,
> 
> [...]
> 
> > > @ Sébastien: Would it be possible that you'll have a look how it
> > > is implemented. Any chance that we - as Thomas mentioned - get
> > > this streamlined throughout the applications?
> > > 
> > 
> > Yes I'm gonna check this out… But If nothing more has changed, the
> > way page redraw is handled in writer is much more different than
> > the way it is in draw… What we do not know is if OOo did the work
> > for writer too and we've overriden it or if it hasn't been done…
> 
> I don't think so ... last time we discussed that at OOo, the shadow
> improvements were related to Renaissance. And the Renaissance project
> explicitly addressed Impress (and Draw, since it is based on the very
> same code base). So we may have some further benefit with Writer :-)
> 

I looked at sd code, they've done mostly what I planned to do. As I
previously said, impress/draw and writer code differs on a design point
of view so I cannot reuse it as is.

We've a 4 sided shadow, should I port it Writer as is or are their
request of improvment? Should I let the color configuration option for
shadow color and use the value under draw or just drop it?

Regards

Sébastien


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] fdo#31251 - Improve default page layout

2011-04-16 Thread Sébastien Le Ray
Le Sat, 16 Apr 2011 14:58:46 +0200,
Christoph Noack  a écrit :

> Hi Sébastien, Thomas, all!
> 
> Am Samstag, den 16.04.2011, 14:41 +0200 schrieb Sébastien Le Ray: 
> > Le Sat, 16 Apr 2011 13:31:58 +,
> > Thomas Arnhold  a écrit :
> > > I like your patches for the new smooth shadow.
> > > 
> > > I looked around the other LibO apps like Impress or Draw. They
> > > have this shadow already, but it's not as width as in Writer and
> > > it's on all sides. Maybe we should do it in Writer as in Draw and
> > > Impress. Looks better I think. Here is what I mean:
> > > 
> > > http://infoo.org/shot-20110323-062300.png
> 
> > I was planning to go on on draw & impress this week but it seems
> > someone already did the job… I don't know where this shadow comes
> > from, maybe from the OOo integration… I can't see any git log
> > message related to it
> 
> Yes, this is very likely ... that was something being planned since
> several months (based on UX team discussions), but I didn't knew that
> the Impress team finally implemented that.
> 
> @ Thomas: Do you have some screenshots how it looks like? I plan to
> have a look at a recent daily build, so I hope to have a look at it.
> 
> @ Sébastien: Would it be possible that you'll have a look how it is
> implemented. Any chance that we - as Thomas mentioned - get this
> streamlined throughout the applications?
> 

Yes I'm gonna check this out… But If nothing more has changed, the way
page redraw is handled in writer is much more different than the way it
is in draw… What we do not know is if OOo did the work for writer too
and we've overriden it or if it hasn't been done…


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PATCH] fdo#31251 - Improve default page layout

2011-04-16 Thread Sébastien Le Ray
Le Sat, 16 Apr 2011 13:31:58 +,
Thomas Arnhold  a écrit :

> Hi,
> 
> I like your patches for the new smooth shadow.
> 
> I looked around the other LibO apps like Impress or Draw. They have
> this shadow already, but it's not as width as in Writer and it's on
> all sides. Maybe we should do it in Writer as in Draw and Impress.
> Looks better I think. Here is what I mean:
> 
> http://infoo.org/shot-20110323-062300.png
> 
> Thomas
> 

Hi,

I was planning to go on on draw & impress this week but it seems
someone already did the job… I don't know where this shadow comes from,
maybe from the OOo integration… I can't see any git log message related
to it

Sebastien


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PUSHED] fdo#31251 - Improve default page layout

2011-03-08 Thread Sébastien Le Ray
Le Thu, 03 Mar 2011 11:59:19 +,
Michael Meeks  a écrit :

> Hi Sebastien,
> 
> On Tue, 2011-03-01 at 23:42 +0100, Sébastien Le Ray wrote:
> > Here is a complete patch for fdo#31251. It adds a smooth shadow to
> > the page.
> 
>   Wow - it is really pretty indeed :-) I just pushed it. Nice
> work ! can you confirm is it LGPLv3+/MPL ?
> 
>   Incidentally, it would be lovely to have the post-it notes,
> not only to have a border, but to have curved corners at the bottom,
> but not the top, so they really look like sticky notes. ie. take a
> sticky note an stick it flat on your desk, and you see the effect
> [ both bottom corners curl slightly ] ;-) possibly that will require
> some (manual?) re-coloring action of the bitmaps, which might be
> slightly painful, though I guess it is just a matter of keeping a
> constant AlphaMask bitmap around, and merging it into a BitmapEx with
> a Bitmap (of the same size obviously) 'Erase'd with the correct color
> for the note.
> 
> > During its development, I found that SwRect::_Intersection (used in
> > page margin painting) returns negative height/width if the two
> > rectangles do not overlap. I don't know if it is the expected
> > behavior or a bug. If it's a bug I guess I can provide a patch.
> 
>   Ho hum - probably a difficult one to audit for, to check
> every location to ensure they are not depending on this. Possibly it
> makes the impl. faster too (?).
> 
>   Well worth documenting though in the API.
> 
>   Thanks !
> 
>   Michael.
>

Hi,

this simple shadow patch has generated a long discussion on
Libreoffice-design. Some people don't like the color, some people don't
like the amount of blur, some people want no shadow at all, some people
want a "4 borders" shadow. So here is a second patchset that tries to
address the first three critics :
 - It adds a configuration option (in Appearance category) to set shadow
   color. It currently defaults to gray but I'm sure design team will
   find a more sensitive default :
 - It adds a configuration option to disable shadow;
 - It doesn't use bitmaps directly anymore but an alpha mask, so if
   people want to try another blur effect, they just have to edit
   images.zip:/sw/res/page-*-shadow-mask.png These are black & white
   image. Black amount determines transparency, white being fully
   transparent. Here again, I'm sure that design people will find a
   better default. Only constraints are 1x10px for bottom shadow,
   10x10px for corner and 10x1px for right shadow.
I'll let design team play and discuss with that, when they agree on a
default, I'll provide an additional patch to take it into account.

Note: I had to perform a make dev-install for settings to be correctly
saved.

Regards

Sébastien
From 56705efe8542ad48d7e2b498d702c067878aab26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= 
Date: Tue, 8 Mar 2011 08:02:08 +0100
Subject: [PATCH] Added shadow color configuration save.

---
 svtools/inc/svtools/colorcfg.hxx   |1 +
 svtools/source/config/colorcfg.cxx |2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/svtools/inc/svtools/colorcfg.hxx b/svtools/inc/svtools/colorcfg.hxx
index 6231685..5c95dc1 100644
--- a/svtools/inc/svtools/colorcfg.hxx
+++ b/svtools/inc/svtools/colorcfg.hxx
@@ -51,6 +51,7 @@ enum ColorConfigEntry
 ANCHOR  ,
 SPELL ,
 SMARTTAGS ,
+SHADOWCOLOR ,
 WRITERTEXTGRID  ,
 WRITERFIELDSHADINGS ,
 WRITERIDXSHADINGS ,
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index c98c885..7be72cf 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -137,6 +137,7 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString&
 { RTL_CONSTASCII_USTRINGPARAM("/Anchor")  ,sal_False },
 { RTL_CONSTASCII_USTRINGPARAM("/Spell") ,sal_False },
 { RTL_CONSTASCII_USTRINGPARAM("/SmartTags") ,sal_False },
+{ RTL_CONSTASCII_USTRINGPARAM("/Shadow"), sal_True },
 { RTL_CONSTASCII_USTRINGPARAM("/WriterTextGrid")  ,sal_False },
 { RTL_CONSTASCII_USTRINGPARAM("/WriterFieldShadings"),sal_True },
 { RTL_CONSTASCII_USTRINGPARAM("/WriterIdxShadings") ,sal_True },
@@ -428,6 +429,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
 0, // ANCHOR
 0xff, // SPELL
 COL_LIGHTMAGENTA,// SMARTTAGS
+COL_GRAY, // SHADOWCOLOR
 0xc0c0c0, // WRITERTEXTGRID
 0xc0c0c0, // WRITERFIELDSHADIN
 0xc0c0c0, // WRITERIDXSHADINGS
-- 
1.7.4.1

From c30a7d8001c04bacead8b72c175e640e76

Re: [Libreoffice] [PUSHED] fdo#31251 - Improve default page layout

2011-03-03 Thread Sébastien Le Ray
Le Thu, 03 Mar 2011 21:35:11 +0100,
Christoph Noack  a écrit :

> Hi Sébastien, hi all!
> 

Hi

> Am Donnerstag, den 03.03.2011, 14:16 +0100 schrieb Sébastien Le Ray:
> > Le Thu, 03 Mar 2011 11:59:19 +,
> > Michael Meeks  a écrit :
> > 
[...]
> 
> Although I didn't see it yet, thanks for your work - I'm really
> looking forward.

You can find a screenshot on
http://misc.orniz.org/libreoffice/lo-shadow.png book mode is also
handled nicely...

[...]


> However, I'd like to provide some pointers to the Notes stuff - it's
> really worth spending some time digging through some of the
> descriptions (in my point-of-view). I think this is better than
> pre-process most of the stuff, since I'm unaware of your likings :-)
> 
> The notes main wiki page (Notes2 because of the CWS that time):
> http://wiki.services.openoffice.org/wiki/Notes2
> 
> Here are the links to the detailed designs that had (sometimes) to be
> adapted due to technical constraints nobody spent the time for:
> http://wiki.services.openoffice.org/wiki/Notes2#Status_and_Proposals
> 
> And once finished with the default stuff, we have lots of further
> ideas: http://wiki.services.openoffice.org/wiki/Notes2_OtherIdeas
> 
> 
> Personally, I've already spend over one year with the Notes project
> being the UX representative, so I'd like to work with you on that - if
> you like :-)

I'll be pleased to :) It'd be nice to have a "UI tasks" on libreoffice
wiki presenting all tasks that are ready on a Design point of view but
that have not yet been implemented.
There is a lot of stuff on the Note2 wiki page, could you give
priorities on various items?

[...]

> 
> If you are generally interested in working on Usability / Visual
> Design topics (of course, from the developer's point-of-view - and we
> really need some understanding and support here), feel invited to
> subscribe to the Design Team mailing list - some more information can
> be found here: http://wiki.documentfoundation.org/Design

Subscribed yesterday :-)
It seems that you've been busy with more "marketting" stuff that UI
design lately to cover the launch of LO, FOSDEM and funraising

Waiting for you priorities & mockups on notes work :-)

Sébastien

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [PUSHED] fdo#31251 - Improve default page layout

2011-03-03 Thread Sébastien Le Ray
Le Thu, 03 Mar 2011 11:59:19 +,
Michael Meeks  a écrit :

> Hi Sebastien,
> 
> On Tue, 2011-03-01 at 23:42 +0100, Sébastien Le Ray wrote:
> > Here is a complete patch for fdo#31251. It adds a smooth shadow to
> > the page.
> 
>   Wow - it is really pretty indeed :-) I just pushed it. Nice
> work ! can you confirm is it LGPLv3+/MPL ?

Yes it is licensed under LGPLv3+/MPL. I forgot to specify this all
times :)

> 
>   Incidentally, it would be lovely to have the post-it notes,
> not only to have a border, but to have curved corners at the bottom,
> but not the top, so they really look like sticky notes. ie. take a
> sticky note an stick it flat on your desk, and you see the effect
> [ both bottom corners curl slightly ] ;-) possibly that will require
> some (manual?) re-coloring action of the bitmaps, which might be
> slightly painful, though I guess it is just a matter of keeping a
> constant AlphaMask bitmap around, and merging it into a BitmapEx with
> a Bitmap (of the same size obviously) 'Erase'd with the correct color
> for the note.

Notes are my next target, but I'd feel more comfortable if people could
give ideas on various UI things so I can see if I can patch it... I'm
not a UI expert (and I'm colorblind so that's really not my primary
area) but I like graphical programming since that the more visible. As
I said you earlier, I really think some design guys should provide
mockups to implement, maybe we should have a place appart from the
bugzilla to allow people to report UI/UX improvments. UI is a very
important thing now that LO as strong bases, we shouldn't neglect it.

> 
> > During its development, I found that SwRect::_Intersection (used in
> > page margin painting) returns negative height/width if the two
> > rectangles do not overlap. I don't know if it is the expected
> > behavior or a bug. If it's a bug I guess I can provide a patch.
> 
>   Ho hum - probably a difficult one to audit for, to check
> every location to ensure they are not depending on this. Possibly it
> makes the impl. faster too (?).
> 

Yes we talked about this with Cédric Bosdonnat and agreed that there
might some piece of code relying on that behavior...

Sébastien


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [PATCH] fdo#31251 - Improve default page layout

2011-03-01 Thread Sébastien Le Ray
   case sw::sidebarwindows::SIDEBAR_RIGHT:
 {
-nPageLeft =  aPageRect.Left() - nBorderWidth;
-nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth + nSidebarWidth;
+nPageLeft =  aPageRect.Left();
+nPageRight = aPageRect.Right() + nShadowWidth + nSidebarWidth;
 }
 break;
 case sw::sidebarwindows::SIDEBAR_NONE:
-- 
1.7.2.3

From 8a1fd1d4850b4f61ffc175766d0aa0dcc2f8526a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= 
Date: Sun, 27 Feb 2011 17:23:48 +0100
Subject: [PATCH 1/7] FDO#31251 - Add resources files for page shadow

---
 sw/inc/rcid.hrc   |5 
 sw/source/core/inc/pagefrm.hrc|   49 +
 sw/source/core/layout/makefile.mk |4 +++
 sw/source/core/layout/pagefrm.src |   27 
 sw/util/makefile.mk   |1 +
 5 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 sw/source/core/inc/pagefrm.hrc
 create mode 100644 sw/source/core/layout/pagefrm.src

diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc
index f5fe008..f06180a 100644
--- a/sw/inc/rcid.hrc
+++ b/sw/inc/rcid.hrc
@@ -79,6 +79,7 @@
 #define RC_SMARTTAG(RC_BASE + 3950)  // SMARTTAGS
 #define RC_UNOCORE  (RC_BASE + 4050)
 #define RC_ANNOTATION   (RC_BASE + 4150)
+#define RC_PAGEFRM  (RC_BASE + 4250)
 
 /*
 Beschreibung:	Bereiche ausspannen
@@ -100,6 +101,10 @@
 #define RC_ANNOTATION_BEGIN RC_ANNOTATION
 #define RC_ANNOTATION_END   (RC_ANNOTATION_BEGIN + 99)
 
+// Page frame
+#define RC_PAGEFRM_BEGINRC_PAGEFRM
+#define RC_PAGEFRM_EN   (RC_PAGEFRM + 99)
+
 // SW/Web
 #define RC_WEB_BEGINRC_WEB
 #define RC_WEB_END  (RC_WEB_BEGIN + 199)
diff --git a/sw/source/core/inc/pagefrm.hrc b/sw/source/core/inc/pagefrm.hrc
new file mode 100644
index 000..c72c212
--- /dev/null
+++ b/sw/source/core/inc/pagefrm.hrc
@@ -0,0 +1,49 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *   Sébastien Le Ray 
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _PAGEFRM_HRC
+#define _PAGEFRM_HRC
+
+#include "rcid.hrc"
+
+//  Bitmaps for page shadow
+#define BMP_PAGE_TOP_RIGHT_SHADOW  RC_PAGEFRM_BEGIN
+#define BMP_PAGE_RIGHT_SHADOW  RC_PAGEFRM_BEGIN + 1
+#define BMP_PAGE_BOTTOM_RIGHT_SHADOW   RC_PAGEFRM_BEGIN + 2
+#define BMP_PAGE_BOTTOM_SHADOW RC_PAGEFRM_BEGIN + 3
+#define BMP_PAGE_BOTTOM_LEFT_SHADOWRC_PAGEFRM_BEGIN + 4
+
+
+// If you add resources, don't forget to update this
+#define PAGEFRM_ACT_END   BMP_PAGE_BOTTOMLEFT_SHADOW
+
+// Sanity check
+#if PAGEFRM_ACT_END > RC_PAGEFRM_END
+#error Not enough room for pagefrm resource in #file:#line
+#endif
+
+#endif
diff --git a/sw/source/core/layout/makefile.mk b/sw/source/core/layout/makefile.mk
index e986ec8..6470592 100644
--- a/sw/source/core/layout/makefile.mk
+++ b/sw/source/core/layout/makefile.mk
@@ -89,6 +89,10 @@ SLOFILES =  \
 $(SLO)$/swselectionlist.obj \
 $(SLO)$/unusedf.obj
 
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+pagefrm.src
+
 .IF "$(DBG_LEVEL)">="2"
 SLOFILES +=  \
 $(SLO)$/dbg_lay.obj
diff --git a/sw/source/core/layout/pagefrm.src b/sw/source/core/layout/pagefrm.src
new file mode 100644
index 000..dfa9b2b
--- /dev/null
+++ b/sw/source/core/layout/pagefrm.src
@@ -0,0 +1,27 @@
+#include "pagefrm.hrc"
+
+Bitmap BMP_PAGE_TOP_RIGHT_SHADOW
+{
+File = "page-topright-shadow.png";
+};
+
+Bitmap BMP_PAGE_RIGHT_SHADOW
+{
+File = "page-right-shadow.png";
+};
+

Re: [Libreoffice] OString += OString + char ... ?

2011-02-28 Thread Sébastien Le Ray
Le Mon, 28 Feb 2011 21:45:36 +,
Caolán McNamara  a écrit :

> On Sun, 2011-02-27 at 04:27 -0500, Kevin Hunter wrote:
> Three possibilities I guess, 
> 
> 1) remove the "explicit", but I'm sure its there due to some other
> horribly implicit conversion horror
> 2) add a operator+(sal_Char), either one that "just works", or one
> that raises an error at compile time.
> 3) remove the const sal_Char* conversion operator (I'm tempted towards
> this one)

If someone takes this, he/She should add a operator[](int) to allow
byChar access (or a getChar method)...

Sébastien


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [PATCH][WIP] fdo#31251 - Improve default page layout

2011-02-27 Thread Sébastien Le Ray
C_ANNOTATION_BEGIN RC_ANNOTATION
 #define RC_ANNOTATION_END   (RC_ANNOTATION_BEGIN + 99)
 
+// Page frame
+#define RC_PAGEFRM_BEGINRC_PAGEFRM
+#define RC_PAGEFRM_EN   (RC_PAGEFRM + 99)
+
 // SW/Web
 #define RC_WEB_BEGINRC_WEB
 #define RC_WEB_END  (RC_WEB_BEGIN + 199)
diff --git a/sw/source/core/inc/pagefrm.hrc b/sw/source/core/inc/pagefrm.hrc
new file mode 100644
index 000..c72c212
--- /dev/null
+++ b/sw/source/core/inc/pagefrm.hrc
@@ -0,0 +1,49 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *   Sébastien Le Ray 
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _PAGEFRM_HRC
+#define _PAGEFRM_HRC
+
+#include "rcid.hrc"
+
+//  Bitmaps for page shadow
+#define BMP_PAGE_TOP_RIGHT_SHADOW  RC_PAGEFRM_BEGIN
+#define BMP_PAGE_RIGHT_SHADOW  RC_PAGEFRM_BEGIN + 1
+#define BMP_PAGE_BOTTOM_RIGHT_SHADOW   RC_PAGEFRM_BEGIN + 2
+#define BMP_PAGE_BOTTOM_SHADOW RC_PAGEFRM_BEGIN + 3
+#define BMP_PAGE_BOTTOM_LEFT_SHADOWRC_PAGEFRM_BEGIN + 4
+
+
+// If you add resources, don't forget to update this
+#define PAGEFRM_ACT_END   BMP_PAGE_BOTTOMLEFT_SHADOW
+
+// Sanity check
+#if PAGEFRM_ACT_END > RC_PAGEFRM_END
+#error Not enough room for pagefrm resource in #file:#line
+#endif
+
+#endif
diff --git a/sw/source/core/layout/makefile.mk b/sw/source/core/layout/makefile.mk
index e986ec8..6470592 100644
--- a/sw/source/core/layout/makefile.mk
+++ b/sw/source/core/layout/makefile.mk
@@ -89,6 +89,10 @@ SLOFILES =  \
 $(SLO)$/swselectionlist.obj \
 $(SLO)$/unusedf.obj
 
+SRS1NAME=$(TARGET)
+SRC1FILES =\
+pagefrm.src
+
 .IF "$(DBG_LEVEL)">="2"
 SLOFILES +=  \
 $(SLO)$/dbg_lay.obj
diff --git a/sw/source/core/layout/pagefrm.src b/sw/source/core/layout/pagefrm.src
new file mode 100644
index 000..dfa9b2b
--- /dev/null
+++ b/sw/source/core/layout/pagefrm.src
@@ -0,0 +1,27 @@
+#include "pagefrm.hrc"
+
+Bitmap BMP_PAGE_TOP_RIGHT_SHADOW
+{
+File = "page-topright-shadow.png";
+};
+
+Bitmap BMP_PAGE_RIGHT_SHADOW
+{
+File = "page-right-shadow.png";
+};
+
+Bitmap BMP_PAGE_BOTTOM_RIGHT_SHADOW
+{
+File = "page-bottomright-shadow.png";
+};
+
+Bitmap BMP_PAGE_BOTTOM_SHADOW
+{
+File = "page-bottom-shadow.png";
+};
+
+Bitmap BMP_PAGE_BOTTOM_LEFT_SHADOW
+{
+File = "page-bottomleft-shadow.png";
+};
+
diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk
index 5539505..42132f1 100644
--- a/sw/util/makefile.mk
+++ b/sw/util/makefile.mk
@@ -53,6 +53,7 @@ sw_res_files= \
 $(SRS)$/frmdlg.srs   \
 $(SRS)$/globdoc.srs  \
 $(SRS)$/index.srs\
+$(SRS)$/layout.srs   \
 $(SRS)$/lingu.srs\
 $(SRS)$/misc.srs \
 $(SRS)$/ribbar.srs   \
-- 
1.7.2.3

From f6e5a082305f58f691e563cb5559cf83df916516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= 
Date: Sun, 27 Feb 2011 18:02:06 +0100
Subject: [PATCH 2/2] Draw smooth shadows around page and remove borders

---
 sw/source/core/inc/pagefrm.hxx |   29 -
 sw/source/core/layout/layact.cxx   |   12 +---
 sw/source/core/layout/paintfrm.cxx |  110 +--
 sw/source/core/view/viewsh.cxx |   11 +--
 4 files changed, 49 insertions(+), 113 deletions(-)

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index e6b86b5..3c0c1cb 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -87,8 +87,6 @@ class SwPageFrm: public SwFtnBossFrm
 // is in progress.
 bool mbLayoutInProgress;
 
-// #i9719#
-static const sal_Int8 mnBorderPxWidth;
 static const sal_Int8 mnShadowPxWidth;
 
 void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &,
@@ -97,28 +95,6 @@ class SwPageFrm: public SwFtnBossFrm
 // Anpassen der max. Fu

[Libreoffice] [PATCH] Remove include of no more existent errhdl.hxx

2011-02-22 Thread Sébastien Le Ray
Hi list,

This patch removes an include which prevent debug build of sw (the
file has been deleted in commit
6aa93c291d18c7db6dbee73adc6c4aa1bdc88eda.

Regards

Sébastien
diff --git a/sw/source/core/except/dbgloop.cxx b/sw/source/core/except/dbgloop.cxx
index ddb3a7b..370be63 100644
--- a/sw/source/core/except/dbgloop.cxx
+++ b/sw/source/core/except/dbgloop.cxx
@@ -34,7 +34,6 @@
 #endif
 #include 
 #include "dbgloop.hxx"
-#include "errhdl.hxx"
 
 DbgLoopStack DbgLoop::aDbgLoopStack;
 


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [PATCH] [EasyHacks] Improve Autocorrect TWo initial capitals

2011-02-22 Thread Sébastien Le Ray
Hi list,

Attached patch modifies TWo CApitals autocorrect by making it
spellcheck-aware. If you add TDs to your dictionary it won't be
corrected to Tds anymore

This patch - as all my past and future contributions to LO - is licensed
under LGPLv3+/MPL

Sébastien Le Ray
From d5397876d01d80d6ee0c994fd6c18a8d1efe94da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= 
Date: Tue, 22 Feb 2011 20:17:59 +0100
Subject: [PATCH] Double-capital autocor takes spellcheck in account

---
 editeng/source/misc/svxacorr.cxx |   22 +++---
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 70c9728..4c2d26b 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -443,14 +443,22 @@ BOOL SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const String& rTxt,
 String sWord( rTxt.Copy( nSttPos - 1, nEndPos - nSttPos + 1 ));
 if( !FindInWrdSttExceptList(eLang, sWord) )
 {
-sal_Unicode cSave = rTxt.GetChar( nSttPos );
-String sChar( cSave );
-rCC.toLower( sChar );
-if( sChar.GetChar(0) != cSave && rDoc.Replace( nSttPos, sChar ))
+::com::sun::star::uno::Reference<
+::com::sun::star::linguistic2::XSpellChecker1 > xSpeller =
+SvxGetSpellChecker();
+Sequence< ::com::sun::star::beans::PropertyValue > aEmptySeq;
+// Check that word isn't correctly spelled before correcting
+if(xSpeller->spell( sWord, eLang, aEmptySeq ) != NULL)
 {
-if( SaveWordWrdSttLst & nFlags )
-rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave );
-bRet = TRUE;
+sal_Unicode cSave = rTxt.GetChar( nSttPos );
+String sChar( cSave );
+rCC.toLower( sChar );
+if( sChar.GetChar(0) != cSave && rDoc.Replace( nSttPos, sChar ))
+{
+if( SaveWordWrdSttLst & nFlags )
+rDoc.SaveCpltSttWord( CptlSttWrd, nSttPos, sWord, cSave );
+bRet = TRUE;
+}
 }
 }
 }
-- 
1.7.2.3



signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


  1   2   >