diff options
author | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-19 00:22:23 -0600 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-19 12:08:03 -0600 |
commit | d7e4e5d35e66dbfcc30576d198e393661d84f616 (patch) | |
tree | 6a56bcb498e12c7791bd7c94ef74187e8343ae74 | |
parent | 4eebd65858655eef3f39e40ecbe74c505f6b4688 (diff) |
GPU Calc: add an inline function to legalize inputs for reduction.
Change-Id: Ibcede4a33d7b8b1073d6ecfb49abbc78b31a2f35
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 13 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl_public.hxx | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 037760e42175..abd3230ff20e 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 e50de3731f64..ccee5e16b92b 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" |