[DSV4] Remove per-step seqlen D2H from speculative to make overlap scheduler work (#30365)
Co-authored-by: weireweire <20922698+weireweire@users.noreply.github.com>
This commit is contained in:
@@ -1490,6 +1490,7 @@ def run_dsv4_target_verify_attention_case(
|
||||
fixture = build_dsv4_attention_fixture(testcase, case, dtype=dtype, device=device)
|
||||
runner = fixture.runner
|
||||
max_context_len = runner.req_to_token_pool.req_to_token.shape[1]
|
||||
testcase.assertEqual(fixture.backend.max_context_len, max_context_len)
|
||||
|
||||
_populate_swa_kv_cache(fixture, max_context_len=max_context_len, device=device)
|
||||
if case.compress_ratio in (4, 128):
|
||||
@@ -1530,6 +1531,7 @@ def run_dsv4_draft_extend_attention_case(
|
||||
*,
|
||||
dtype: torch.dtype = torch.bfloat16,
|
||||
device: str = "cuda",
|
||||
force_gpu_only_seq_lens: bool = False,
|
||||
) -> None:
|
||||
"""Math-faithful EAGLE `DRAFT_EXTEND` test for DSV4.
|
||||
|
||||
@@ -1567,6 +1569,10 @@ def run_dsv4_draft_extend_attention_case(
|
||||
fixture.forward_batch,
|
||||
device=device,
|
||||
)
|
||||
if force_gpu_only_seq_lens:
|
||||
fixture.forward_batch.seq_lens_cpu = None
|
||||
fixture.forward_batch.seq_lens_sum = None
|
||||
fixture.forward_batch.spec_info.seq_lens_cpu = None
|
||||
|
||||
q_input, _ = fixture.actual_module.project(fixture.input_hidden)
|
||||
with torch.no_grad(), forward_context(ForwardContext(attn_backend=fixture.backend)):
|
||||
|
||||
+10
-1
@@ -1484,6 +1484,7 @@ def run_dsv4_eagle_draft_cuda_graph_runner_case(
|
||||
vocab_size: int = 64,
|
||||
dtype: torch.dtype = torch.bfloat16,
|
||||
device: str = "cuda",
|
||||
force_gpu_only_seq_lens: bool = False,
|
||||
):
|
||||
settings = EagleDraftRunnerSettings(
|
||||
topk=topk,
|
||||
@@ -1498,12 +1499,20 @@ def run_dsv4_eagle_draft_cuda_graph_runner_case(
|
||||
atol=DSV4_ATOL,
|
||||
rtol=DSV4_RTOL,
|
||||
)
|
||||
|
||||
def _make_forward_batch(case, draft_inputs, settings):
|
||||
batch = _make_dsv4_eagle_draft_forward_batch(case, draft_inputs, settings)
|
||||
if force_gpu_only_seq_lens:
|
||||
batch.seq_lens_cpu = None
|
||||
batch.seq_lens_sum = None
|
||||
return batch
|
||||
|
||||
adapter = EagleDraftCudaGraphRunnerAdapter(
|
||||
build_fixture=build_dsv4_attention_fixture,
|
||||
make_model_forward=_make_dsv4_model_forward,
|
||||
make_draft_inputs=_make_dsv4_draft_inputs,
|
||||
prepare_replay_state=_prepare_dsv4_draft_replay_state,
|
||||
make_forward_batch=_make_dsv4_eagle_draft_forward_batch,
|
||||
make_forward_batch=_make_forward_batch,
|
||||
check_case=_check_dsv4_draft_cache_layout,
|
||||
init_eager_metadata=_init_dsv4_eager_metadata,
|
||||
)
|
||||
|
||||
+6
@@ -890,6 +890,7 @@ def run_dsv4_eagle_verify_cuda_graph_case(
|
||||
dtype: torch.dtype = torch.bfloat16,
|
||||
device: str = "cuda",
|
||||
cuda_graph_capture_batch_size: int = 2,
|
||||
force_gpu_only_seq_lens: bool = False,
|
||||
):
|
||||
"""DSV4 EAGLE target_verify CUDA-graph capture/replay. Chain only —
|
||||
`DeepseekV4AttnBackend.__init__` asserts `self.topk in [0, 1]` at
|
||||
@@ -936,6 +937,11 @@ def run_dsv4_eagle_verify_cuda_graph_case(
|
||||
batch.spec_info = _make_eagle_verify_input(
|
||||
spec_case, batch, topk=topk, device=device
|
||||
)
|
||||
if force_gpu_only_seq_lens:
|
||||
batch.seq_lens_cpu = None
|
||||
batch.seq_lens_sum = None
|
||||
batch.spec_info.seq_lens_cpu = None
|
||||
batch.spec_info.seq_lens_sum = None
|
||||
|
||||
def _make_capture_case(base, name, capture_prefix_len: int, bs: int):
|
||||
# Capture uses uniform prefixes per request; each request still
|
||||
|
||||
Reference in New Issue
Block a user