[arrayfire] 326/408: Removing unnecessary switch case from opencl ireduce

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:12:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit d03c3c0f77f3427669d8cd274e48c0537710946d
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Aug 24 07:03:50 2015 -0400

    Removing unnecessary switch case from opencl ireduce
---
 src/backend/opencl/kernel/ireduce.hpp | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/backend/opencl/kernel/ireduce.hpp b/src/backend/opencl/kernel/ireduce.hpp
index 92f4be3..5fa0fa6 100644
--- a/src/backend/opencl/kernel/ireduce.hpp
+++ b/src/backend/opencl/kernel/ireduce.hpp
@@ -115,8 +115,8 @@ namespace kernel
         CL_DEBUG_FINISH(getQueue());
     }
 
-    template<typename T, af_op_t op, int dim>
-    void ireduce_dim(Param out, cl::Buffer *oidx, Param in)
+    template<typename T, af_op_t op>
+    void ireduce_dim(Param out, cl::Buffer *oidx, Param in, int dim)
     {
         uint threads_y = std::min(THREADS_Y, nextpow2(in.info.dims[dim]));
         uint threads_x = THREADS_X;
@@ -272,12 +272,10 @@ namespace kernel
     void ireduce(Param out, cl::Buffer *oidx, Param in, int dim)
     {
         try {
-            switch (dim) {
-            case 0: return ireduce_first<T, op   >(out, oidx, in);
-            case 1: return ireduce_dim  <T, op, 1>(out, oidx, in);
-            case 2: return ireduce_dim  <T, op, 2>(out, oidx, in);
-            case 3: return ireduce_dim  <T, op, 3>(out, oidx, in);
-            }
+            if (dim == 0)
+                return ireduce_first<T, op>(out, oidx, in);
+            else
+                return ireduce_dim  <T, op>(out, oidx, in, dim);
         } catch(cl::Error ex) {
             CL_TO_AF_ERROR(ex);
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list