Repository navigation
feat(frontend): direct mode for stock SGLang gRPC engines - #99
ishandhanani wants to merge 3 commits into
Conversation
Live validation on H100 (SGLang 0.5.22)Host: try6767, stock Engine flags: Aggregated, two engines,
|
The frontend can now dial stock sglang.launch_server --grpc-port servers itself. probe(url) runs the sidecar's discovery RPCs and KV-event source discovery and produces what the sidecar would have registered: role, block size, context length, data-parallel ranks, bootstrap host and port, ZMQ sources. SglangDirectDispatch implements DirectBackend and StreamingDispatch with a lazily connected channel pool per instance. The stream body moves out of LLMEngine::generate into grpc_generate_stream so the sidecar and the direct dispatcher share one wire contract. The dispatcher sends Abort on cancellation itself, deferring the decode-leg abort until the first token so the bootstrap handoff completes. SGLang reports its own role, so the operator's prefill list must agree with it. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
python -m dynamo.frontend --direct --engine-url http://host:30001 ... probes the listed engines through DirectFleet and serves them with no sidecar and no discovery. --direct-backend names the engine family (sglang), --prefill-engine-url lists the prefill engines, and --dyn-tool-call-parser / --dyn-reasoning-parser override the parsers an engine reports, as the sidecar flags of the same name do. Model path, served name and KV block size default from the probe. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Three scenarios with the frontend dialing mocker gRPC servers directly: round-robin over two engines, KV routing from the engines' own ZMQ events (the fixture gains a KV-event port), and the prefill/decode handoff with the bootstrap rendezvous held open. Docs page for direct engines. Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
088f297 to
64c03ca
Compare
Stacked on #102 (direct-mode infrastructure). Only the last commits are this PR's. #100 (vLLM) stacks on this one.
Summary
python -m dynamo.frontend --direct --engine-url http://host:30001 ...routes to stocksglang.launch_server --grpc-portservers over their native gRPC API with no sidecar.dynamo-sglang-sidecar::direct:probe(url)runs the sidecar's discovery RPCs (GetModelInfo,GetServerInfo, KV-event source discovery) and produces what the sidecar would have registered (role, block size, context length, DP ranks, bootstrap host/port, ZMQ sources);SglangDirectDispatchimplementsDirectBackendandStreamingDispatchwith a lazy per-instance channel pool. The stream body moved out ofLLMEngine::generateintogrpc_generate_streamso both paths share one wire contract; the dispatcher variant sendsAborton cancellation, deferring the decode-leg abort until the first token so the bootstrap handoff completes.--prefill-engine-urlmust agree with what the engine says. Engines must run with--incremental-streaming-output, as with the sidecar.EngineType.Direct,--direct,--direct-backend sglang, repeatable--engine-urland--prefill-engine-url, and--dyn-tool-call-parser/--dyn-reasoning-parser(named after the sidecar flags; they override the engine-reported parsers). Model path, served name and KV block size default from the probe.docs/fern/pages/cli/model-deployment/direct-engines.md.Validation
cargo clippy -D warnings --testsclean ondynamo-sidecar-common,dynamo-sglang-sidecar,dynamo-sidecar-testkit; bindingscargo check;cargo fmt --check; pre-commit clean on the Python and docs files.dynamo-sglang-sidecar122 unit tests.lib/sidecar/testkit/tests/direct_mocker_integration.rs3/3 against the SGLang mocker: round-robin over two engines, KV routing from the engines' ZMQ events, prefill/decode handoff with the bootstrap rendezvous held open.test_frontend_direct_args.py6/6.Live on try6767 (SGLang 0.5.22, Qwen3-0.6B, 2x H100): aggregated KV routing with observed prefix overlap, and disaggregated prefill/decode with distinct worker ids per request, TTFT ~39 ms. Evidence in the comment below (recorded on the pre-split branch; the code is the same).