Skip to content

kokkos(ext): support when_all#262

Merged
romintomasetti merged 1 commit into
mainfrom
opstate
Jan 20, 2026
Merged

kokkos(ext): support when_all#262
romintomasetti merged 1 commit into
mainfrom
opstate

Conversation

@romintomasetti

Copy link
Copy Markdown
Collaborator

The problem is that Kokkos dispatches asynchronous work.

But while e.g. exec::static_thread_pool will simply call set_value_t(next_receiver) from the thread that performed the work, such that the next_receiver only starts its work once the current receiver has finished, it cannot be done like that with Kokkos dispatch.

My first approach was to customize schedule_from to properly synchronize when needed. But it seems it will not be called e.g. from within a when_all:

... | stdexec::when_all(fork | stdexec::continues_on(exec.get_scheduler()) | ...);

So I tried to get some inspiration from https://github.com/NVIDIA/stdexec/blob/485160802ee5ca42ca4915e3a2330579efae4ea3/include/nvexec/stream/common.cuh#L621-L629, that seems to do a continuation under some circumstances. Not sure it is the best way though.

@maartenarnst

Copy link
Copy Markdown
Collaborator

@maartenarnst

Copy link
Copy Markdown
Collaborator

@romintomasetti romintomasetti force-pushed the opstate branch 11 times, most recently from 68708e5 to 80aa4e0 Compare January 20, 2026 08:44
@romintomasetti romintomasetti force-pushed the opstate branch 5 times, most recently from 44501a8 to e468c4d Compare January 20, 2026 13:52
@romintomasetti romintomasetti changed the title Who should fence, when ? kokkos(ext): support when_all Jan 20, 2026
@romintomasetti romintomasetti self-assigned this Jan 20, 2026
Comment thread kokkos_ext/impl/execution_space/receiver.hpp Outdated
Comment thread kokkos_ext/impl/execution_space/schedule_from.hpp
Signed-off-by: romintomasetti <romin.tomasetti@gmail.com>
@romintomasetti romintomasetti merged commit 3306a8d into main Jan 20, 2026
15 checks passed
@romintomasetti romintomasetti deleted the opstate branch January 20, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants