Skip to content

Simplify async shuffle completion notification - #916

Merged
rapids-bot[bot] merged 8 commits into
rapidsai:mainfrom
wence-:wence/fea/shuffle-single-notify
Mar 16, 2026
Merged

Simplify async shuffle completion notification#916
rapids-bot[bot] merged 8 commits into
rapidsai:mainfrom
wence-:wence/fea/shuffle-single-notify

Conversation

@wence-

@wence- wence- commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Now that all shuffle partitions finish simultaneously, we can change the completion callback mechanism so that the completion callback fires exactly once, when all partitions are ready.

This makes tracking completion in the async shuffle much simpler, we can use the same setup as the async allgather: awaiting an event returned by insert_finished(). Once complete, extraction of any individual partition no longer blocks. extract therefore just allows extraction by partition ID and is no longer a coroutine, since it doesn't make sense as a suspension point any longer.

wence- added 4 commits March 13, 2026 16:58
Since all partitions now complete simultaneously, it does not make sense to
offer an interface to wait for an individual partition.
Since these now just defer to wait and wait for all partitions to be ready,
they are no longer necessary.
Now that all partitions complete together, we only need the finish callback
to fire once.
Now that the shuffle callback fires only once, we can use the same suspend
and wake mechanism that the async allgather uses. The async shuffle now
holds an event that is set by the finish callback when all partitions are
complete. We must now `co_await insert_finished()` and can then extract all
of our local partitions without blocking.
@wence-
wence- requested a review from a team as a code owner March 13, 2026 17:06
@wence- wence- added the breaking Introduces a breaking change label Mar 13, 2026
@wence-
wence- requested a review from a team as a code owner March 13, 2026 17:06
@wence- wence- added the improvement Improves an existing functionality label Mar 13, 2026
wence- added 2 commits March 13, 2026 17:27
We don't have competing coroutines now, so no need for parameterising over
the thread pool size.
@wence-
wence- force-pushed the wence/fea/shuffle-single-notify branch from 074b201 to baac65d Compare March 13, 2026 17:28
@madsbk

madsbk commented Mar 16, 2026

Copy link
Copy Markdown
Member

Looks like we have to update/remove the PeriodicSpillCheck test:

2026-03-13T17:38:35.3054296Z 4: [  FAILED  ] SpillManager.PeriodicSpillCheck (246 ms)
2026-03-13T17:38:35.3047329Z 4: /tmp/conda-bld-output/bld/rattler-build_librapidsmpf/work/cpp/tests/test_spill_manager.cpp:99: Failure
2026-03-13T17:38:35.3048698Z 4: Value of: num_calls
2026-03-13T17:38:35.3049466Z 4: Expected: (is > 10) and (is < 200)
2026-03-13T17:38:35.3050438Z 4:   Actual: 211 (of type long), which doesn't match (is < 200)

Comment thread cpp/src/streaming/coll/shuffler.cpp
@wence-

wence- commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

Looks like we have to update/remove the PeriodicSpillCheck test:

2026-03-13T17:38:35.3054296Z 4: [  FAILED  ] SpillManager.PeriodicSpillCheck (246 ms)
2026-03-13T17:38:35.3047329Z 4: /tmp/conda-bld-output/bld/rattler-build_librapidsmpf/work/cpp/tests/test_spill_manager.cpp:99: Failure
2026-03-13T17:38:35.3048698Z 4: Value of: num_calls
2026-03-13T17:38:35.3049466Z 4: Expected: (is > 10) and (is < 200)
2026-03-13T17:38:35.3050438Z 4:   Actual: 211 (of type long), which doesn't match (is < 200)

I mean, that code is not touched in this PR at all, but yes that test looks mostly nonsense

Sleeping the main thread and letting the periodic spill thread in the
background provides no guarantee on how the OS time-slices the execution,
so we can't really check anything here.
@wence-

wence- commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

Looks like we have to update/remove the PeriodicSpillCheck test:

2026-03-13T17:38:35.3054296Z 4: [  FAILED  ] SpillManager.PeriodicSpillCheck (246 ms)
2026-03-13T17:38:35.3047329Z 4: /tmp/conda-bld-output/bld/rattler-build_librapidsmpf/work/cpp/tests/test_spill_manager.cpp:99: Failure
2026-03-13T17:38:35.3048698Z 4: Value of: num_calls
2026-03-13T17:38:35.3049466Z 4: Expected: (is > 10) and (is < 200)
2026-03-13T17:38:35.3050438Z 4:   Actual: 211 (of type long), which doesn't match (is < 200)

I mean, that code is not touched in this PR at all, but yes that test looks mostly nonsense

Removed that test

@madsbk madsbk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wence-, we should have done this from the start! :)

@wence-

wence- commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 917d3d4 into rapidsai:main Mar 16, 2026
65 checks passed
@wence-
wence- deleted the wence/fea/shuffle-single-notify branch March 16, 2026 12:53
rapids-bot Bot pushed a commit to NVIDIA/cudf that referenced this pull request Mar 16, 2026
Since rapidsai/rapidsmpf#916, extraction is no longer a coroutine, one must just `await insert_finished()` that suspends until all partitions are ready. Thereafter we just `extract_chunk` without suspending.

Authors:
  - Lawrence Mitchell (https://github.com/wence-)

Approvers:
  - Mads R. B. Kristensen (https://github.com/madsbk)
  - Tom Augspurger (https://github.com/TomAugspurger)

URL: #21787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces a breaking change improvement Improves an existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants