Skip to content

Commit 2c4a3cb

Browse files
committed
Current State
1 parent a0489a1 commit 2c4a3cb

File tree

3 files changed

+1309
-695
lines changed

3 files changed

+1309
-695
lines changed

src/gpuarray/reduction.h

Lines changed: 16 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,34 @@ extern "C" {
2626
*/
2727

2828
typedef enum _ga_reduce_op {
29-
GA_REDUCE_SUM, /* + */
30-
GA_REDUCE_PROD, /* * */
31-
GA_REDUCE_PRODNZ, /* * (!=0) */
32-
GA_REDUCE_MIN, /* min() */
33-
GA_REDUCE_MAX, /* max() */
34-
GA_REDUCE_ARGMIN, /* argmin() */
35-
GA_REDUCE_ARGMAX, /* argmax() */
36-
GA_REDUCE_MINANDARGMIN, /* min(), argmin() */
37-
GA_REDUCE_MAXANDARGMAX, /* max(), argmax() */
38-
GA_REDUCE_AND, /* & */
39-
GA_REDUCE_OR, /* | */
40-
GA_REDUCE_XOR, /* ^ */
41-
GA_REDUCE_ALL, /* &&/all() */
42-
GA_REDUCE_ANY, /* ||/any() */
29+
GA_REDUCE_SUM, /* + */
30+
GA_REDUCE_PROD, /* * */
31+
GA_REDUCE_PRODNZ, /* * (!=0) */
32+
GA_REDUCE_MIN, /* min() */
33+
GA_REDUCE_MAX, /* max() */
34+
GA_REDUCE_ARGMIN, /* argmin() */
35+
GA_REDUCE_ARGMAX, /* argmax() */
36+
GA_REDUCE_MINANDARGMIN, /* min(), argmin() */
37+
GA_REDUCE_MAXANDARGMAX, /* max(), argmax() */
38+
GA_REDUCE_AND, /* & */
39+
GA_REDUCE_OR, /* | */
40+
GA_REDUCE_XOR, /* ^ */
41+
GA_REDUCE_ALL, /* &&/all() */
42+
GA_REDUCE_ANY, /* ||/any() */
4343
} ga_reduce_op;
4444

4545

4646

4747
/**
48-
* @brief Compute a reduction sum (+), product (*), non-zero product (* != 0),
49-
* min, max, argmin, argmax, min-and-argmin, max-and-argmax, and (&),
50-
* or (|), xor (^), all (&&) or any (||) over a list of axes to reduce.
48+
* @brief Compute a reduction over a list of axes to reduce.
5149
*
5250
* Returns one (in the case of min-and-argmin/max-and-argmax, two) destination
5351
* tensors. The destination tensor(s)' axes are a strict subset of the axes of the
5452
* source tensor. The axes to be reduced are specified by the caller, and the
5553
* reduction is performed over these axes, which are then removed in the
5654
* destination.
5755
*
56+
* @param [in] op The reduction operation to perform.
5857
* @param [out] dst The destination tensor. Has the same type as the source.
5958
* @param [out] dstArg For argument of minima/maxima operations. Has type int64.
6059
* @param [in] src The source tensor.
@@ -81,64 +80,6 @@ typedef enum _ga_reduce_op {
8180
* code otherwise.
8281
*/
8382

84-
GPUARRAY_PUBLIC int GpuArray_sum (GpuArray* dst,
85-
const GpuArray* src,
86-
unsigned reduxLen,
87-
const unsigned* reduxList);
88-
GPUARRAY_PUBLIC int GpuArray_prod (GpuArray* dst,
89-
const GpuArray* src,
90-
unsigned reduxLen,
91-
const unsigned* reduxList);
92-
GPUARRAY_PUBLIC int GpuArray_prodnz (GpuArray* dst,
93-
const GpuArray* src,
94-
unsigned reduxLen,
95-
const unsigned* reduxList);
96-
GPUARRAY_PUBLIC int GpuArray_min (GpuArray* dst,
97-
const GpuArray* src,
98-
unsigned reduxLen,
99-
const unsigned* reduxList);
100-
GPUARRAY_PUBLIC int GpuArray_max (GpuArray* dst,
101-
const GpuArray* src,
102-
unsigned reduxLen,
103-
const unsigned* reduxList);
104-
GPUARRAY_PUBLIC int GpuArray_argmin (GpuArray* dstArg,
105-
const GpuArray* src,
106-
unsigned reduxLen,
107-
const unsigned* reduxList);
108-
GPUARRAY_PUBLIC int GpuArray_argmax (GpuArray* dstArg,
109-
const GpuArray* src,
110-
unsigned reduxLen,
111-
const unsigned* reduxList);
112-
GPUARRAY_PUBLIC int GpuArray_minandargmin(GpuArray* dst,
113-
GpuArray* dstArg,
114-
const GpuArray* src,
115-
unsigned reduxLen,
116-
const unsigned* reduxList);
117-
GPUARRAY_PUBLIC int GpuArray_maxandargmax(GpuArray* dst,
118-
GpuArray* dstArg,
119-
const GpuArray* src,
120-
unsigned reduxLen,
121-
const unsigned* reduxList);
122-
GPUARRAY_PUBLIC int GpuArray_and (GpuArray* dst,
123-
const GpuArray* src,
124-
unsigned reduxLen,
125-
const unsigned* reduxList);
126-
GPUARRAY_PUBLIC int GpuArray_or (GpuArray* dst,
127-
const GpuArray* src,
128-
unsigned reduxLen,
129-
const unsigned* reduxList);
130-
GPUARRAY_PUBLIC int GpuArray_xor (GpuArray* dst,
131-
const GpuArray* src,
132-
unsigned reduxLen,
133-
const unsigned* reduxList);
134-
GPUARRAY_PUBLIC int GpuArray_all (GpuArray* dst,
135-
const GpuArray* src,
136-
unsigned reduxLen,
137-
const unsigned* reduxList);
138-
GPUARRAY_PUBLIC int GpuArray_any (GpuArray* dst,
139-
const GpuArray* src,
140-
unsigned reduxLen,
141-
const unsigned* reduxList);
14283
GPUARRAY_PUBLIC int GpuArray_reduction (ga_reduce_op op,
14384
GpuArray* dst,
14485
GpuArray* dstArg,

0 commit comments

Comments
 (0)