Skip to content

feat(server): add selectable backend IPC payload transport - #312

Merged
davide221 merged 1 commit into
Luce-Org:mainfrom
weicj:feat-backend-ipc-payload-transport
Jun 7, 2026
Merged

davide221 merged 1 commit into
Luce-Org:mainfrom
weicj:feat-backend-ipc-payload-transport

Conversation

@weicj

@weicj weicj commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds explicit backend IPC data-payload transport modes: stream, shared, and auto, so the IPC path can choose between low fixed memory cost and lower large-payload copy cost.

stream keeps the existing stream/file-backed payload path. It has very low fixed host-memory cost, but large activation payloads pay more stream/read/write copy overhead, so it remains the conservative default. shared uses a shared fd + mmap payload buffer. It reduces host-side IPC copies and improves large payload transport latency, but it has a fixed host-memory buffer cost, so it is an explicit mode. auto requests the minimum safe shared buffer for the current DFlash IPC configuration first, then falls back to stream if the shared buffer cannot be allocated.

The immediate integration is DFlash draft IPC input payloads. More generally, this makes IPC transport an explicit mode switch, so additional transport choices can be added later without changing the high-level command shape.

Changes

  • Extend backend_ipc.h/.cpp with shared fd creation, mmap mapping, daemon remapping, cleanup, Linux memfd_create, and unlinked temporary-file fallback.
  • Add bounded payload helpers for size overflow checks and in-bounds checks.
  • Add explicit payload transport modes:
    • stream: existing stream/file-backed payload transport.
    • shared: shared fd + mmap payload transport.
    • auto: try shared transport first, then fall back to stream if shared buffer allocation fails.
  • Let DFlash draft IPC create an optional shared payload buffer during daemon startup and pass --shared-payload-fd / --shared-payload-bytes when shared transport is enabled.
  • Keep DFlash draft IPC default on stream; DFLASH_DRAFT_IPC_TRANSPORT=shared requires the shared buffer path, while DFLASH_DRAFT_IPC_TRANSPORT=auto can fall back to stream.
  • Size the DFlash shared buffer from the current IPC payload shape instead of using a fixed default. DFLASH_DRAFT_IPC_SHARED_BYTES can raise the requested capacity, but not below the minimum required for the configured DFlash IPC payload.
  • Add feature_slice_shared and propose_shared daemon commands for shared input payloads.
  • Preserve existing stream and file-backed commands as fallback.
  • Keep daemon readiness, status, and hidden-output replies on the existing stream fd.
  • Update backend IPC daemon argument parsing for the new shared fd/size arguments.
  • Add unit coverage for transport parsing, overflow checks, and bounds checks.

Notes

Transport A/B on a 16K Qwen/Qwen3.6-27B F16/BF16 hidden-state-equivalent payload (160 MiB) showed shared mmap reducing host-side IPC copy from about 320 MiB to 160 MiB per handoff. Measured transport time improved by 11.85% for CUDA->CUDA and 10.70% for CUDA->HIP. A 64 KiB sanity check showed shared mmap does not materially regress small payload latency, but the practical value is activation-sized payload transport.

Validation for this slice covers CUDA sm61 and HIP ROCm 6.3.3/gfx906 transport smokes, including same-backend and CUDA<->HIP cross-backend allreduce-auto routes.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 7 files

Re-trigger cubic

@weicj
weicj force-pushed the feat-backend-ipc-payload-transport branch from d218ffa to 4777e86 Compare May 30, 2026 06:44
@weicj
weicj marked this pull request as draft May 30, 2026 07:08
@weicj
weicj force-pushed the feat-backend-ipc-payload-transport branch from 4777e86 to 5cf3118 Compare May 30, 2026 07:20
@weicj
weicj marked this pull request as ready for review June 1, 2026 12:09

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

4 issues found across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/src/common/backend_ipc.cpp Resolved
Comment thread server/src/ipc/backend_ipc_main.cpp Resolved
Comment thread server/src/common/dflash_draft_ipc.cpp Resolved
easel pushed a commit to easel/lucebox-hub that referenced this pull request Jun 1, 2026
# Conflicts:
#	server/src/common/backend_ipc.cpp
#	server/src/common/dflash_draft_ipc.cpp
#	server/src/common/dflash_draft_ipc_daemon.cpp
#	server/src/ipc/backend_ipc_main.cpp

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/src/common/dflash_draft_ipc.cpp Resolved
@weicj
weicj force-pushed the feat-backend-ipc-payload-transport branch from 26a892a to 9ca3d9b Compare June 1, 2026 12:35
easel pushed a commit to easel/lucebox-hub that referenced this pull request Jun 1, 2026
Integrate the advanced selectable backend IPC payload transport head while preserving the existing qwen35 target-shard IPC mode and current stack parsing. Resolve shared-payload conflicts in the DFlash draft daemon/client and backend IPC entry point.
easel pushed a commit to easel/lucebox-hub that referenced this pull request Jun 1, 2026
Record the advanced PR Luce-Org#312 integration, exact-head classification, retained conflict probes, and validation outcomes for the unattended auto-integration run.
Rebased onto main after Luce-Org#321 (mixed-backend target split) merged. Luce-Org#321 already
carried an early copy of the payload transport; this adds the shared-payload
header (sequence + byte count) hardening and reconciles it with Luce-Org#321:
- keep Luce-Org#321 Qwen35TargetShard mode + target-shard args;
- adopt the hardened shared-payload header in the writer, draft-IPC reader, and
  daemon arg parsing (require_value / parse_nonnegative_int / parse_size_arg),
  keeping parse_int_list for target-shard list args;
- propagate the header format into the qwen35 target-shard daemon (forward_shared
  mmaps header+payload, reads at the header offset, validates sequence/bytes);
- drop the add/add duplicate of the transport name/parse helpers;
- update MockLayerSplitAdapter::decode_dflash for the accept_rate signature.

Original work: PR Luce-Org#312 (weicj). Verified on lucebox2: CUDA + HIP build,
test_server_unit passes (1836 assertions), mixed cuda:0,hip:0 with
DFLASH_TARGET_SHARD_IPC_TRANSPORT=shared reports accept_rate ~0.54, output correct.

Co-Authored-By: WOZCODE <[email protected]>
@davide221
davide221 force-pushed the feat-backend-ipc-payload-transport branch from 9ca3d9b to 5df13c5 Compare June 7, 2026 15:20
@davide221
davide221 merged commit f83a96c into Luce-Org:main Jun 7, 2026
2 checks passed
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