Skip to content

fix(rollout): reject shared prefill with continuous batching - #8583

Merged
delock merged 1 commit into
deepspeedai:masterfrom
modelpath-dev:fix/8458-reject-shared-prefill-continuous
Sep 27, 2026
Merged

delock merged 1 commit into
deepspeedai:masterfrom
modelpath-dev:fix/8458-reject-shared-prefill-continuous

Conversation

@modelpath-dev

@modelpath-dev modelpath-dev commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

HybridEngineRollout.generate selects the continuous path whenever SamplingConfig.continuous_batch_size is set, before any shared-prefill logic runs. With HybridEngineRolloutConfig.use_shared_prefill=True, that flag was therefore ignored with no error. This PR rejects the combination explicitly, matching the approach already taken for CUDA graph capture on the continuous path.

Fixes #8458.

Scope

  • HybridEngineRollout._validate_continuous_inputs: raise ValueError when use_shared_prefill is enabled.
  • docs/code-docs/source/inference-engine.rst: document that shared prefill and continuous batching cannot be combined.

Out of scope: implementing shared-prefill semantics inside continuous batching.

Tradeoffs

Rejection over a compatible shared-prefill continuous mode. Continuous batching already requires n_samples_per_prompt=1, so shared prefill has no clear benefit there today.

Blast Radius

Only the experimental continuous path changes, and only when shared prefill is also requested. Default generate() and shared-prefill-only configs are unchanged.

Verification

Before the fix, _validate_continuous_inputs accepted use_shared_prefill=True with continuous_batch_size=1 (silent ignore). After the fix it raises ValueError: continuous batching does not support shared prompt prefill.

TRANSFORMERS_NO_TF=1 PYTHONPATH=. python3 -m pytest tests/unit/runtime/rollout/test_hybrid_engine_rollout.py -q
# 32 passed, 1 skipped

@delock

delock commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Hi @modelpath-dev can you fix the DCO failure? Thanks!

rollout.generate(request, SamplingConfig(max_new_tokens=2, temperature=0.5, continuous_batch_size=1))


def test_continuous_generation_rejects_shared_prefill():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need a test here. If there is behavior change, then this test will need change again, which is not desired.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, removed the test.

Raise ValueError when HybridEngineRolloutConfig.use_shared_prefill is set
together with SamplingConfig.continuous_batch_size, instead of selecting
the continuous path and silently ignoring shared prefill. Document the
incompatibility in the inference-engine notes.

Fixes deepspeedai#8458.

Signed-off-by: Chandan Kumar <cml.codes@gmail.com>
@modelpath-dev
modelpath-dev force-pushed the fix/8458-reject-shared-prefill-continuous branch from 3b55a84 to 703abaa Compare September 26, 2026 11:28
@modelpath-dev

Copy link
Copy Markdown
Contributor Author

@delock Fixed the DCO check. The PR is now one signed-off commit on top of master, and the test is removed as you suggested.

@delock
delock enabled auto-merge September 27, 2026 04:05
@delock
delock added this pull request to the merge queue Sep 27, 2026
Merged via the queue into deepspeedai:master with commit aa49eaa Sep 27, 2026
13 checks passed
@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Do not silently ignore use_shared_prefill with continuous batching

2 participants