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

Tor Lillqvist tml at collabora.com
Thu Jan 8 05:16:43 PST 2015


 sc/source/core/opencl/formulagroupcl.cxx |  147 -------------------------------
 1 file changed, 3 insertions(+), 144 deletions(-)

New commits:
commit 58f2e4c62647ceeaffd3aa9b693d97321748d7ba
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Jan 8 14:55:43 2015 +0200

    Bin obsolete conditional compilation
    
    UNROLLING_FACTOR (or UNROLLING) has been defined since November 2013. No need
    to keep old code around inside ifdefs. We have this thing called version
    control.
    
    Change-Id: I1f10f205df95014f8c223bd7a8716757577eade0

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 0fd192f..d90cce9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -606,55 +606,7 @@ public:
     {
         assert(mpDVR);
         size_t nCurWindowSize = mpDVR->GetRefRowSize();
-        // original for loop
-#ifndef UNROLLING_FACTOR
-        needBody = true;
-        // No need to generate a for-loop for degenerated cases
-        if (nCurWindowSize == 1)
-        {
-            ss << "if (gid0 <" << mpDVR->GetArrayLength();
-            ss << ")\n\t{\tint i = 0;\n\t\t";
-            return nCurWindowSize;
-        }
-
-        ss << "for (int i = ";
-        if (!bIsStartFixed && bIsEndFixed)
-        {
-#ifdef  ISNAN
-            ss << "gid0; i < " << mpDVR->GetArrayLength();
-            ss << " && i < " << nCurWindowSize  << "; i++){\n\t\t";
-#else
-            ss << "gid0; i < " << nCurWindowSize << "; i++)\n\t\t";
-#endif
-        }
-        else if (bIsStartFixed && !bIsEndFixed)
-        {
-#ifdef  ISNAN
-            ss << "0; i < " << mpDVR->GetArrayLength();
-            ss << " && i < gid0+" << nCurWindowSize << "; i++){\n\t\t";
-#else
-            ss << "0; i < gid0+" << nCurWindowSize << "; i++)\n\t\t";
-#endif
-        }
-        else if (!bIsStartFixed && !bIsEndFixed)
-        {
-#ifdef  ISNAN
-            ss << "0; i + gid0 < " << mpDVR->GetArrayLength();
-            ss << " &&  i < " << nCurWindowSize << "; i++){\n\t\t";
-#else
-            ss << "0; i < " << nCurWindowSize << "; i++)\n\t\t";
-#endif
-        }
-        else
-        {
-            unsigned limit =
-                std::min(mpDVR->GetArrayLength(), nCurWindowSize);
-            ss << "0; i < " << limit << "; i++){\n\t\t";
-        }
-        return nCurWindowSize;
-#endif
 
-#ifdef UNROLLING_FACTOR
         {
             if (!mpDVR->IsStartFixed() && mpDVR->IsEndFixed())
             {
@@ -757,7 +709,6 @@ public:
                 return nCurWindowSize;
             }
         }
-#endif
     }
     ~DynamicKernelSlidingArgument()
     {
@@ -1472,76 +1423,7 @@ public:
         ss << ") {\n";
         ss << "    double tmp = 0.0;\n";
         ss << "    int gid0 = get_global_id(0);\n";
-#ifndef UNROLLING_FACTOR
-        ss << "    int i ;\n";
-        ss << "    for (i = 0; i < " << nCurWindowSize << "; i++)\n";
-        ss << "    {\n";
-        for (unsigned i = 0; i < vSubArguments.size(); i++)
-        {
-            tmpCur = vSubArguments[i]->GetFormulaToken();
-            if (ocPush == tmpCur->GetOpCode())
-            {
-                pCurDVR = static_cast<const formula::DoubleVectorRefToken*>(tmpCur);
-                if (!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed())
-                {
-                    ss << "        int currentCount";
-                    ss << i;
-                    ss << " =i+gid0+1;\n";
-                }
-                else
-                {
-                    ss << "        int currentCount";
-                    ss << i;
-                    ss << " =i+1;\n";
-                }
-            }
-        }
-        ss << "        tmp += fsum(";
-        for (unsigned i = 0; i < vSubArguments.size(); i++)
-        {
-            if (i)
-                ss << "*";
-#ifdef  ISNAN
-            if (ocPush == vSubArguments[i]->GetFormulaToken()->GetOpCode())
-            {
-                ss << "(";
-                ss << "(currentCount";
-                ss << i;
-                ss << ">";
-                if (vSubArguments[i]->GetFormulaToken()->GetType() ==
-                        formula::svSingleVectorRef)
-                {
-                    const formula::SingleVectorRefToken* pSVR =
-                        static_cast<const formula::SingleVectorRefToken*>
-                        (vSubArguments[i]->GetFormulaToken());
-                    ss << pSVR->GetArrayLength();
-                }
-                else if (vSubArguments[i]->GetFormulaToken()->GetType() ==
-                        formula::svDoubleVectorRef)
-                {
-                    const formula::DoubleVectorRefToken* pSVR =
-                        static_cast<const formula::DoubleVectorRefToken*>
-                        (vSubArguments[i]->GetFormulaToken());
-                    ss << pSVR->GetArrayLength();
-                }
-                ss << ")||isNan(" << vSubArguments[i]
-                    ->GenSlidingWindowDeclRef(true);
-                ss << ")?0:";
-                ss << vSubArguments[i]->GenSlidingWindowDeclRef(true);
-                ss << ")";
-            }
-            else
-                ss << vSubArguments[i]->GenSlidingWindowDeclRef(true);
-#else
-            ss << vSubArguments[i]->GenSlidingWindowDeclRef(true);
-#endif
-        }
-        ss << ", 0.0);\n\t}\n\t";
-        ss << "return tmp;\n";
-        ss << "}";
-#endif
 
-#ifdef UNROLLING_FACTOR
         ss << "\tint i;\n\t";
         ss << "int currentCount0;\n";
         for (unsigned i = 0; i < vSubArguments.size() - 1; i++)
@@ -1705,8 +1587,6 @@ public:
         }
         ss << "return tmp;\n";
         ss << "}";
-#endif
-
     }
     virtual bool takeString() const SAL_OVERRIDE { return false; }
     virtual bool takeNumeric() const SAL_OVERRIDE { return true; }
commit 8e6514f9ca319a74f156f23023a35fd99761e9a2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Jan 8 14:39:31 2015 +0200

    Bin obsolete conditional compilation
    
    USE_FMIN_FMAX has been defined a long time. There is no information in any
    comment or in the commit that introduced it why one would not want to use the
    OpenCL fmin() and fmax() built-in functions (intrinsics). Keeping such stuff
    in the source code (and in the generated OpenCL code) is pointless and just
    makes it harder to read.
    
    Change-Id: Ibc0b950c0f16872867eb5eff089b33b00cb95028

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 07a283d..0fd192f 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -31,8 +31,6 @@
 #include "op_addin.hxx"
 
 /// CONFIGURATIONS
-// Comment out this to turn off FMIN and FMAX intrinsics
-#define USE_FMIN_FMAX 1
 #define REDUCE_THRESHOLD 201  // set to 4 for correctness testing. priority 1
 #define UNROLLING_FACTOR 16  // set to 4 for correctness testing (if no reduce)
 
@@ -48,13 +46,6 @@ static 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
  ;
 
 #ifdef WIN32
@@ -1882,7 +1873,7 @@ public:
     virtual std::string GetBottom() SAL_OVERRIDE { return "MAXFLOAT"; }
     virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) const SAL_OVERRIDE
     {
-        return "mcw_fmin(" + lhs + "," + rhs + ")";
+        return "fmin(" + lhs + "," + rhs + ")";
     }
     virtual std::string BinFuncName() const SAL_OVERRIDE { return "min"; }
 };
@@ -1895,7 +1886,7 @@ public:
     virtual std::string GetBottom() SAL_OVERRIDE { return "-MAXFLOAT"; }
     virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) const SAL_OVERRIDE
     {
-        return "mcw_fmax(" + lhs + "," + rhs + ")";
+        return "fmax(" + lhs + "," + rhs + ")";
     }
     virtual std::string BinFuncName() const SAL_OVERRIDE { return "max"; }
 };
commit 4188576f9368b689ae7cfa4cd3fdd17318605d85
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Jan 8 14:19:50 2015 +0200

    Bin obsolete conditional compilation
    
    MD5_KERNEL has been defined always for a long time, and I don't see why we
    wouldn't want that functionality.
    
    Change-Id: I7ee220ac3354fb8e5f6556259147675847aab68d

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index a458b8d..07a283d 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -73,10 +73,8 @@ const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
 #include <iostream>
 #include <sstream>
 #include <algorithm>
-#define MD5_KERNEL 1
-#ifdef MD5_KERNEL
+
 #include <rtl/digest.h>
-#endif
 
 #include <boost/scoped_ptr.hpp>
 #include <boost/scoped_array.hpp>
@@ -3405,7 +3403,6 @@ void DynamicKernel::CodeGen()
 
 std::string DynamicKernel::GetMD5()
 {
-#ifdef MD5_KERNEL
     if (mKernelHash.empty())
     {
         std::stringstream md5s;
@@ -3422,9 +3419,6 @@ std::string DynamicKernel::GetMD5()
         mKernelHash = md5s.str();
     }
     return mKernelHash;
-#else
-    return "";
-#endif
 }
 
 /// Build code
commit df030ad22740497e02e319a9471e9cf504df4d67
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Jan 8 14:16:49 2015 +0200

    Bin obsolete conditional compilation
    
    NO_FALLBACK_TO_SWINTERP has been undefined for a long time. I doubt anybody
    knows any more what it means, and in what situations it might perhaps make
    sense to define it. Should it be a compile-time choice anyway, in that case,
    or a run-time one? What is a "TDD run"? Test-Driven Development? But we have
    our unit test mechanism for that.
    
    Change-Id: If3e21e958ebeb689a8aac8eb7393c02f7143401c

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index b0a16a5..a458b8d 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -81,8 +81,6 @@ const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
 #include <boost/scoped_ptr.hpp>
 #include <boost/scoped_array.hpp>
 
-#undef NO_FALLBACK_TO_SWINTERP /* undef this for non-TDD runs */
-
 using namespace formula;
 
 namespace sc { namespace opencl {
@@ -3656,12 +3654,8 @@ DynamicKernel* DynamicKernel::create( ScTokenArray& rCode, int nResultSize )
     catch (const UnhandledToken& ut)
     {
         SAL_WARN("sc.opencl", "Dynamic formula compiler: unhandled token: " << ut.mMessage << " at " << ut.mFile << ":" << ut.mLineNumber);
-#ifdef NO_FALLBACK_TO_SWINTERP
-        assert(false);
-#else
         delete pDynamicKernel;
         return NULL;
-#endif
     }
     catch (...)
     {


More information about the Libreoffice-commits mailing list