#40025·sglang

[Bug] EAGLE draft-extend plan stream lacks an input-producer dependency

Author: mesalehCreated Sep 17, 2026Updated Sep 17, 2026

Summary

With SGLANG_ENABLE_OVERLAP_PLAN_STREAM=1, EAGLE draft-extend preparation can consume compute-stream outputs on the plan stream without a producer-to-consumer dependency.

Checked against public main at 6c73368c329f811472829927d7185f189e3c8ff3.

Affected paths

  1. EagleDraftWorker._draft_extend_for_decode in python/sglang/srt/speculative/eagle_worker_v2.py casts next_token_ids to int64 on the current stream, then calls prepare_for_draft_extend inside plan_stream_ctx without first ordering the plan stream after that producer. Moving the cast outside the context does not itself establish the dependency.
  2. MultiLayerEagleDraftWorker._draft_extend_for_decode in python/sglang/srt/speculative/multi_layer_eagle_worker_v2.py waits on a boundary-KV event only when boundary locations exist. Zero-front and idle paths can have no event, leaving preparation without the corresponding producer wait.

Both methods join the plan stream back into the compute stream afterward. That join protects the later forward, but cannot retroactively order inputs consumed by preparation.

Expected behavior

Before metadata preparation, the plan stream should wait for the current producer stream, or an event recorded after the relevant writes. Preserve the existing boundary-event path where present, and leave the default plan-stream-disabled path unchanged.

Reproduction and evidence limits

A CPU regression test executes each actual method's preparation prefix with stream/dependency stand-ins, without constructing a model. At the checked upstream ref, it fails the single-layer enabled case and the two multi-layer no-boundary cases (staged and non-staged). The existing boundary-event and disabled cases pass. Adding the missing waits makes all seven cases pass.

This establishes the missing dependency in the source path; it is not an end-to-end GPU crash reproducer or a claim that every execution races. GPU correctness and performance validation remain needed on the public patch.

Related work

#28034 discusses the broader spec-v2 ordering problem. This report isolates the current draft-extend paths, including the multi-layer no-boundary case. #37980 addresses the separate draft/tree-to-verify handoff. I will link a small draft-extend-only patch and regression test here.