2929from vllm .models .deepseek_v4 .common .ops .fused_indexer_q import MXFP4_BLOCK_SIZE
3030
3131if TYPE_CHECKING :
32- from vllm .models .deepseek_v4 .eager_scratch import DeepseekV4EagerScratchPool
3332 from vllm .v1 .attention .backends .mla .sparse_swa import (
3433 DeepseekSparseSWAMetadata ,
3534 )
@@ -185,7 +184,6 @@ def __init__(
185184 prefix : str ,
186185 topk_indices_buffer : torch .Tensor | None = None ,
187186 aux_stream_list : list [torch .cuda .Stream ] | None = None ,
188- eager_scratch_pool : "DeepseekV4EagerScratchPool | None" = None ,
189187 ) -> None :
190188 super ().__init__ ()
191189 config = vllm_config .model_config .hf_config
@@ -274,7 +272,6 @@ def __init__(
274272 )
275273 self .indexer_rotary_emb = self .rotary_emb
276274 self .topk_indices_buffer = topk_indices_buffer
277- self .eager_scratch_pool = eager_scratch_pool
278275
279276 self .indexer = None
280277 if self .compress_ratio == 4 :
@@ -296,7 +293,6 @@ def __init__(
296293 compress_ratio = self .compress_ratio ,
297294 prefix = f"{ prefix } .indexer" ,
298295 aux_stream = indexer_aux_stream ,
299- eager_scratch_pool = eager_scratch_pool ,
300296 )
301297
302298 self ._prepare_and_attn_fn = self ._prepare_and_attn
@@ -355,7 +351,6 @@ def __init__(
355351 rotate = True ,
356352 prefix = f"{ prefix } .compressor" ,
357353 k_cache_prefix = self .prefix ,
358- eager_scratch_pool = eager_scratch_pool ,
359354 )
360355
361356 def forward (
@@ -637,24 +632,10 @@ def _fused_qnorm_rope_kv_insert(
637632 if cache_dtype == torch .uint8 :
638633 # fp8_ds_mla UE8M0 paged path. Horizontally fused:
639634 # Q side: per-head RMSNorm (no weight) + GPT-J RoPE, zero-filling
640- # the padding head slots.
635+ # the padding head slots; the kernel allocates and returns
636+ # the padded q tensor.
641637 # KV side: GPT-J RoPE + UE8M0 FP8 quant + paged cache insert.
642638 swa_kv_cache_2d = swa_kv_cache .view (swa_kv_cache .shape [0 ], - 1 )
643- if self .eager_scratch_pool is not None :
644- q_out = self .eager_scratch_pool .q_out (q .shape [0 ])
645- torch .ops ._C .fused_deepseek_v4_qnorm_rope_kv_rope_quant_insert_out (
646- q ,
647- kv ,
648- q_out ,
649- swa_kv_cache_2d ,
650- swa_metadata .slot_mapping ,
651- positions ,
652- cos_sin_cache ,
653- self .padded_heads ,
654- self .eps ,
655- swa_metadata .block_size ,
656- )
657- return q_out
658639 return torch .ops ._C .fused_deepseek_v4_qnorm_rope_kv_rope_quant_insert (
659640 q ,
660641 kv ,
@@ -703,13 +684,6 @@ def _fused_qnorm_rope_kv_insert(
703684 )
704685 return q_fp8
705686
706- def _global_topk_output_buffers (
707- self , topk_indices : torch .Tensor
708- ) -> tuple [torch .Tensor , torch .Tensor ] | None :
709- if self .compress_ratio != 4 or self .eager_scratch_pool is None :
710- return None
711- return self .eager_scratch_pool .global_topk_outputs (topk_indices )
712-
713687 def get_attn_backend (self ) -> type [AttentionBackend ]:
714688 return self .backend_cls
715689
@@ -792,7 +766,6 @@ def __init__(
792766 compress_ratio : int = 1 ,
793767 prefix : str = "" ,
794768 aux_stream : torch .cuda .Stream | None = None ,
795- eager_scratch_pool : "DeepseekV4EagerScratchPool | None" = None ,
796769 ):
797770 super ().__init__ ()
798771 self .vllm_config = vllm_config
@@ -805,7 +778,6 @@ def __init__(
805778 self .rope_dim = config .qk_rope_head_dim # 64
806779 self .q_lora_rank = q_lora_rank # 1536
807780 self .compress_ratio = compress_ratio
808- self .eager_scratch_pool = eager_scratch_pool
809781 self .use_fp4_kv = dsa_indexer_uses_fp4 (vllm_config )
810782 logger .info_once (
811783 "Using %s indexer cache for Lightning Indexer." ,
@@ -869,7 +841,6 @@ def __init__(
869841 prefix = f"{ prefix } .compressor" ,
870842 k_cache_prefix = self .k_cache .prefix ,
871843 use_fp4_cache = self .use_fp4_kv ,
872- eager_scratch_pool = eager_scratch_pool ,
873844 )
874845
875846 self .indexer_op = SparseAttnIndexer (
@@ -933,9 +904,6 @@ def wq_b_and_q_quant():
933904 # ReplicatedLinear returns (output, bias); bias is None.
934905 q , _ = self .wq_b (qr )
935906 q = q .view (- 1 , self .n_head , self .head_dim )
936- outputs = None
937- if self .eager_scratch_pool is not None and self .use_fp4_kv :
938- outputs = self .eager_scratch_pool .indexer_q_outputs (q .shape [0 ])
939907 return fused_indexer_q_rope_quant (
940908 positions ,
941909 q ,
@@ -944,7 +912,6 @@ def wq_b_and_q_quant():
944912 self .softmax_scale ,
945913 self .n_head ** - 0.5 ,
946914 use_fp4 = self .use_fp4_kv ,
947- output_buffers = outputs ,
948915 )
949916
950917 # compressor returns None and writes K to the indexer KV cache; the
0 commit comments