[arrayfire] 63/408: Renaming enums for convolve batch modes

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:16 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 d656a20320e939a92bd291f7a7325c264f0b86bb
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Jun 30 10:34:27 2015 -0400

    Renaming enums for convolve batch modes
---
 src/api/c/convolve.cpp                            | 12 ++++++------
 src/api/c/convolve_common.hpp                     | 11 ++++++-----
 src/api/c/dog.cpp                                 |  2 +-
 src/api/c/fftconvolve.cpp                         | 12 ++++++------
 src/backend/cpu/convolve.cpp                      | 12 ++++++------
 src/backend/cpu/fftconvolve.cpp                   | 14 ++++++-------
 src/backend/cpu/iir.cpp                           |  4 ++--
 src/backend/cuda/convolve.cpp                     |  4 ++--
 src/backend/cuda/fftconvolve.cu                   |  6 +++---
 src/backend/cuda/iir.cu                           |  4 ++--
 src/backend/cuda/kernel/convolve.cu               |  6 +++---
 src/backend/cuda/kernel/fftconvolve.hpp           | 24 +++++++++++------------
 src/backend/opencl/convolve.cpp                   |  4 ++--
 src/backend/opencl/fftconvolve.cpp                |  6 +++---
 src/backend/opencl/iir.cpp                        |  4 ++--
 src/backend/opencl/kernel/convolve.hpp            |  6 +++---
 src/backend/opencl/kernel/fftconvolve.hpp         | 12 ++++++------
 src/backend/opencl/kernel/fftconvolve_multiply.cl |  6 +++---
 18 files changed, 75 insertions(+), 74 deletions(-)

diff --git a/src/api/c/convolve.cpp b/src/api/c/convolve.cpp
index 2ca7939..f5f8d12 100644
--- a/src/api/c/convolve.cpp
+++ b/src/api/c/convolve.cpp
@@ -42,11 +42,11 @@ ConvolveBatchKind identifyBatchKind(const dim4 &sDims, const dim4 &fDims)
     dim_t fn = fDims.ndims();
 
     if (sn==baseDim && fn==baseDim)
-        return ONE2ONE;
+        return CONVOLVE_BATCH_NONE;
     else if (sn==baseDim && (fn>baseDim && fn<=4))
-        return ONE2MANY;
+        return CONVOLVE_BATCH_KERNEL;
     else if ((sn>baseDim && sn<=4) && fn==baseDim)
-        return MANY2ONE;
+        return CONVOLVE_BATCH_SIGNAL;
     else if ((sn>baseDim && sn<=4) && (fn>baseDim && fn<=4)) {
         bool doesDimensionsMatch = true;
         for (dim_t i=baseDim; i<4; i++) {
@@ -55,10 +55,10 @@ ConvolveBatchKind identifyBatchKind(const dim4 &sDims, const dim4 &fDims)
                 break;
             }
         }
-        return (doesDimensionsMatch ? MANY2MANY : CONVOLVE_UNSUPPORTED_BATCH_MODE);
+        return (doesDimensionsMatch ? CONVOLVE_BATCH_SAME : CONVOLVE_BATCH_UNSUPPORTED);
     }
     else
-        return CONVOLVE_UNSUPPORTED_BATCH_MODE;
+        return CONVOLVE_BATCH_UNSUPPORTED;
 }
 
 template<dim_t baseDim, bool expand>
@@ -75,7 +75,7 @@ af_err convolve(af_array *out, const af_array signal, const af_array filter)
 
         ConvolveBatchKind convBT = identifyBatchKind<baseDim>(sdims, fdims);
 
-        ARG_ASSERT(1, (convBT != CONVOLVE_UNSUPPORTED_BATCH_MODE));
+        ARG_ASSERT(1, (convBT != CONVOLVE_BATCH_UNSUPPORTED));
 
         af_array output;
         switch(stype) {
diff --git a/src/api/c/convolve_common.hpp b/src/api/c/convolve_common.hpp
index fb4738c..2fb4445 100644
--- a/src/api/c/convolve_common.hpp
+++ b/src/api/c/convolve_common.hpp
@@ -10,9 +10,10 @@
 #pragma once
 
 typedef enum {
-    CONVOLVE_UNSUPPORTED_BATCH_MODE = -1, /* invalid inputs */
-    ONE2ONE,            /* one signal, one filter   */
-    MANY2ONE,           /* many signal, one filter  */
-    MANY2MANY,          /* many signal, many filter */
-    ONE2MANY            /* one signal, many filter  */
+    CONVOLVE_BATCH_UNSUPPORTED = -1, /* invalid inputs */
+    CONVOLVE_BATCH_NONE,          /* one signal, one filter   */
+    CONVOLVE_BATCH_SIGNAL,        /* many signal, one filter  */
+    CONVOLVE_BATCH_KERNEL,        /* one signal, many filter  */
+    CONVOLVE_BATCH_SAME,          /* signal and filter have same batch size */
+    CONVOLVE_BATCH_DIFF,          /* signal and filter have different batch size */
 } ConvolveBatchKind;
diff --git a/src/api/c/dog.cpp b/src/api/c/dog.cpp
index 16b0c53..a6c87f5 100644
--- a/src/api/c/dog.cpp
+++ b/src/api/c/dog.cpp
@@ -30,7 +30,7 @@ static af_array dog(const af_array& in, const int radius1, const int radius2)
     Array<T> input  = getArray<T>(in);
     dim4 iDims      = input.dims();
 
-    ConvolveBatchKind bkind = iDims[2] > 1 ? MANY2ONE : ONE2ONE;
+    ConvolveBatchKind bkind = iDims[2] > 1 ? CONVOLVE_BATCH_SIGNAL : CONVOLVE_BATCH_NONE;
 
     Array<T> smth1 = convolve<T, accT, 2, false>(input, castArray<accT>(g1), bkind);
     Array<T> smth2 = convolve<T, accT, 2, false>(input, castArray<accT>(g2), bkind);
diff --git a/src/api/c/fftconvolve.cpp b/src/api/c/fftconvolve.cpp
index 86696bd..d915a07 100644
--- a/src/api/c/fftconvolve.cpp
+++ b/src/api/c/fftconvolve.cpp
@@ -34,11 +34,11 @@ ConvolveBatchKind identifyBatchKind(const dim4 &sDims, const dim4 &fDims)
     dim_t fn = fDims.ndims();
 
     if (sn==baseDim && fn==baseDim)
-        return ONE2ONE;
+        return CONVOLVE_BATCH_NONE;
     else if (sn==baseDim && (fn>baseDim && fn<=4))
-        return ONE2MANY;
+        return CONVOLVE_BATCH_KERNEL;
     else if ((sn>baseDim && sn<=4) && fn==baseDim)
-        return MANY2ONE;
+        return CONVOLVE_BATCH_SIGNAL;
     else if ((sn>baseDim && sn<=4) && (fn>baseDim && fn<=4)) {
         bool doesDimensionsMatch = true;
         for (dim_t i=baseDim; i<4; i++) {
@@ -47,10 +47,10 @@ ConvolveBatchKind identifyBatchKind(const dim4 &sDims, const dim4 &fDims)
                 break;
             }
         }
-        return (doesDimensionsMatch ? MANY2MANY : CONVOLVE_UNSUPPORTED_BATCH_MODE);
+        return (doesDimensionsMatch ? CONVOLVE_BATCH_SAME : CONVOLVE_BATCH_UNSUPPORTED);
     }
     else
-        return CONVOLVE_UNSUPPORTED_BATCH_MODE;
+        return CONVOLVE_BATCH_UNSUPPORTED;
 }
 
 template<typename T, int baseDim>
@@ -122,7 +122,7 @@ af_err fft_convolve(af_array *out, const af_array signal, const af_array filter,
 
         ConvolveBatchKind convBT = identifyBatchKind<baseDim>(sdims, fdims);
 
-        ARG_ASSERT(1, (convBT != CONVOLVE_UNSUPPORTED_BATCH_MODE));
+        ARG_ASSERT(1, (convBT != CONVOLVE_BATCH_UNSUPPORTED));
 
         af_array output;
         switch(stype) {
diff --git a/src/backend/cpu/convolve.cpp b/src/backend/cpu/convolve.cpp
index 8ad8a23..33670d4 100644
--- a/src/backend/cpu/convolve.cpp
+++ b/src/backend/cpu/convolve.cpp
@@ -139,18 +139,18 @@ void convolve_nd(T *optr, T const *iptr, accT const *fptr,
 
     for (dim_t i=1; i<4; ++i) {
         switch(kind) {
-            case MANY2ONE:
+            case CONVOLVE_BATCH_SIGNAL:
                 out_step[i] = oStrides[i];
                 in_step[i]  = sStrides[i];
                 if (i>=baseDim) batch[i] = sDims[i];
                 break;
-            case MANY2MANY:
+            case CONVOLVE_BATCH_SAME:
                 out_step[i]  = oStrides[i];
                 in_step[i]   = sStrides[i];
                 filt_step[i] = fStrides[i];
                 if (i>=baseDim) batch[i] = sDims[i];
                 break;
-            case ONE2MANY:
+            case CONVOLVE_BATCH_KERNEL:
                 out_step[i]  = oStrides[i];
                 filt_step[i] = fStrides[i];
                 if (i>=baseDim) batch[i] = fDims[i];
@@ -188,7 +188,7 @@ Array<T> convolve(Array<T> const& signal, Array<accT> const& filter, ConvolveBat
     dim4 oDims(1);
     if (expand) {
         for(dim_t d=0; d<4; ++d) {
-            if (kind==ONE2ONE || kind==ONE2MANY) {
+            if (kind==CONVOLVE_BATCH_NONE || kind==CONVOLVE_BATCH_KERNEL) {
                 oDims[d] = sDims[d]+fDims[d]-1;
             } else {
                 oDims[d] = (d<baseDim ? sDims[d]+fDims[d]-1 : sDims[d]);
@@ -196,7 +196,7 @@ Array<T> convolve(Array<T> const& signal, Array<accT> const& filter, ConvolveBat
         }
     } else {
         oDims = sDims;
-        if (kind==ONE2MANY) {
+        if (kind==CONVOLVE_BATCH_KERNEL) {
             for (dim_t i=baseDim; i<4; ++i)
                 oDims[i] = fDims[i];
         }
@@ -265,7 +265,7 @@ Array<T> convolve2(Array<T> const& signal, Array<accT> const& c_filter, Array<ac
     dim4 oDims = sDims;
 
     if (expand) {
-        // separable convolve only does ONE2ONE and standard batch(MANY2ONE)
+        // separable convolve only does CONVOLVE_BATCH_NONE and standard batch(CONVOLVE_BATCH_SIGNAL)
         tDims[0] += cflen - 1;
         oDims[0] += cflen - 1;
         oDims[1] += rflen - 1;
diff --git a/src/backend/cpu/fftconvolve.cpp b/src/backend/cpu/fftconvolve.cpp
index 7d2e97b..bdc5538 100644
--- a/src/backend/cpu/fftconvolve.cpp
+++ b/src/backend/cpu/fftconvolve.cpp
@@ -98,7 +98,7 @@ void complexMultiply(T* out_ptr, const af::dim4& od, const af::dim4& os,
         for (int d2 = 0; d2 < (int)od[2]; d2++) {
             for (int d1 = 0; d1 < (int)od[1]; d1++) {
                 for (int d0 = 0; d0 < (int)od[0] / 2; d0++) {
-                    if (kind == ONE2ONE || kind == MANY2MANY) {
+                    if (kind == CONVOLVE_BATCH_NONE || kind == CONVOLVE_BATCH_SAME) {
                         // Complex multiply each signal to equivalent filter
                         const int ridx = d3*os[3] + d2*os[2] + d1*os[1] + d0*2;
                         const int iidx = ridx + 1;
@@ -114,7 +114,7 @@ void complexMultiply(T* out_ptr, const af::dim4& od, const af::dim4& os,
                         out_ptr[ridx] = ac - bd;
                         out_ptr[iidx] = (a+b) * (c+d) - ac - bd;
                     }
-                    else if (kind == MANY2ONE) {
+                    else if (kind == CONVOLVE_BATCH_SIGNAL) {
                         // Complex multiply all signals to filter
                         const int ridx1 = d3*os[3] + d2*os[2] + d1*os[1] + d0*2;
                         const int iidx1 = ridx1 + 1;
@@ -132,7 +132,7 @@ void complexMultiply(T* out_ptr, const af::dim4& od, const af::dim4& os,
                         out_ptr[ridx1] = ac - bd;
                         out_ptr[iidx1] = (a+b) * (c+d) - ac - bd;
                     }
-                    else if (kind == ONE2MANY) {
+                    else if (kind == CONVOLVE_BATCH_KERNEL) {
                         // Complex multiply signal to all filters
                         const int ridx2 = d3*os[3] + d2*os[2] + d1*os[1] + d0*2;
                         const int iidx2 = ridx2 + 1;
@@ -323,7 +323,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter,
     }
 
     // Multiply filter and signal FFT arrays
-    if (kind == ONE2MANY)
+    if (kind == CONVOLVE_BATCH_KERNEL)
         complexMultiply<convT>(filter_tmp_ptr, filter_tmp_dims, filter_tmp_strides,
                                sig_tmp_ptr, sig_tmp_dims, sig_tmp_strides,
                                filter_tmp_ptr, filter_tmp_dims, filter_tmp_strides,
@@ -376,7 +376,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter,
     dim4 oDims(1);
     if (expand) {
         for(dim_t d=0; d<4; ++d) {
-            if (kind==ONE2ONE || kind==ONE2MANY) {
+            if (kind==CONVOLVE_BATCH_NONE || kind==CONVOLVE_BATCH_KERNEL) {
                 oDims[d] = sd[d]+fd[d]-1;
             } else {
                 oDims[d] = (d<baseDim ? sd[d]+fd[d]-1 : sd[d]);
@@ -384,7 +384,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter,
         }
     } else {
         oDims = sd;
-        if (kind==ONE2MANY) {
+        if (kind==CONVOLVE_BATCH_KERNEL) {
             for (dim_t i=baseDim; i<4; ++i)
                 oDims[i] = fd[i];
         }
@@ -398,7 +398,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter,
     const af::dim4 filter_dims = filter.dims();
 
     // Reorder the output
-    if (kind == ONE2MANY) {
+    if (kind == CONVOLVE_BATCH_KERNEL) {
         reorderOutput<T, convT, roundOut>
             (out_ptr, out_dims, out_strides,
              filter_tmp_ptr, filter_tmp_dims, filter_tmp_strides,
diff --git a/src/backend/cpu/iir.cpp b/src/backend/cpu/iir.cpp
index 580078e..615da22 100644
--- a/src/backend/cpu/iir.cpp
+++ b/src/backend/cpu/iir.cpp
@@ -27,9 +27,9 @@ namespace cpu
         T h_a0 = a.get()[0];
         Array<T> a0 = createValueArray<T>(b.dims(), h_a0);
 
-        ConvolveBatchKind type = x.ndims() == 1 ? ONE2ONE : MANY2MANY;
+        ConvolveBatchKind type = x.ndims() == 1 ? CONVOLVE_BATCH_NONE : CONVOLVE_BATCH_SAME;
         if (x.ndims() != b.ndims()) {
-            type = (x.ndims() < b.ndims()) ? ONE2MANY : MANY2ONE;
+            type = (x.ndims() < b.ndims()) ? CONVOLVE_BATCH_KERNEL : CONVOLVE_BATCH_SIGNAL;
         }
 
         // Extract the first N elements
diff --git a/src/backend/cuda/convolve.cpp b/src/backend/cuda/convolve.cpp
index 4cf3642..9f14e6a 100644
--- a/src/backend/cuda/convolve.cpp
+++ b/src/backend/cuda/convolve.cpp
@@ -29,7 +29,7 @@ Array<T> convolve(Array<T> const& signal, Array<accT> const& filter, ConvolveBat
     dim4 oDims(1);
     if (expand) {
         for(dim_t d=0; d<4; ++d) {
-            if (kind==ONE2ONE || kind==ONE2MANY) {
+            if (kind==CONVOLVE_BATCH_NONE || kind==CONVOLVE_BATCH_KERNEL) {
                 oDims[d] = sDims[d]+fDims[d]-1;
             } else {
                 oDims[d] = (d<baseDim ? sDims[d]+fDims[d]-1 : sDims[d]);
@@ -37,7 +37,7 @@ Array<T> convolve(Array<T> const& signal, Array<accT> const& filter, ConvolveBat
         }
     } else {
         oDims = sDims;
-        if (kind==ONE2MANY) {
+        if (kind==CONVOLVE_BATCH_KERNEL) {
             for (dim_t i=baseDim; i<4; ++i)
                 oDims[i] = fDims[i];
         }
diff --git a/src/backend/cuda/fftconvolve.cu b/src/backend/cuda/fftconvolve.cu
index f95917b..677fec7 100644
--- a/src/backend/cuda/fftconvolve.cu
+++ b/src/backend/cuda/fftconvolve.cu
@@ -57,7 +57,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter, const bool
     dim4 oDims(1);
     if (expand) {
         for(dim_t d=0; d<4; ++d) {
-            if (kind==ONE2ONE || kind==ONE2MANY) {
+            if (kind==CONVOLVE_BATCH_NONE || kind==CONVOLVE_BATCH_KERNEL) {
                 oDims[d] = sDims[d]+fDims[d]-1;
             } else {
                 oDims[d] = (d<baseDim ? sDims[d]+fDims[d]-1 : sDims[d]);
@@ -65,7 +65,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter, const bool
         }
     } else {
         oDims = sDims;
-        if (kind==ONE2MANY) {
+        if (kind==CONVOLVE_BATCH_KERNEL) {
             for (dim_t i=baseDim; i<4; ++i)
                 oDims[i] = fDims[i];
         }
@@ -88,7 +88,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter, const bool
     else
         kernel::complexMultiplyHelper<T, cT>(out, signal_packed, filter_packed, signal, filter, kind);
 
-    if (kind == ONE2MANY) {
+    if (kind == CONVOLVE_BATCH_KERNEL) {
         fft_common<cT, baseDim, false>(filter_packed, filter_packed);
         if (expand)
             kernel::reorderOutputHelper<T, cT, roundOut, baseDim, true >(out, filter_packed, signal, filter, kind);
diff --git a/src/backend/cuda/iir.cu b/src/backend/cuda/iir.cu
index 4530406..22b889a 100644
--- a/src/backend/cuda/iir.cu
+++ b/src/backend/cuda/iir.cu
@@ -26,9 +26,9 @@ namespace cuda
     Array<T> iir(const Array<T> &b, const Array<T> &a, const Array<T> &x)
     {
 
-        ConvolveBatchKind type = x.ndims() == 1 ? ONE2ONE : MANY2MANY;
+        ConvolveBatchKind type = x.ndims() == 1 ? CONVOLVE_BATCH_NONE : CONVOLVE_BATCH_SAME;
         if (x.ndims() != b.ndims()) {
-            type = (x.ndims() < b.ndims()) ? ONE2MANY : MANY2ONE;
+            type = (x.ndims() < b.ndims()) ? CONVOLVE_BATCH_KERNEL : CONVOLVE_BATCH_SIGNAL;
         }
 
         // Extract the first N elements
diff --git a/src/backend/cuda/kernel/convolve.cu b/src/backend/cuda/kernel/convolve.cu
index d0ee8b5..7cc9fd2 100644
--- a/src/backend/cuda/kernel/convolve.cu
+++ b/src/backend/cuda/kernel/convolve.cu
@@ -470,9 +470,9 @@ void convolve_nd(Param<T> out, CParam<T> signal, CParam<aT> filt, ConvolveBatchK
         param.o[i] = 0;
         param.s[i] = 0;
     }
-    param.launchMoreBlocks = kind==MANY2MANY || kind==ONE2MANY;
-    param.outHasNoOffset = kind==MANY2ONE || kind==ONE2ONE;
-    param.inHasNoOffset  = kind!=MANY2MANY;
+    param.launchMoreBlocks = kind==CONVOLVE_BATCH_SAME || kind==CONVOLVE_BATCH_KERNEL;
+    param.outHasNoOffset = kind==CONVOLVE_BATCH_SIGNAL || kind==CONVOLVE_BATCH_NONE;
+    param.inHasNoOffset  = kind!=CONVOLVE_BATCH_SAME;
 
     switch(baseDim) {
         case 1: convolve_1d<T, aT, expand>(param, out, signal, filt); break;
diff --git a/src/backend/cuda/kernel/fftconvolve.hpp b/src/backend/cuda/kernel/fftconvolve.hpp
index a2e8939..774fe80 100644
--- a/src/backend/cuda/kernel/fftconvolve.hpp
+++ b/src/backend/cuda/kernel/fftconvolve.hpp
@@ -143,7 +143,7 @@ __global__ void complexMultiply(
     if (t >= nelem)
         return;
 
-    if (kind == ONE2ONE || kind == MANY2MANY) {
+    if (kind == CONVOLVE_BATCH_NONE || kind == CONVOLVE_BATCH_SAME) {
         // Complex multiply each signal to equivalent filter
         const int ridx = t;
 
@@ -153,7 +153,7 @@ __global__ void complexMultiply(
         out.ptr[ridx].x = c1.x*c2.x - c1.y*c2.y;
         out.ptr[ridx].y = (c1.x+c1.y) * (c2.x+c2.y) - c1.x*c2.x - c1.y*c2.y;
     }
-    else if (kind == MANY2ONE) {
+    else if (kind == CONVOLVE_BATCH_SIGNAL) {
         // Complex multiply all signals to filter
         const int ridx1 = t;
         const int ridx2 = t % (in2.strides[3] * in2.dims[3]);
@@ -164,7 +164,7 @@ __global__ void complexMultiply(
         out.ptr[ridx1].x = c1.x*c2.x - c1.y*c2.y;
         out.ptr[ridx1].y = (c1.x+c1.y) * (c2.x+c2.y) - c1.x*c2.x - c1.y*c2.y;
     }
-    else if (kind == ONE2MANY) {
+    else if (kind == CONVOLVE_BATCH_KERNEL) {
         // Complex multiply signal to all filters
         const int ridx1 = t % (in1.strides[3] * in1.dims[3]);
         const int ridx2 = t;
@@ -304,23 +304,23 @@ void complexMultiplyHelper(Param<T> out,
 
     // Multiply filter and signal FFT arrays
     switch(kind) {
-        case ONE2ONE:
-            complexMultiply<convT, ONE2ONE  ><<<blocks, threads>>>
+        case CONVOLVE_BATCH_NONE:
+            complexMultiply<convT, CONVOLVE_BATCH_NONE  ><<<blocks, threads>>>
                 (sig_packed, sig_packed, filter_packed, mul_elem);
             break;
-        case MANY2ONE:
-            complexMultiply<convT, MANY2ONE ><<<blocks, threads>>>
+        case CONVOLVE_BATCH_SIGNAL:
+            complexMultiply<convT, CONVOLVE_BATCH_SIGNAL ><<<blocks, threads>>>
                 (sig_packed, sig_packed, filter_packed, mul_elem);
             break;
-        case ONE2MANY:
-            complexMultiply<convT, ONE2MANY ><<<blocks, threads>>>
+        case CONVOLVE_BATCH_KERNEL:
+            complexMultiply<convT, CONVOLVE_BATCH_KERNEL ><<<blocks, threads>>>
                 (filter_packed, sig_packed, filter_packed, mul_elem);
             break;
-        case MANY2MANY:
-            complexMultiply<convT, MANY2MANY><<<blocks, threads>>>
+        case CONVOLVE_BATCH_SAME:
+            complexMultiply<convT, CONVOLVE_BATCH_SAME><<<blocks, threads>>>
                 (sig_packed, sig_packed, filter_packed, mul_elem);
             break;
-        case CONVOLVE_UNSUPPORTED_BATCH_MODE:
+        case CONVOLVE_BATCH_UNSUPPORTED:
         default:
             break;
     }
diff --git a/src/backend/opencl/convolve.cpp b/src/backend/opencl/convolve.cpp
index ab66773..b800591 100644
--- a/src/backend/opencl/convolve.cpp
+++ b/src/backend/opencl/convolve.cpp
@@ -29,7 +29,7 @@ Array<T> convolve(Array<T> const& signal, Array<accT> const& filter, ConvolveBat
     dim4 oDims(1);
     if (expand) {
         for(dim_t d=0; d<4; ++d) {
-            if (kind==ONE2ONE || kind==ONE2MANY) {
+            if (kind==CONVOLVE_BATCH_NONE || kind==CONVOLVE_BATCH_KERNEL) {
                 oDims[d] = sDims[d]+fDims[d]-1;
             } else {
                 oDims[d] = (d<baseDim ? sDims[d]+fDims[d]-1 : sDims[d]);
@@ -37,7 +37,7 @@ Array<T> convolve(Array<T> const& signal, Array<accT> const& filter, ConvolveBat
         }
     } else {
         oDims = sDims;
-        if (kind==ONE2MANY) {
+        if (kind==CONVOLVE_BATCH_KERNEL) {
             for (dim_t i=baseDim; i<4; ++i)
                 oDims[i] = fDims[i];
         }
diff --git a/src/backend/opencl/fftconvolve.cpp b/src/backend/opencl/fftconvolve.cpp
index 06d2bc5..ab446b9 100644
--- a/src/backend/opencl/fftconvolve.cpp
+++ b/src/backend/opencl/fftconvolve.cpp
@@ -59,7 +59,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter, const bool
     dim4 oDims(1);
     if (expand) {
         for(dim_t d=0; d<4; ++d) {
-            if (kind==ONE2ONE || kind==ONE2MANY) {
+            if (kind==CONVOLVE_BATCH_NONE || kind==CONVOLVE_BATCH_KERNEL) {
                 oDims[d] = sDims[d]+fDims[d]-1;
             } else {
                 oDims[d] = (d<baseDim ? sDims[d]+fDims[d]-1 : sDims[d]);
@@ -67,7 +67,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter, const bool
         }
     } else {
         oDims = sDims;
-        if (kind==ONE2MANY) {
+        if (kind==CONVOLVE_BATCH_KERNEL) {
             for (dim_t i=baseDim; i<4; ++i)
                 oDims[i] = fDims[i];
         }
@@ -83,7 +83,7 @@ Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter, const bool
     kernel::complexMultiplyHelper<cT, T, isDouble, convT>(packed, signal, filter, baseDim, kind);
 
     // Compute inverse FFT only on complex-multiplied data
-    if (kind == ONE2MANY) {
+    if (kind == CONVOLVE_BATCH_KERNEL) {
         std::vector<af_seq> seqs;
         for (dim_t k = 0; k < 4; k++) {
             if (k < baseDim)
diff --git a/src/backend/opencl/iir.cpp b/src/backend/opencl/iir.cpp
index eb7e996..300f06f 100644
--- a/src/backend/opencl/iir.cpp
+++ b/src/backend/opencl/iir.cpp
@@ -27,9 +27,9 @@ namespace opencl
     {
         try {
 
-            ConvolveBatchKind type = x.ndims() == 1 ? ONE2ONE : MANY2MANY;
+            ConvolveBatchKind type = x.ndims() == 1 ? CONVOLVE_BATCH_NONE : CONVOLVE_BATCH_SAME;
             if (x.ndims() != b.ndims()) {
-                type = (x.ndims() < b.ndims()) ? ONE2MANY : MANY2ONE;
+                type = (x.ndims() < b.ndims()) ? CONVOLVE_BATCH_KERNEL : CONVOLVE_BATCH_SIGNAL;
             }
 
             // Extract the first N elements
diff --git a/src/backend/opencl/kernel/convolve.hpp b/src/backend/opencl/kernel/convolve.hpp
index 89ac252..035f4c2 100644
--- a/src/backend/opencl/kernel/convolve.hpp
+++ b/src/backend/opencl/kernel/convolve.hpp
@@ -40,9 +40,9 @@ void convolve_nd(Param out, const Param signal, const Param filter, ConvolveBatc
         param.o[i] = 0;
         param.s[i] = 0;
     }
-    param.launchMoreBlocks = kind==MANY2MANY || kind==ONE2MANY;
-    param.outHasNoOffset = kind==MANY2ONE || kind==ONE2ONE;
-    param.inHasNoOffset  = kind!=MANY2MANY;
+    param.launchMoreBlocks = kind==CONVOLVE_BATCH_SAME || kind==CONVOLVE_BATCH_KERNEL;
+    param.outHasNoOffset = kind==CONVOLVE_BATCH_SIGNAL || kind==CONVOLVE_BATCH_NONE;
+    param.inHasNoOffset  = kind!=CONVOLVE_BATCH_SAME;
 
     prepareKernelArgs<T>(param, out.info.dims, filter.info.dims, baseDim);
 
diff --git a/src/backend/opencl/kernel/fftconvolve.hpp b/src/backend/opencl/kernel/fftconvolve.hpp
index 347c4f1..fb29a42 100644
--- a/src/backend/opencl/kernel/fftconvolve.hpp
+++ b/src/backend/opencl/kernel/fftconvolve.hpp
@@ -63,7 +63,7 @@ void calcParamSizes(Param& sig_tmp,
     sig_tmp.data = packed.data;
     filter_tmp.data = packed.data;
 
-    if (kind == ONE2MANY) {
+    if (kind == CONVOLVE_BATCH_KERNEL) {
         filter_tmp.info.offset = 0;
         sig_tmp.info.offset = filter_tmp.info.strides[3] * filter_tmp.info.dims[3] * 2;
     }
@@ -171,10 +171,10 @@ void complexMultiplyHelper(Param packed,
 
                 std::ostringstream options;
                 options << " -D T=" << dtype_traits<T>::getName()
-                        << " -D ONE2ONE=" << (int)ONE2ONE
-                        << " -D MANY2ONE=" << (int)MANY2ONE
-                        << " -D ONE2MANY=" << (int)ONE2MANY
-                        << " -D MANY2MANY=" << (int)MANY2MANY;
+                        << " -D CONVOLVE_BATCH_NONE=" << (int)CONVOLVE_BATCH_NONE
+                        << " -D CONVOLVE_BATCH_SIGNAL=" << (int)CONVOLVE_BATCH_SIGNAL
+                        << " -D CONVOLVE_BATCH_KERNEL=" << (int)CONVOLVE_BATCH_KERNEL
+                        << " -D CONVOLVE_BATCH_SAME=" << (int)CONVOLVE_BATCH_SAME;
 
                 if ((af_dtype) dtype_traits<convT>::af_type == c32) {
                     options << " -D CONVT=float";
@@ -281,7 +281,7 @@ void reorderOutputHelper(Param out,
                                 KParam, const int,
                                 const int> (*roKernel[device]);
 
-        if (kind == ONE2MANY) {
+        if (kind == CONVOLVE_BATCH_KERNEL) {
             roOp(EnqueueArgs(getQueue(), global, local),
                  *out.data, out.info,
                  *filter_tmp.data, filter_tmp.info,
diff --git a/src/backend/opencl/kernel/fftconvolve_multiply.cl b/src/backend/opencl/kernel/fftconvolve_multiply.cl
index 9729a72..eae1e82 100644
--- a/src/backend/opencl/kernel/fftconvolve_multiply.cl
+++ b/src/backend/opencl/kernel/fftconvolve_multiply.cl
@@ -23,7 +23,7 @@ void complex_multiply(
     if (t >= nelem)
         return;
 
-    if (kind == ONE2ONE || kind == MANY2MANY) {
+    if (kind == CONVOLVE_BATCH_NONE || kind == CONVOLVE_BATCH_SAME) {
         // Complex multiply each signal to equivalent filter
         const int ridx = t * 2;
         const int iidx = t * 2 + 1;
@@ -39,7 +39,7 @@ void complex_multiply(
         d_out[oInfo.offset + ridx] = ac - bd;
         d_out[oInfo.offset + iidx] = (a+b) * (c+d) - ac - bd;
     }
-    else if (kind == MANY2ONE) {
+    else if (kind == CONVOLVE_BATCH_SIGNAL) {
         // Complex multiply all signals to filter
         const int ridx1 = t * 2;
         const int iidx1 = t * 2 + 1;
@@ -60,7 +60,7 @@ void complex_multiply(
         d_out[oInfo.offset + ridx1] = ac - bd;
         d_out[oInfo.offset + iidx1] = (a+b) * (c+d) - ac - bd;
     }
-    else if (kind == ONE2MANY) {
+    else if (kind == CONVOLVE_BATCH_KERNEL) {
         // Complex multiply signal to all filters
         const int ridx2 = t * 2;
         const int iidx2 = t * 2 + 1;

-- 
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