-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
To make it easier to pass an alpaka::Buf
to a kernel and use it with the alpaka::uniformElements
loops, I am thinking of looking into:
definingedit this exists already :-)alpaka::MdSpan<T, ...::dextents<...>, ...>
as an alias forstd::mdspan
(c++23) orstd::experimental::mdspan
(from Kokkos's reference implementation), with the template arguments corresponding to what is returned byalpaka::experimental::getMdSpan<Buf>
- making
alpaka::Buf
implicitly convertible toalpaka::MdSpan
(with the correct template arguments) - making
alpaka::Vec
implicitly convertible tostd::array
This way we should be able to write (pseudo)code like
struct Kernel {
void operator()(Acc3D const& acc, alpaka::MdSpan<float, 3> data, Vec3D size) const {
for (auto index: alpaka::uniformElements(acc, size)) {
use(data[index]);
}
}
};
void function(Queue& queue) {
Vec3D size = { 32, 16, 50 };
auto buf = alpaka::allocAsyncBuf<float>(queue, size);
auto grid = alpala::WorkDivElements<Acc3D>{...};
alpaka::exec<Acc3D>(queue, grid, Kernel{}, buf, size);
}
@psychocoderHPC can you remind me what are the limitations of std::mdspan
that prompted you to implement your own version for alpaka 3 ?
@SimeonEhrig I remember we discussed this some time ago, but I cannot find the links to your code any more :-(
comments, ideas or objections ?