Skip to content

Let a send-immediate parcelport queue the parcels to a busy destination - #8182

Merged
hkaiser merged 1 commit into
TheHPXProject:masterfrom
hkaiser:send-immediate-per-destination
Nov 21, 2026
Merged

hkaiser merged 1 commit into
TheHPXProject:masterfrom
hkaiser:send-immediate-per-destination

Conversation

@hkaiser

@hkaiser hkaiser commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

  • A connection handler that sends parcels immediately (send_immediate_parcels) can now decide per destination, through an optional can_send_immediate(locality const&). If it refuses, put_parcel/put_parcels queue the parcels as for parcelports that don't send immediately.
  • In send-immediate mode, get_connection_and_send_parcels sends the queued parcels of a destination only once the connection handler accepts the destination again. trigger_pending_work(), called from the background work, then encodes all of them into one message.
  • Connection handlers without the new overload (TCP, MPI, LCI, LCW) behave as before.

Any background context you want to provide?

This lets a parcelport that has only one message in flight per destination (the GASNet and OpenSHMEM parcelports of #7655 and #7519) send a parcel immediately if nothing is being sent to its destination, and send the parcels that arrive meanwhile together once it is free. In the GASNet parcelport, bursts of empty actions between two localities went from about 13 to 19 µs per action (every parcel its own message) to about 5 to 12 µs, with the single round trip unchanged (about 30 to 40 µs); TCP takes about 4 to 7 µs per action there.

Checklist

  • I have added a new feature and have added tests to go along with it.
  • I have fixed a bug and have added a regression test.
  • I have added a test using random numbers; I have made sure it uses a seed, and that random numbers generated are valid inputs for the tests.

A connection handler that sends parcels immediately can now refuse that
for a given destination, through can_send_immediate(locality const&).
The parcels to that destination are then queued, and the background
work (trigger_pending_work) sends all of them in one message once the
destination is free again. Connection handlers without that overload
behave as before.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
@hkaiser hkaiser added this to the 2.1.0 milestone Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved parcel delivery scheduling by checking whether immediate sending is available for each destination. Parcels that cannot be sent immediately remain queued for later background processing, helping ensure they are handled according to the destination’s availability.

Immediate-send eligibility now receives the destination locality. Single-parcel, batch-parcel, and queued-work paths use this check. When a queued destination is not eligible, its parcels remain queued for later background work.

Changes: Immediate parcel eligibility

Layer / File(s) Summary
Destination-aware eligibility and send paths
libs/full/parcelset/include/hpx/parcelset/parcelport_impl.hpp
The eligibility helper uses can_send_immediate(dest) when available and otherwise falls back to can_send_immediate(). Single-parcel and batch-parcel submissions pass the destination. Queued-work processing leaves parcels queued when the destination is not eligible.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: iemanshuman

Merge Risk: Minimal · up to 01744

This change lets a send-immediate parcelport queue parcels for a busy destination and batch them later. Handlers that do not provide the new overload behave as before, and no concrete defect was found in the changed paths. The main remaining unknown is how an external handler will use the new hook, since no such handler is in the repository.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a send-immediate parcelport can queue parcels for a busy destination. The raw summary confirms per-destination immediate-send eligibility, with queuing when the destin…
Description check Passed The description states the per-destination can_send_immediate hook, the queuing behavior in put_parcel/put_parcels, the batching in get_connection_and_send_parcels and trigger_pending_work, and the un…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a send-immediate parcelport can queue parcels for a busy destination. The raw summary confirms per-destination immediate-send eligibility, with queuing when the destination check refuses. The title is specific and matches the changeset.

Full details: Description check

Explanation

The description states the per-destination can_send_immediate hook, the queuing behavior in put_parcel/put_parcels, the batching in get_connection_and_send_parcels and trigger_pending_work, and the unchanged behavior for TCP, MPI, LCI and LCW. It also gives benchmark motivation. It is directly related to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f6f04973-9ad1-4d85-9179-faf28aec6fd9
Commits

Reviewing files that changed from the base of the PR and between 161df7f and 01744e9.

Files selected for processing: 1

  • libs/full/parcelset/include/hpx/parcelset/parcelport_impl.hpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@hkaiser
hkaiser merged commit 2ef6b6d into TheHPXProject:master Nov 21, 2026
160 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant