|
HDK
|
#include <CE_ArrayView.h>
Classes | |
| class | Buffer |
Public Types | |
| typedef T | value_type |
| using | reduce_t = typename std::conditional< std::is_integral< T >::value, exint, fpreal64 >::type |
Public Member Functions | |
| exint | size () const |
| Returns the number of elements in the array. More... | |
| bool | isEmpty () const |
| const cl::Buffer & | buffer () const |
| CE_ArrayView (const cl::Buffer &b, exint size=-1) | |
| CE_ArrayView (const CE_BufferDevice< T > &b) | |
| CE_BufferDevice< T > | harden () const |
| template<typename V > | |
| void | convertFrom (const CE_ArrayView< V > &src, int src_tuplesize=1, int dst_tuplesize=1, exint src_offset=0, exint dst_offset=0, exint nelements=-1, T default_value=0) |
| template<typename V , typename I > | |
| void | convertFromIndices (const CE_ArrayView< V > &src, const CE_ArrayView< I > &indices, int src_tuplesize=1, int dst_tuplesize=1, exint dst_offset=0, T default_value=0) |
| void | extractChannel (CE_ArrayView< T > &dst, int tuplesize, int comp) const |
| Extract the channel from this into dst. More... | |
| void | insertChannel (const CE_ArrayView< T > &src, int tuplesize, int comp) |
| Insert the channel from src into this. More... | |
| void | prefixSum (CE_ArrayView< T > &dst, bool exclusive=true, CE_ScanOp op=CE_ScanOp::ADD) const |
| void | iota () |
| T | readValue (int idx) const |
| void | writeValue (int idx, const T &val, bool blocking=true) |
| void | readIntoArray (UT_Array< T > &array) const |
| void | sort (bool is_descending=false, int maxbits=0) |
| Sort the array. More... | |
| template<typename V > | |
| void | sortValues (CE_ArrayView< V > &vals, bool is_descending=false, int maxbits=0) |
| Sort the array and the values. More... | |
| reduce_t | min (int tuplesize=1, int comp=0) const |
| reduce_t | minAbs (int tuplesize=1, int comp=0) const |
| reduce_t | minLength (int tuplesize=1) const |
| reduce_t | max (int tuplesize=1, int comp=0) const |
| reduce_t | maxAbs (int tuplesize=1, int comp=0) const |
| reduce_t | maxLength (int tuplesize=1) const |
| reduce_t | sum (int tuplesize=1, int comp=0) const |
| reduce_t | sumAbs (int tuplesize=1, int comp=0) const |
| reduce_t | sumSqr (int tuplesize=1, int comp=0) const |
| fpreal64 | average (int tuplesize=1, int comp=0) const |
| fpreal64 | rms (int tuplesize=1, int comp=0) const |
| reduce_t | dot (const CE_ArrayView< T > &b) const |
| void | constant (T cval) |
| template<typename I > | |
| void | reorder (const CE_ArrayView< I > &order) |
| cl::KernelFunctor | bind (cl::Kernel &k) const |
| cl::KernelFunctor | bind (const char *kernel_name) const |
Protected Types | |
| using | scalar_arg_t = typename std::conditional_t< std::is_same_v< T, fpreal16 >, fpreal32, T > |
Protected Member Functions | |
| cl::Kernel | loadKernel (const char *kernel_name, const char *opt=NULL) const |
| reduce_t | doReduce (const char *reduce_flags, const CE_ArrayView< T > *a, int tuplesize=1, int comp=0) const |
| template<typename V > | |
| V | reduceGroup (CE_ArrayView< V > &out, uint groupsize, const char *reduce_flags) const |
| template<typename V > | |
| void | sortInternal (CE_ArrayView< V > &vals, bool is_descending, int maxbits) |
| scalar_arg_t | scalarKernelArg (T v) |
Static Protected Member Functions | |
| template<typename V > | |
| static void | appendElemType (UT_WorkBuffer &wb) |
Protected Attributes | |
| const cl::Buffer | myBuffer |
| const exint | mySize |
Friends | |
| template<typename V > | |
| class | CE_Array |
Shares an existing OpenCL buffer and views it as an array. The lifetime of the shared buffer must exceed the lifetime of this object.
Definition at line 41 of file CE_ArrayView.h.
| using CE_ArrayView< T >::reduce_t = typename std::conditional<std::is_integral<T>::value, exint, fpreal64>::type |
Reduce to long for integral types and fpreal64 for floats, since the caller can always downcast after the fact if desired.
Definition at line 127 of file CE_ArrayView.h.
|
protected |
Definition at line 188 of file CE_ArrayView.h.
| typedef T CE_ArrayView< T >::value_type |
Definition at line 44 of file CE_ArrayView.h.
| CE_ArrayView< T >::CE_ArrayView | ( | const cl::Buffer & | b, |
| exint | size = -1 |
||
| ) |
Size expects the number of elements in the buffer. If size is not provided, it is calculated from the buffer size.
|
explicit |
|
staticprotected |
Definition at line 59 of file CE_ArraySortImpl.h.
|
inline |
Definition at line 139 of file CE_ArrayView.h.
| cl::KernelFunctor CE_ArrayView< T >::bind | ( | cl::Kernel & | k | ) | const |
| cl::KernelFunctor CE_ArrayView< T >::bind | ( | const char * | kernel_name | ) | const |
|
inline |
Definition at line 49 of file CE_ArrayView.h.
| void CE_ArrayView< T >::constant | ( | T | cval | ) |
| void CE_ArrayView< T >::convertFrom | ( | const CE_ArrayView< V > & | src, |
| int | src_tuplesize = 1, |
||
| int | dst_tuplesize = 1, |
||
| exint | src_offset = 0, |
||
| exint | dst_offset = 0, |
||
| exint | nelements = -1, |
||
| T | default_value = 0 |
||
| ) |
Copy/convert data from an array of another type and/or tuple size. Extra tuple components in the source array are discarded. Extra tuple components in the destination array are set to the default. It's up to the caller to ensure that the types can convert with sufficient precision. src_offset, dst_offset, and nelements each expect a number of tuples. If nelements >= 0, only the given number of tuples are copied.
Definition at line 88 of file CE_ArraySortImpl.h.
| void CE_ArrayView< T >::convertFromIndices | ( | const CE_ArrayView< V > & | src, |
| const CE_ArrayView< I > & | indices, | ||
| int | src_tuplesize = 1, |
||
| int | dst_tuplesize = 1, |
||
| exint | dst_offset = 0, |
||
| T | default_value = 0 |
||
| ) |
The same as convertFrom(), except this converts a selection of tuples listed in the index array. The indices should be in the range [0, src.size()/src_tuplesize - 1].
Definition at line 130 of file CE_ArraySortImpl.h.
|
protected |
| reduce_t CE_ArrayView< T >::dot | ( | const CE_ArrayView< T > & | b | ) | const |
| void CE_ArrayView< T >::extractChannel | ( | CE_ArrayView< T > & | dst, |
| int | tuplesize, | ||
| int | comp | ||
| ) | const |
Extract the channel from this into dst.
| CE_BufferDevice<T> CE_ArrayView< T >::harden | ( | ) | const |
Harden the view into a buffer, which now owns a copy of the array data. You must include CE_BufferDevice.h to use this.
| void CE_ArrayView< T >::insertChannel | ( | const CE_ArrayView< T > & | src, |
| int | tuplesize, | ||
| int | comp | ||
| ) |
Insert the channel from src into this.
| void CE_ArrayView< T >::iota | ( | ) |
|
inline |
Definition at line 48 of file CE_ArrayView.h.
|
protected |
| reduce_t CE_ArrayView< T >::max | ( | int | tuplesize = 1, |
| int | comp = 0 |
||
| ) | const |
| reduce_t CE_ArrayView< T >::maxAbs | ( | int | tuplesize = 1, |
| int | comp = 0 |
||
| ) | const |
| reduce_t CE_ArrayView< T >::maxLength | ( | int | tuplesize = 1 | ) | const |
| reduce_t CE_ArrayView< T >::min | ( | int | tuplesize = 1, |
| int | comp = 0 |
||
| ) | const |
| reduce_t CE_ArrayView< T >::minAbs | ( | int | tuplesize = 1, |
| int | comp = 0 |
||
| ) | const |
| reduce_t CE_ArrayView< T >::minLength | ( | int | tuplesize = 1 | ) | const |
| void CE_ArrayView< T >::prefixSum | ( | CE_ArrayView< T > & | dst, |
| bool | exclusive = true, |
||
| CE_ScanOp | op = CE_ScanOp::ADD |
||
| ) | const |
Sum entries of this into dst. exclusive true will have dst elements only include the values of this strictly prior to itself. oneifnonzero will count number of non-zero entries in this.
| void CE_ArrayView< T >::readIntoArray | ( | UT_Array< T > & | array | ) | const |
| T CE_ArrayView< T >::readValue | ( | int | idx | ) | const |
Reads a single value from the array, blocking. May throw CE Exceptions.
|
protected |
| void CE_ArrayView< T >::reorder | ( | const CE_ArrayView< I > & | order | ) |
Definition at line 171 of file CE_ArraySortImpl.h.
|
inline |
Definition at line 146 of file CE_ArrayView.h.
|
inlineprotected |
Definition at line 190 of file CE_ArrayView.h.
|
inline |
Returns the number of elements in the array.
Definition at line 47 of file CE_ArrayView.h.
|
inline |
Sort the array.
Definition at line 109 of file CE_ArrayView.h.
|
protected |
Definition at line 202 of file CE_ArraySortImpl.h.
|
inline |
Sort the array and the values.
Definition at line 118 of file CE_ArrayView.h.
| reduce_t CE_ArrayView< T >::sum | ( | int | tuplesize = 1, |
| int | comp = 0 |
||
| ) | const |
| reduce_t CE_ArrayView< T >::sumAbs | ( | int | tuplesize = 1, |
| int | comp = 0 |
||
| ) | const |
| reduce_t CE_ArrayView< T >::sumSqr | ( | int | tuplesize = 1, |
| int | comp = 0 |
||
| ) | const |
| void CE_ArrayView< T >::writeValue | ( | int | idx, |
| const T & | val, | ||
| bool | blocking = true |
||
| ) |
Writes a single value to the array. May throw CE Exceptions.
Definition at line 193 of file CE_ArrayView.h.
|
protected |
Definition at line 198 of file CE_ArrayView.h.
|
protected |
Definition at line 199 of file CE_ArrayView.h.