AccelerateHS / AccelerateHS/accelerate

Support for "combining" operators

Open
#6 1 comment 0 reactions 0 assignees View on GitHub
new feature
Dominant language
Haskell
Stars
1k
Forks
135
PR merge metrics
No merged PRs in 30d

Description

**Originally suggested by @blever**

The ability to combine multiple arrays into a single one can currently only be achieved using zip/zipWith. Of course, these arrays can only combine 2 arrays at a time, so in general it would be useful to have operators for combining more than 2 arrays in more elaborate, but structured, ways.

Some requirements could be:
- 'combine' operator:
- a generalised array combining operator
- sum of input arrays sizes is equal to output array size - i.e. no elements are lost or duplicated
- no permutation is performed on elements within in input array - i.e. output array elements are contiguous with respect to their source input array
- input array elements must all be of the same type and shape (shape would need to be a run-time check)
- the combination does not need to preserve dimensionality - e.g. multiple 1D arrays could be combined to produce another 1D array (concatenation), or a 2D array (stacked) or even "maybe" a 3D array (stack-stacking?)
- 'append' operator:
- a specialised array combining operator
- two input arrays - place one array at the "end" of the other
- input array elements of the same type
- the higher dimensions of the input arrays must have the same extent

In addition to fulfilling the need of a common pattern, combining operators would allow for further backend optimisations:
- input arrays to a combine operator would not require intermediate writing to memory - they can be written directly (by their producer) to their location within the combined output array
- on architectures such as Fermi, the generation of the input arrays can be done in parallel by using separate streams - 'combine' in this case acts as synchronisation barrier until all computations are complete

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.