Ticket #37 (new feature request)
Opened 3 years ago
Support for "combining" operators
| Reported by: | blever | Owned by: | chak |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Accelerate language | Version: | 0.8.0.0 |
| Keywords: | Cc: |
Description
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
Note: See
TracTickets for help on using
tickets.
