Skip to content

[NIXL][XPU] Use np.uint64 for pointer/length arrays in disaggregation KV transfer#24188

Merged
mingfeima merged 1 commit into
sgl-project:mainfrom
Jianhong-Zhang:dtype
May 6, 2026
Merged

[NIXL][XPU] Use np.uint64 for pointer/length arrays in disaggregation KV transfer#24188
mingfeima merged 1 commit into
sgl-project:mainfrom
Jianhong-Zhang:dtype

Conversation

@Jianhong-Zhang
Copy link
Copy Markdown
Contributor

@Jianhong-Zhang Jianhong-Zhang commented Apr 30, 2026

Intel XPU device addr. pointers can exceed np.int64 range (bit 63 set), causing overflows and incorrect arithmetic when using numpy. This patch ensures all pointer and length arrays in the NIXL disaggregation backend are cast to np.uint64 up front, preventing overflow and dtype promotion issues during numpy operations. This is required for XPU safety and correctness, and does not affect device addr. at low bit set.

  • Cast src_data_ptrs, dst_data_ptrs, and item_lens to np.uint64 in _send_kvcache_generic
  • Ensures pointer arithmetic is safe for high-bit XPU addresses
  • Adds/clarifies comments explaining the rationale
  • Adds unit test for P/D disagg on XPU
  • Updates xpu.md for P/D disagg on XPU test steps

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Copy Markdown
Collaborator

@ShangmingCai ShangmingCai left a comment

Choose a reason for hiding this comment

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

Looks good.

cc: @ishandhanani

@mingfeima mingfeima added run-ci xpu intel gpu with device `torch.xpu` labels May 5, 2026
@mingfeima
Copy link
Copy Markdown
Collaborator

check ci first and then try to update test cases (on intel gpu devices).

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 5, 2026
@Jianhong-Zhang Jianhong-Zhang force-pushed the dtype branch 2 times, most recently from b6a1021 to 5587a3b Compare May 5, 2026 18:35
@Jianhong-Zhang
Copy link
Copy Markdown
Contributor Author

/tag-and-rerun-ci

Comment thread docs/platforms/xpu.md Outdated
[OpenAI Completions API](https://docs.sglang.io/basic_usage/openai_api_completions.html)
and sent via the command line (e.g. using `curl`) or via your own script.

## Prefill-Decode (P/D) Disaggregation on Intel XPU
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## Prefill-Decode (P/D) Disaggregation on Intel XPU
## [Experimental] Prefill-Decode (P/D) Disaggregation on Intel XPU

… KV transfer

Intel XPU device addr. pointers can exceed np.int64 range (bit 63 set), causing overflows and incorrect arithmetic when using numpy. This patch ensures all pointer and length arrays in the NIXL disaggregation backend are cast to np.uint64 up front, preventing overflow and dtype promotion issues during numpy operations. This is required for XPU safety and correctness, and does not affect device addr. at low bit set.

- Cast src_data_ptrs, dst_data_ptrs, and item_lens to np.uint64 in _send_kvcache_generic
- Ensures pointer arithmetic is safe for high-bit XPU addresses
- Adds/clarifies comments explaining the rationale
- Adds unit test for P/D disagg on XPU
- updates xpu.md for P/D disagg on XPU test steps
@mingfeima mingfeima merged commit c7019ff into sgl-project:main May 6, 2026
27 of 48 checks passed
LucQueen pushed a commit to LucQueen/sglang that referenced this pull request May 12, 2026
zijiexia added a commit to zijiexia/sglang that referenced this pull request Jun 4, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation run-ci xpu intel gpu with device `torch.xpu`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants