Repository navigation
[ATOM gRPC] atomesh: an ATOM gRPC client, ATOM's protos in every build, the shared P/D rank mapping - #3675
[ATOM gRPC] atomesh: an ATOM gRPC client, ATOM's protos in every build, the shared P/D rank mapping#3675Jasen2201 wants to merge 49 commits into
Conversation
…d, the shared P/D rank mapping `apply_atom_pd_rank_mapping_policy` (none or idx2idx over the worker registry) and `parse_atom_prefill_info` (tp_size, kv_role and the chunked template from one `/kv_transfer_info` body) move from `PDRouter` into `core/placement/backend/atom.rs` beside `AtomAdapter`, unchanged but for parameters replacing `&self`, so a gRPC P/D router can pick the same ranks as the HTTP one. The HTTP router calls both, with the same results, error texts and log lines as before. The default `grpc-client` feature compiles engine_v1 and atom.grpc.v1 from the repository root: engine_v1 into `atom_engine::wire::pb`, and atom.grpc.v1's messages, client and server into `atom_engine::grpc`. `atom_engine::wire` builds in every default build, and `Inbound` decodes any frame that derefs to bytes, a ZMQ message or a gRPC `Frames` entry; `link`, `spec` and zmq stay behind `atom-engine`, which turns on `grpc-client`. `build_mesh.sh` copies the mesh to `atom/mesh` and both protos to their repository paths beside it; `setup_mesh.sh`, `MANIFEST.in` and the mocker workflow count the two protos as atomesh build inputs. atomesh talks to an ATOM worker over `atom.grpc.v1`: a request reaches ATOM as a GenerateRequest with its stop strings turned into token ids and the worker's DP rank attached, ATOM's stream comes back as tokens in order, a refusal carries ATOM's HTTP status (`EngineError::Http`), and dropping a request cancels the call. The tokenizer reaches dispatch through `Dispatcher::dispatch_with_tokenizer`; ATOM gets its own `AtomStream`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| n: Some(sampling.n.max(0) as u32), | ||
| ..Default::default() | ||
| }), | ||
| stop_token_sequences: stop_token_sequences(stops, tokenizer)?, |
There was a problem hiding this comment.
stop_token_ids and return_logprob are dropped here, so a stop id never stops the engine and logprobs return nulls instead of ATOM's 4xx. append stop_token_ids to stop_token_sequences and set the logprobs oneof, add a test for each?
There was a problem hiding this comment.
Thanks; the halves differ, since a gRPC answer should match ATOM's HTTP route.
stop_token_ids: unchanged. ATOM's HTTP routes ignore it too.- logprobs: 423f7c3 in [ATOM gRPC] atomesh: structured output to ATOM gRPC workers; answers as ATOM's HTTP routes give them #3677 answers 400
unsupported_logprobsto a chat withlogprobsand a/generatewithreturn_logprob, until ATOM's gRPC server carries logprobs./v1/completionskeepsnull, as ATOM's HTTP route does.
Where ATOM's HTTP routes decide this
ChatCompletionRequestandCompletionRequest(atom/entrypoints/openai/protocol.py) declare nostop_token_idsand setextra="ignore", so a stop id never stops the engine over HTTP; adding it tostop_token_sequenceswould make gRPC differ.- The HTTP chat route returns logprobs, which Generate does not carry, so a silent
nullwould differ; a 400 says so instead. /v1/completionsalways answers"logprobs": None(serving_completion.py).- The refusal sits beside the media one in
routers/grpc/router.rsandpd_router.rs; the router tests add a row per route, regular and P/D.
| // Absent, ATOM applies its HTTP routes' default. | ||
| max_tokens: sampling.max_new_tokens.map(i64::from), | ||
| ignore_eos: sampling.ignore_eos, | ||
| stop_strings: payload.stop.stop.as_ref().map(stop_strings), |
There was a problem hiding this comment.
stop_strings not read by the server, stops already go in stop_token_sequences.. remove it? or leave a comment why
There was a problem hiding this comment.
Removed it in 0789648. ATOM's server never reads sampling.stop_strings on Generate or on the Session: both build their SamplingParams with stop_strings=None and take the stops as stop_token_sequences (atom/entrypoints/grpc/server.py), as #3673's proto documents. Sending them as well only duplicated the stops on the wire. The request test now expects no stop_strings.
| TokenChunk::Complete { | ||
| finish_reason: finish_reason(&complete.finish_reason), | ||
| // ATOM's reason for a stop token is `stop_<token id>`. | ||
| matched_stop: complete |
There was a problem hiding this comment.
matched_stop only from stop_, stop-string hits stay None while sglang reports the string. document it or derive it from the decoder?
There was a problem hiding this comment.
Documented in 0789648, beside matched_stop in complete_chunk. ATOM's engine ends a stop-string hit with stop_sequence, which names no string, and the stop decoder's Stopped output carries none either, so there is nothing to derive it from. ATOM's HTTP routes report no matched_stop at all, so None matches them, as a vLLM worker's does.
…e atomesh client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g has no matched_stop ATOM's server reads the stops from stop_token_sequences on Generate and the Session and never reads sampling.stop_strings, so the client no longer sends them twice. A stop-string hit ends with `stop_sequence`, which names no string, so its matched_stop stays None, as ATOM's HTTP routes report none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| n: Some(sampling.n.max(0) as u32), | ||
| ..Default::default() | ||
| }), | ||
| stop_token_sequences: stop_token_sequences(stops, tokenizer)?, |
There was a problem hiding this comment.
stop_token_ids and return_logprob still not read here, so stop ids never reach stop_token_sequences and logprobs come back null. please wire both and add a test for each.
There was a problem hiding this comment.
Thanks for following up; both are decided by route, above request.rs.
stop_token_ids: left out on purpose. ATOM's HTTP routes have no such field, so wiring it would make gRPC differ.- logprobs: no longer null. 423f7c3 in [ATOM gRPC] atomesh: structured output to ATOM gRPC workers; answers as ATOM's HTTP routes give them #3677 answers 400
unsupported_logprobsto chat and/generate, tested per route.
Details in the line-41 thread.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
ci triage for 7ef98d8:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the atomesh client
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Default-build protobuf wiring and streaming cancellation/status behavior require exact-head Cargo and gRPC integration validation that could not be performed because project dependencies were unavailable.
No open issues 🎉
Review effort: Balanced
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tonic's client decodes at most 4 MiB a message, while ATOM's gRPC server sends with grpc's default, no limit. A GetModelInfo carrying a large chat template, or an unstreamed GenerateComplete with all of a long reply's ids, failed its call past it. The ATOM client now decodes messages of any size, matching what the server may send. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omesh client main moved the HTTP P/D router's idx2idx onto the planner's idx2idx (#3493) and added the standalone backend's SeqTiming (#3698). The idx2idx change goes into apply_atom_pd_rank_mapping_policy, which this branch moved to core/placement/backend/atom.rs; one SeqTiming remains, main's ttft, tpot and latency, which ATOM gRPC workers fill from their GenerateComplete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…down into the atomesh client
There was a problem hiding this comment.
🔵 Needs a closer look
The ATOM protocol-generation and streaming lifecycle changes need exact-head feature-matrix CI and end-to-end cancellation/refusal verification, with dependency-based builds and gRPC integration tests unavailable here.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Shared protobuf build changes and Rust/Python stream-cancellation behavior require human confirmation of exact-head feature-matrix and backend interoperability results that could not be independently verified here.
No open issues 🎉
Review effort: Balanced
…tomesh client Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The protobuf-generation and read-ahead gRPC changes require feature-matrix builds and real ATOM service validation of compatibility, refusal timing, and cancellation, which this dependency-free snapshot cannot provide.
No open issues 🎉
Review effort: Balanced
PlacementPlan gained prefill_tokens on main; the ATOM engine tests build their plans with 0, as main's gRPC engine tests do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-language proto generation, first-message HTTP status selection, and paired gRPC cancellation require human validation of the reported test runs because runtime verification was unavailable.
No open issues 🎉
Review effort: Balanced

Part D of the 8 PRs proposed in #3657 (regrouped by function). No blocking issues.
Based on C, the PR below it; it compiles B's proto and uses none of C's code.
Why
atomesh's gRPC router spoke only SGLang's and vLLM's protocols, its shipped binary compiled neither ATOM proto, and ATOM's P/D rank mapping was private to the HTTP P/D router.
What changed
apply_atom_pd_rank_mapping_policyandparse_atom_prefill_infomove fromPDRoutertocore/placement/backend/atom.rs, unchanged, so a gRPC P/D router picks the same ranks.grpc-clientfeature compiles engine_v1 and atom.grpc.v1 from the repository root (build.rs);Inbounddecodes ZMQ messages and gRPCFramesalike, andbuild_mesh.shcopies both protos beside the mesh.AtomClient(RuntimeType::Atom): a GenerateRequest carries stop strings andstop_token_idsas id sequences, the DP rank and the DP session headers; logprobs get 400; any reply size is read.indexorder with its timing. A refusal keeps ATOM's HTTP status; a drop cancels the call.AtomStreamand the P/D merger report aSourceClock: TTFT ande2e_latencycount from the start.Size: over 1,000 lines and 15 files: the client cannot build without the proto compile, and both carry the build scripts and CI paths they touch.
Review focus
extern_pathinbuild.rs.Testing
Against in-process ATOM stubs: the GenerateRequest, chunks and siblings in order, statuses, cancel on drop, TTFT and
e2e_latency, a 5 MiB reply.test_ci_latency_reports.pysees both protos copied.jasen/atom-grpc-d-mesh-client@ 2159bdb: lib and integration tests pass with and withoutatom-engine; the Python tests reaching the build scripts pass; fmt clean, no new clippy warning.Follow-ups
none
Stack
ATOM serves
atom.grpc.v1.AtomEnginebeside its HTTP server (token ids in, token ids out, ATOM's P/D flow unchanged), and atomesh routes to ATOM gRPC workers over a Generate call per request or one Session per instance. One linear stack, merged bottom to top: A, B, C, D, E, F, G, H; each PR's base is the one before it.Evidence
In
atom/mesh(rustc and clippy 1.100.0), at fbbe59a:cargo fmt --check,cargo clippy --all-targetswith and withoutatom-engine,cargo check --features ext-proc --testsandproto/vendor_ext_proc.py --checkpass.Clippy against main (warnings matched by message and file):
Python, on this branch: ruff and black clean on
tests/test_ci_latency_reports.py;tests/entrypointswith the test files reaching the changed modules,test_ci_latency_reports.pyamong them, 7,315 passed, the one failure the import timeout B's evidence describes.The two clippy warnings come from main's
atom_engine/wire.rs, which the default build now compiles; main shows them underatom-engine.🤖 Generated with Claude Code