[Spec] Anchor GLM-5.2 MTP IndexShare topk on the draft-extend step (#29787)

Co-authored-by: kpham-sgl <264503018+kpham-sgl@users.noreply.github.com>
Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khoa Pham
2026-07-06 20:36:48 -07:00
committed by GitHub
co-authored by kpham-sgl Xinyuan Tong Xinyuan Tong Claude Fable 5
parent 4145e595cf
commit 16372b4c5f
12 changed files with 185 additions and 31 deletions
@@ -20,6 +20,7 @@ from sglang.srt.speculative.eagle_draft_extend_cuda_graph_runner import (
EAGLEDraftExtendCudaGraphRunner,
)
from sglang.srt.speculative.eagle_info import EagleDraftExtendInput
from sglang.srt.speculative.eagle_worker_v2 import EagleDraftWorker
from sglang.srt.speculative.spec_info import SpeculativeAlgorithm
from sglang.srt.speculative.spec_utils import fast_topk
@@ -496,6 +497,7 @@ class _EagleDraftExtendV2WorkerHarness:
self.eagle_use_aux_hidden_state = False
self.hot_token_id = None
self.draft_runner.model = model_forward
EagleDraftWorker._init_dsa_index_share_state(self)
def _build_eagle_draft_extend_fixture(
@@ -188,15 +188,7 @@ class _EagleDraftWorkerHarness:
self._topk1_parents_prealloc = None
self._topk1_score_indices_prealloc = None
EagleDraftWorker._rebuild_topk1_chain_buffers(self)
# draft_forward reads this (set in EagleDraftWorker.__init__, skipped here).
self.index_share_for_mtp_iteration = (
getattr(
self.model_config.hf_config,
"index_share_for_mtp_iteration",
False,
)
and self.topk == 1
)
EagleDraftWorker._init_dsa_index_share_state(self)
@property
def draft_model_runner(self):