From ed8d127677484b699b8ab672f0e9c41cf7f2c19d Mon Sep 17 00:00:00 2001 From: lilinsiman Date: Mon, 23 Mar 2026 15:42:02 +0800 Subject: [PATCH 1/3] [eagle3][pcp] fix acceptance rate for eagle3 and pcp enabled Signed-off-by: lilinsiman --- vllm_ascend/spec_decode/eagle_proposer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vllm_ascend/spec_decode/eagle_proposer.py b/vllm_ascend/spec_decode/eagle_proposer.py index 12bcd8a5df2a..d471130a5c40 100644 --- a/vllm_ascend/spec_decode/eagle_proposer.py +++ b/vllm_ascend/spec_decode/eagle_proposer.py @@ -577,6 +577,7 @@ def _propose( # Copy the old attn_metadata and update attn_metadata_i = per_layer_attn_metadata[self.attn_layer_names[0]] + common_attn_metadata.block_table_tensor = common_attn_metadata.block_table_tensor.clone() if self.pcp_size * self.dcp_size > 1: if self.num_speculative_tokens > 1 and not attn_metadata_i.num_prefills: # For pcp/dcp, tokens are split across different cp ranks, @@ -1144,7 +1145,10 @@ def attn_update_stack_num_spec_norm( common_attn_metadata.num_input_tokens = input_batch_size # The loop part - + common_attn_metadata.seq_lens = common_attn_metadata.seq_lens.clone() + common_attn_metadata.seq_lens_cpu = common_attn_metadata.seq_lens_cpu.clone() + common_attn_metadata.num_computed_tokens_cpu = common_attn_metadata.num_computed_tokens_cpu.clone() + common_attn_metadata.positions = common_attn_metadata.positions.clone() used_update_positions += 1 # NOTE(woosuk): We should handle the case where the draft model From cf3bb78383bfbfe60e4f8ca51582b8b4b3ebd447 Mon Sep 17 00:00:00 2001 From: lilinsiman Date: Mon, 23 Mar 2026 17:41:31 +0800 Subject: [PATCH 2/3] add note Signed-off-by: lilinsiman --- vllm_ascend/spec_decode/eagle_proposer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vllm_ascend/spec_decode/eagle_proposer.py b/vllm_ascend/spec_decode/eagle_proposer.py index d471130a5c40..878b3d05243c 100644 --- a/vllm_ascend/spec_decode/eagle_proposer.py +++ b/vllm_ascend/spec_decode/eagle_proposer.py @@ -577,7 +577,11 @@ def _propose( # Copy the old attn_metadata and update attn_metadata_i = per_layer_attn_metadata[self.attn_layer_names[0]] + + # Clone the data so that when calculating the data at position 2 and position 3 + # in the merged graph, it does not affect position 1 common_attn_metadata.block_table_tensor = common_attn_metadata.block_table_tensor.clone() + if self.pcp_size * self.dcp_size > 1: if self.num_speculative_tokens > 1 and not attn_metadata_i.num_prefills: # For pcp/dcp, tokens are split across different cp ranks, @@ -1145,11 +1149,14 @@ def attn_update_stack_num_spec_norm( common_attn_metadata.num_input_tokens = input_batch_size # The loop part + used_update_positions += 1 + + # Clone the data so that when calculating the data at position 2 and position 3 + # in the merged graph, it does not affect position 1 common_attn_metadata.seq_lens = common_attn_metadata.seq_lens.clone() common_attn_metadata.seq_lens_cpu = common_attn_metadata.seq_lens_cpu.clone() common_attn_metadata.num_computed_tokens_cpu = common_attn_metadata.num_computed_tokens_cpu.clone() common_attn_metadata.positions = common_attn_metadata.positions.clone() - used_update_positions += 1 # NOTE(woosuk): We should handle the case where the draft model # generates tokens beyond the max model length. Since it is complex From d1afb974c6cdfd7aac45acb61ef8aa4048abeb1e Mon Sep 17 00:00:00 2001 From: lilinsiman Date: Tue, 24 Mar 2026 17:01:17 +0800 Subject: [PATCH 3/3] add fix me Signed-off-by: lilinsiman --- vllm_ascend/spec_decode/eagle_proposer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vllm_ascend/spec_decode/eagle_proposer.py b/vllm_ascend/spec_decode/eagle_proposer.py index 878b3d05243c..f86d75cd1d2b 100644 --- a/vllm_ascend/spec_decode/eagle_proposer.py +++ b/vllm_ascend/spec_decode/eagle_proposer.py @@ -580,6 +580,7 @@ def _propose( # Clone the data so that when calculating the data at position 2 and position 3 # in the merged graph, it does not affect position 1 + # FIXME(lilinsiman) common_attn_metadata.block_table_tensor = common_attn_metadata.block_table_tensor.clone() if self.pcp_size * self.dcp_size > 1: @@ -1153,6 +1154,7 @@ def attn_update_stack_num_spec_norm( # Clone the data so that when calculating the data at position 2 and position 3 # in the merged graph, it does not affect position 1 + # FIXME(lilinsiman) common_attn_metadata.seq_lens = common_attn_metadata.seq_lens.clone() common_attn_metadata.seq_lens_cpu = common_attn_metadata.seq_lens_cpu.clone() common_attn_metadata.num_computed_tokens_cpu = common_attn_metadata.num_computed_tokens_cpu.clone()