eyalroz/cuda-kat

Support more combinations of assumptions w.r.t. copying

eyalroz opened this issue · 0 comments

Copying or moving data has (at least) the following variants:

  1. Element size in bytes
    1.1 size is a power of 2
    1.2 size is a natively-supported power of 2 (1, 2, 4, 8)
    1.3 size is a multiple of the physical write quantum
  2. Destination alignment:
    2.1 w.r.t. the element size
    2.2 w.r.t. natively-supported sizes (2, 4, 8)
  3. Source alignment:
    3.1 w.r.t. the element size
    3.2 w.r.t. natively-supported sizes (2, 4, 8)
  4. Trivial copiability/movability
  5. Alignment effects of the number of elements
    5.1 in itself
    5.2 relative to the beginning of the source
    5.3 relative to the beginning of the destination
  6. 6.1 Number of elements % warp size
    6.2. Number of elements % block size
  7. Participation cohesion in the copying: Full grid, full block, full warp, no constraint.

We currently ignore most of these, in some cases to detrimental effect. We are particularly not mindful enough of alignment and its effects.

This also has effects on other functions in cuda_kat, e.g. append_to_global_memory(), which may be forced to opt for a detail::naive_copy() because of issues with copy() or copy_n().