Skip to content

nixl pd support qwen3.5#1340

Merged
hiworldwzj merged 3 commits into
mainfrom
wzj_pd_qwen35
Jun 9, 2026
Merged

nixl pd support qwen3.5#1340
hiworldwzj merged 3 commits into
mainfrom
wzj_pd_qwen35

Conversation

@hiworldwzj

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for transferring linear attention states (convolution and SSM states) alongside KV cache pages in NIXL, specifically for Qwen3Next models. It introduces a page_kind parameter to differentiate between KV cache and linear attention states, updates the NIXL transfer task structures, and implements the necessary state copying logic in the Qwen3Next memory manager. Feedback from the review highlights a critical inconsistency where NIXLChunckedTransTaskRet.get_key() was not updated to match the new key format of NIXLChunckedTransTask, which would cause task matching failures. Additionally, the reviewer suggests adding type annotations to the newly added methods in qwen3next_mem_manager.py to align with the base class signature.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread lightllm/server/pd_io_struct.py Outdated
Comment on lines +326 to +327
def get_key(self) -> str:
return f"{self.request_id}_{self.start_kv_index}_{self.end_kv_index}"
return f"{self.request_id}_{self.req_idx}_{self.page_kind}_{self.start_kv_index}_{self.end_kv_index}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The get_key() method of NIXLChunckedTransTask has been updated to include req_idx and page_kind to uniquely identify tasks and prevent collisions. However, NIXLChunckedTransTaskRet.get_key() (defined around line 389) was not updated and still uses the old format f"{self.request_id}_{self.start_kv_index}_{self.end_kv_index}". This inconsistency will cause task matching to fail when using the returned task objects. Please update NIXLChunckedTransTaskRet to include req_idx and page_kind fields and update its get_key() method accordingly.

Comment on lines +77 to +86
def write_mem_to_page_kv_move_buffer(
self,
mem_indexes,
page_index: int,
dp_index: int,
mem_managers,
dp_world_size: int,
page_kind: str = "kv",
req_idx: int = None,
):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Add type annotations to mem_indexes and mem_managers to match the base class signature and improve type safety.

Suggested change
def write_mem_to_page_kv_move_buffer(
self,
mem_indexes,
page_index: int,
dp_index: int,
mem_managers,
dp_world_size: int,
page_kind: str = "kv",
req_idx: int = None,
):
def write_mem_to_page_kv_move_buffer(
self,
mem_indexes: List[int],
page_index: int,
dp_index: int,
mem_managers: List["MemoryManager"],
dp_world_size: int,
page_kind: str = "kv",
req_idx: int = None,
):

Comment on lines +104 to +113
def read_page_kv_move_buffer_to_mem(
self,
mem_indexes,
page_index: int,
dp_index: int,
mem_managers,
dp_world_size: int,
page_kind: str = "kv",
req_idx: int = None,
):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Add type annotations to mem_indexes and mem_managers to match the base class signature and improve type safety.

Suggested change
def read_page_kv_move_buffer_to_mem(
self,
mem_indexes,
page_index: int,
dp_index: int,
mem_managers,
dp_world_size: int,
page_kind: str = "kv",
req_idx: int = None,
):
def read_page_kv_move_buffer_to_mem(
self,
mem_indexes: List[int],
page_index: int,
dp_index: int,
mem_managers: List["MemoryManager"],
dp_world_size: int,
page_kind: str = "kv",
req_idx: int = None,
):

@hiworldwzj hiworldwzj merged commit 78e34a7 into main Jun 9, 2026
1 check passed
@hiworldwzj hiworldwzj deleted the wzj_pd_qwen35 branch June 9, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant