Skip to content

optimize completion sink accepted path (#4262)#4262

Open
mariusae wants to merge 2 commits into
meta-pytorch:mainfrom
mariusae:export-D108622923
Open

optimize completion sink accepted path (#4262)#4262
mariusae wants to merge 2 commits into
meta-pytorch:mainfrom
mariusae:export-D108622923

Conversation

@mariusae

@mariusae mariusae commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary:

Make the accepted completion path cheap by replacing the generic SendCompletion callback sink with explicit rejection-oriented sink variants. CompletionSink::ignore() and accepted oneshot completions now avoid callback dispatch, contramap_rejected() preserves Ignore without allocation, and MailboxClient uses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion.
ghstack-source-id: 393929683
exported-using-ghexport

Reviewed By: andrewjcg

Differential Revision: D108622923

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 16, 2026
@meta-codesync

meta-codesync Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

@mariusae has exported this pull request. If you are a Meta employee, you can view the originating Diff in D108622923.

@mariusae mariusae force-pushed the export-D108622923 branch from 7e7acee to 7e3b9aa Compare June 19, 2026 17:20
@meta-codesync meta-codesync Bot changed the title optimize completion sink accepted path (#4258) optimize completion sink accepted path (#4262) Jun 19, 2026
mariusae added a commit to mariusae/monarch that referenced this pull request Jun 19, 2026
Summary:


Make the accepted completion path cheap by replacing the generic `SendCompletion` callback sink with explicit rejection-oriented sink variants. `CompletionSink::ignore()` and accepted oneshot completions now avoid callback dispatch, `contramap_rejected()` preserves `Ignore` without allocation, and `MailboxClient` uses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion.
ghstack-source-id: 393929683
exported-using-ghexport

Reviewed By: andrewjcg

Differential Revision: D108622923
mariusae added a commit to mariusae/monarch that referenced this pull request Jun 19, 2026
Summary:


Make the accepted completion path cheap by replacing the generic `SendCompletion` callback sink with explicit rejection-oriented sink variants. `CompletionSink::ignore()` and accepted oneshot completions now avoid callback dispatch, `contramap_rejected()` preserves `Ignore` without allocation, and `MailboxClient` uses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion.
ghstack-source-id: 393929683
exported-using-ghexport

Reviewed By: andrewjcg

Differential Revision: D108622923
mariusae added 2 commits June 19, 2026 12:17
Summary:


Replace the implicit oneshot-based channel return path with an explicit `SendCompletion` / `CompletionSink` contract. `Tx::do_post` now receives a concrete completion sink, `post()` uses `CompletionSink::ignore()`, and `try_post()` adapts the existing oneshot API through `CompletionSink::oneshot()`. Add explicit `accept()` and `reject()` calls at channel terminal points, and use `contramap_rejected()` for adapters such as `AttachTx` so accepted completions pass through unchanged while rejected wrapped messages are translated back to their outer message type. Convert `MailboxClient` to observe completions directly with `CompletionSink::callback()`, removing the per-message task that waited on a return-channel oneshot while preserving undeliverable handling and flush notification.
ghstack-source-id: 393929682
exported-using-ghexport

Reviewed By: andrewjcg

Differential Revision: D108622920
Summary:


Make the accepted completion path cheap by replacing the generic `SendCompletion` callback sink with explicit rejection-oriented sink variants. `CompletionSink::ignore()` and accepted oneshot completions now avoid callback dispatch, `contramap_rejected()` preserves `Ignore` without allocation, and `MailboxClient` uses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion.
ghstack-source-id: 393929683
exported-using-ghexport

Reviewed By: andrewjcg

Differential Revision: D108622923
@mariusae mariusae force-pushed the export-D108622923 branch from 7e3b9aa to 238988a Compare June 19, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant