Repository navigation
helios/roce: pin proxy polling thread to high-capacity CPUs and name thread - #633
Closed
original-el8 wants to merge 1 commit into
Closed
original-el8 wants to merge 1 commit into
original-el8 wants to merge 1 commit into
Conversation
…thread On asymmetric ARM systems (such as NVIDIA Grace / GB10 big.LITTLE topologies), the Linux scheduler can place or migrate the RoCE RDMA proxy polling thread onto lower-capacity efficiency cores, adding tail latency to doorbell polling, completion draining, and relay forwarding. Calling `pthread_setname_np(pthread_self(), "flare-roce")` identifies the proxy thread in profilers and OS tools, and `pin_high_capacity_cpus()` restricts the thread's affinity mask within its existing allowed CPUs to the high-capacity tier while leaving homogeneous, single-tier, non-Linux, or <2-CPU environments unchanged. Before -> after: - `helios/native/roce_proxy.c`: previously `proxy_main()` left the thread unnamed and inherited the process CPU affinity mask unmodified. Added Linux-only `pin_high_capacity_cpus()` (reading `/sys/devices/system/cpu/cpu<id>/cpu_capacity` for CPUs in `sched_getaffinity`, selecting `>= 90%` of `max_cap` or fallback `> (min_cap + max_cap) / 2` when `>= 2` and `< count` CPUs qualify) and invoked `pthread_setname_np(pthread_self(), "flare-roce")` and `pin_high_capacity_cpus()` at the start of `proxy_main()`. - Preserved `ROCE_SEND_DEPTH / 6` in `reserve()`, its world=16 ACK safety bound, and `ROCE_ABI_VERSION 14` unchanged. Claimed benefit: Prevents the RoCE proxy polling thread from running on lower-capacity CPUs on asymmetric Linux hosts and makes the thread identifiable as `flare-roce` in OS and profiler traces without altering wire layout, send-queue reservation, or homogeneous-host affinity. Supporting evidence and material limitations: - `cc -std=gnu11 -Wall -Wextra -Werror -c helios/native/roce_proxy.c -o /dev/null` and `cc -std=gnu11 -Wall -Wextra -Werror -c helios/native/roce_proxy_dlopen.c -o /dev/null`: passed with 0 warnings. - `CUDA_VISIBLE_DEVICES="" cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server,roce --lib -- execution::roce`: 30 passed, 0 failed, 0 ignored. - `cargo check --locked --manifest-path flare-cli/Cargo.toml`: passed. - Combined-stack 4x DGX Spark (SM121) TP4 RoCE serving via `flare run` (integrating the companion b12x kernel, recipe, and scheduler optimizations) passed end-to-end qualification; isolated single-PR TP4 serving A/B and direct `cpu_capacity` sysfs pinning ablation were not run separately. Design-Signed-Off-By: Antigravity (Gemini 4 Hydrogen); design-review=2e5b
Collaborator
|
A case file has been opened for 633. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Collaborator
Review StoppedAuto-Review halted due to finding: Another open pull request already covers this change, or more of it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On asymmetric Linux systems (such as ARM big.LITTLE / NVIDIA Grace CPUs),
proxy_maininhelios/native/roce_proxy.cstarts the RoCE RDMA polling thread without setting a thread name or constraining its CPU affinity within the process's allowed mask. When the OS scheduler places or migrates that polling thread onto lower-capacity CPUs, doorbell polling, completion draining, and ring relay forwarding incur avoidable CPU-side latency and jitter.Restricting the thread within its existing
sched_getaffinitymask using Linux sysfscpu_capacitykeeps it on high-capacity cores when multiple capacity tiers are present, while acting as a no-op on homogeneous systems, non-Linux hosts, or masks without multiple tiers or fewer than two high-capacity CPUs. Naming the thread"flare-roce"makes it directly identifiable in OS tools and profilers.What changed (before -> after)
helios/native/roce_proxy.c:proxy_mainran with the inherited thread name and process CPU affinity mask unmodified.#ifdef __linux__,proxy_maincallspthread_setname_np(pthread_self(), "flare-roce")andpin_high_capacity_cpus().pin_high_capacity_cpus()reads/sys/devices/system/cpu/cpu<id>/cpu_capacityfor each CPU in the thread'ssched_getaffinitymask; ifcount >= 2andmin_cap != max_cap, it narrows the mask to CPUs withcapacity >= 0.9 * max_cap(falling back tocapacity > (min_cap + max_cap) / 2if fewer than 2 qualify) and appliessched_setaffinityonly when2 <= selected < count. If sysfscpu_capacityis absent, unparseable, homogeneous, or already restricted to one tier, the mask is left unchanged.ROCE_SEND_DEPTH / 6inreserve(), itsworld = 16ACK safety bound, andROCE_ABI_VERSION 14unchanged.ROCE_ABI_VERSION 14) changes.Claimed benefit and measured results
Prevents the RoCE proxy polling thread from running on lower-capacity cores on asymmetric ARM hosts and labels the thread
flare-rocein OS and profiler traces without changing RDMA queue reservation or homogeneous-host scheduling.flare run):flare runverification integrates the combined SM121/RoCE kernel, recipe, and scheduler optimization set; isolated single-PR TP4 serving A/B was not run separately.GB10,SM121, 48 SMs, 121 GiB unified LPDDR5x, dual-rail ConnectX-7 200 GbE RoCEv2),deepseek-ai/DeepSeek-V4.1-Flash-1017TP4 exported package (draft_tokens = 7,speculative_token_capacity = 256,graph_budget = 80,prefill_chunk = 8192,row_shard_prefill = True,row_shard_attention = True,adaptive_verification_alpha = 0.75), served viaflare run(27,051,776logical KV tokens/rank, up from26,272,640baseline).17 * 23 = 391): pass4/4distinct images,4vision graph launches):4/4pass8K, 16K, 32K, 64K, 128K,0reused tokens):5/5pass (128Kin11.71 s)4 x 32Klong-context stress:4/4pass in12.19 s,0failed requests,0preemptionsllm-decode-benchv0.8.0 (exactnative token counting,30 s/cell sustained decode,0errors,0CJK):prompt_tokens / client TTFT):8K8,639 tok/s(0.95 s),32K10,994 tok/s(2.98 s, vs10,810 tok/sbaseline),128K11,349 tok/s(11.55 s, vs11,181 tok/sbaseline); cold64Kpass-2 prefill reached11,390.9 tok/swall (11,462.6 tok/sGPU).C = 1, 2, 4, 8):8K:67.7 / 106.5 / 159.1 / 224.6 tok/s(vs65.4 / 107.1 / 152.5 / 218.6 tok/smatchingdraft_tokens = 7,alpha = 0.75baseline)32K:71.2 / 107.6 / 163.1 / 227.6 tok/s(vs70.2 / 105.0 / 154.9 / 222.4 tok/sbaseline)128K:69.1 / 99.2 / 154.0 / 219.9 tok/s(12-cell geomean126.61 tok/svs124.96 tok/sbaseline;B16xW1pure 1-token/lane GPU step75.70 ms -> 70.54 ms,-6.8%)8K C=16 / C=32underalpha = 0.75(272.5 / 411.0 tok/s): atalpha = 0.75withmax_verification_token_budget = 256, unclamped calibration offers~2.8–2.9drafts/lane on low-acceptance prose (49.4%–51.8%accept rate vs59.7%–62.2%baseline), increasing packed verification rows;C=32fixed-prompt sweep (P=256) reached419.93 tok/s.5/5runs,0CJK):109.0 tok/smedian,110.7 tok/smean,118.0 tok/speak (vs116.5 tok/sbaseline).46,766completion tokens:27,108reasoning +19,658HTML/JS code,temperature = 1.0, adaptivedraft_tokens = 7):118.23 tok/s(179.53 tok/s1s peak,162.56 tok/s5s peak; vs114.68 tok/sfixed-W=8baseline and87.74 tok/sflat-ceiling adaptiveW=6baseline)105.49 tok/s(4.19mean tokens/step,5.40offered drafts/round)19,655tokens up to47Kcontext):141.85 tok/s(6.11mean tokens/step,6.59offered drafts/round,77.6%accept rate, per-depth survival[0.955, 0.904, 0.854, 0.791, 0.715, 0.614, 0.279]).Supporting evidence and material limitations
-std=gnu11 -Wall -Wextra -Werror):cc -std=gnu11 -Wall -Wextra -Werror -c helios/native/roce_proxy.c -o /dev/null: passed with 0 warnings.cc -std=gnu11 -Wall -Wextra -Werror -c helios/native/roce_proxy_dlopen.c -o /dev/null: passed with 0 warnings.CUDA_VISIBLE_DEVICES="",--locked):cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server,roce --lib -- execution::roce:30 passed, 0 failed, 0 ignored(includesnative_proxy_abi_matches_core_contractandlazy_libibverbs_loader_resolves_symbols_or_reports_install_hintlinking the compiledroce_proxy_dlopen.c/roce_proxy.cobject).cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server,roce --lib -- roce:42 passed, 0 failed, 0 ignored.cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server --lib:1,738 passed, 6 failed, 46 ignored(the 6 failures are unrelated frontend template fixture tests that requireFLARE_TEST_TEMPLATE_DIRto be set).cargo check --locked --manifest-path flare-cli/Cargo.toml: passed cleanly.flare runvalidation above exercises the combined SM121/RoCE kernel, recipe, and scheduler optimization set; isolated single-PR TP4 serving A/B and directcpu_capacitysysfs pinning ablation were not run separately (thread naming andcpu_capacityaffinity narrowing are verified by inspection, strict compilation, and CPU RoCE unit tests).Discord: el8