kokkos / mdspan

Reference implementation of mdspan targeting C++23
Other
415 stars 69 forks source link

Fixes issue #175 #184

Closed youyu3 closed 2 years ago

youyu3 commented 2 years ago

Fixes #175 .

mhoemmen commented 2 years ago

@crtrott We had an offline discussion about whether to use MDSPAN_INLINE_FUNCTION instead of _MDSPAN_HOST_DEVICE. We concluded that using _MDSPAN_HOST_DEVICE is fine, for the following reasons.

  1. The tests use it (for the lambdas given to dispatch).
  2. The functions in question don't need the inline keyword. It's generally desirable to have a way to spell __host__ __device__ without saying inline as well.

Given (2), I'll file an issue to rename _MDSPAN_HOST_DEVICE to MDSPAN_HOST_DEVICE, so that tests and examples can feel more confident to use it. It's not necessarily good to force the implementation to mix inline with __host__ __device__, because inline changes ODR semantics. For a header-only library, this doesn't matter quite so much, but users might pick up on the habit.