Skip to content

comm: pin the RDMA pair proxy to the fastest core; post the chained flag WRITE inline - #270

Merged
AzeezIsh merged 2 commits into
Atlas-Inf:mainfrom
Enntity:sq-pr/rdma
Oct 30, 2026
Merged

AzeezIsh merged 2 commits into
Atlas-Inf:mainfrom
Enntity:sq-pr/rdma

Conversation

@data-angel

Copy link
Copy Markdown
Contributor

Part of #220.

What

Two changes to the RDMA pair from SparkQwen's engine. Both shipped inside its release squash f4d95a1; only these hunks are ported.

  • Proxy pinned to the fastest core. The atlas-rdma-pair proxy thread pins itself to the core with the highest cpuinfo_max_freq in its affinity mask (on GB10, an X925 big core).
    • It is best effort: if it can't read the frequencies or set the affinity, it logs one warning and runs unpinned.
    • ATLAS_RDMA_PROXY_PIN=0 opts out; on by default, as in production.
    • The core choice is a pure function (rdma_pair/pin.rs) over a sysfs root, so it is host-testable.
  • Chained flag WRITE posted on its own. Under ATLAS_RDMA_PAIR_CHAIN=1, the pair-chain flag WRITE is its own post, IBV_SEND_SIGNALED | IBV_SEND_INLINE, with max_inline_data = 16.
    • Both callers write the flag word before posting.
    • Both posts go on the same QP, so the flag still lands after the data.

Why

Each one-shot all-reduce hop pays for the proxy's wake-up and for the flag's separate DMA read. The expected gain (not separately measured here) is microseconds per all-reduce from pinning, and about 2 µs per one-shot hop from the inline flag. TP2 decode does two all-reduces per layer.

Benchmarks

Fingerprint (every number below). ennspark03/04, two GB10s at TP=EP=2 over RoCE, 2026-10-29. Checkpoint nvidia/Qwen3.8-Flash-Next-FP4-Local. Served by the SparkQwen launcher, profile 8x32k (--speculative --num-drafts=7 --max-num-seqs=8 --max-seq-len=32768 --max-prefill-tokens=16384 --kv-cache-dtype=bf16 --gpu-memory-utilization=0.88 --enable-prefix-caching), Strict and Spark modes.

  • Baseline: SparkQwen 0.4.0, engine Enntity/atlas 9b25f57, image atlas-sparkqwen:3e0d9e7e4b29.

  • Candidate: Enntity/atlas enntity-stack/sq-integ cf4200e = Atlas-Inf main a12bffa plus this PR series, image atlas-sparkqwen:cc103bd6cc92.

  • Harness: SparkQwen bench/sq_bench.py: streamed, temperature 0, reasoning_effort low; decode = 384-token prose/code/JSON, 3 reps; cold TTFT at 2K/8K/16K/28K, 2 reps; aggregate decode at C1–C8, 256 tokens per stream, 2 reps; warm 8K/20K conversations. Medians per cell. Plus greedy_eq.py (8 prompts, 320 tokens, temp 0) and lp_dump.py (echo prompt logprobs at 1K/6K/20K tokens).

  • Baseline and candidate arms interleaved on the same pair in one session.

  • One box and one harness, so these are observations under this fingerprint, not cross-validated claims.

  • No isolated A/B: both changes ran inside the series.

  • The log shows RDMA proxy pinned to cpu 19 (3900 MHz), the same core 0.4.0 pins to.

Whole series vs SparkQwen 0.4.0 (arms q-040-* / q-fix-*):

Strict 0.4.0 Strict main+series Spark 0.4.0 Spark main+series
greedy text, 8 prompts 8/8 identical 8/8 identical
prompt logprobs (1K/6K/20K) max |Δ| 0.0000 max |Δ| 0.0000
decode prose / code tok/s 54.1 / 77.7 54.2 / 77.8 61.0 / 86.8 61.6 / 92.9
cold TTFT 2K / 16K / 28K s 0.681 / 3.94 / 6.92 0.677 / 3.95 / 6.99 0.673 / 3.90 / 6.88 0.673 / 3.94 / 6.94
C1 / C2 / C4 / C8 tok/s 51.3 / 83.5 / 131 / 192 51.3 / 83.4 / 130 / 189 58.1 / 88.5 / 139 / 192 58.8 / 89.2 / 139 / 202

For reference, Atlas-Inf main c998a49 with the same launcher measured −9..−12% at C1, −15% at C2, −21..−25% at C4 and +21% cold TTFT against 0.4.0 (2026-10-29, same pair and harness).

Tests

  • 3 host tests for the core choice, written first: GB10 shape, allowed cores only, unreadable frequencies.
  • cargo test -p spark-comm: 51 passed. cargo test -p atlas-rdma: 27 passed.
  • clippy with --cfg atlas_rdma_verbs compiles the verbs-gated call site.
  • fmt, clippy and doc pass.
  • The shim change is byte-identical to production's, and it compiled and ran in the image on the pair.

Authorship

AI-authored (Claude Code), ported from SparkQwen's AI-authored engine. No human-written code.

🤖 Generated with Claude Code

data-angel and others added 2 commits October 29, 2026 21:23
…IN=0 opts out)

The proxy thread spins serving every pair channel, and unpinned the
scheduler moves it between GB10's big (3.9 GHz) and little (2.8 GHz)
cores; every hop of a decode all-reduce waits on it. It now pins itself
to the allowed core with the highest cpuinfo_max_freq (the last of
equals), best effort: if the cores cannot be read or set it logs and runs
unpinned. Ported from the SparkQwen 0.4.0 engine (proxy.rs pin_proxy),
in its own verbs-free module so the core choice runs in host tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
rs_post_write_flag (ATLAS_RDMA_PAIR_CHAIN=1: the RDMA pair's legacy and
one-shot channels) posted the data WRITE and the 8-byte flag WRITE as one
two-WR chain. The flag now goes as a second post with IBV_SEND_INLINE: a
single inline WQE reaches the NIC by BlueFlame instead of a doorbell and
a WQE fetch, about 2 us less per one-shot at decode sizes. Same QP, so the
responder still places the flag after the data; the flag's value is read
at post time, after the callers write it. QPs now request 16 bytes of
inline data. Ported from the SparkQwen 0.4.0 engine (rdma_shim.c).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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