Skip to content

[Bugfix][XPU] Fix Mamba state pointer overflow - #48109

Merged
jikunshang merged 2 commits into
vllm-project:mainfrom
Oxygen56:fix/xpu-mamba-state-ptr-overflow
Aug 19, 2026
Merged

jikunshang merged 2 commits into
vllm-project:mainfrom
Oxygen56:fix/xpu-mamba-state-ptr-overflow

Conversation

@Oxygen56

@Oxygen56 Oxygen56 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #48059

Purpose

XPU USM device pointers can exceed the positive signed int64 range. The Mamba
align-mode fused copy path stores state tensor and block-table data_ptr()
values in torch.int64 metadata buffers before passing them to Triton kernels,
so assigning a high-bit XPU pointer directly can raise:

ValueError: Overflow when unpacking long long

This preserves the 64-bit pointer pattern by reinterpreting unsigned pointer
values as signed int64 before storing them in the existing metadata buffers. The
Triton kernel ABI stays unchanged.

Duplicate-work check: no open PR currently references #48059 or matches the
state_base_addrs / overflow keywords.

Test Plan

  • pre-commit run ruff-format --files vllm/v1/worker/mamba_utils.py tests/v1/worker/test_mamba_utils.py
  • pre-commit run ruff-check --files vllm/v1/worker/mamba_utils.py tests/v1/worker/test_mamba_utils.py
  • python -m pytest tests/v1/worker/test_mamba_utils.py -q

Test Result

  • ruff-format passed
  • ruff-check passed
  • tests/v1/worker/test_mamba_utils.py: 3 passed, 17 skipped

I could not run the full XPU serving repro locally because this environment does
not have the reported Intel Arc/XPU setup and hybrid checkpoint.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@Oxygen56
Oxygen56 requested a review from njhill as a code owner July 9, 2026 09:26

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added intel-gpu Related to Intel GPU v1 bug Something isn't working labels Jul 9, 2026
@Hexide

Hexide commented Jul 25, 2026

Copy link
Copy Markdown

I had ValueError: Overflow when unpacking long long error on first prompt when MTP was enabled on XPU.
This changes in this merge request fixed issue for me.

Before

(APIServer pid=1) INFO:     Started server process [1[]
(APIServer pid=1) INFO:     Waiting for application startup.
(APIServer pid=1) INFO:     Application startup complete.
(APIServer pid=1) INFO:     10.0.0.79:36350 - "GET /v1/models HTTP/1.1" 200 OK
(APIServer pid=1) INFO:     10.0.0.79:35448 - "GET /v1/models HTTP/1.1" 200 OK
(APIServer pid=1) INFO:     10.0.0.79:35452 - "POST /v1/chat/completions HTTP/1.1" 200 OK
(Worker_TP0 pid=783) WARNING 07-25 17:50:30 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: _compute_slot_mapping_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     output = func(*args, **kwargs)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]              ^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     return func(*args, **kwargs)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]            ^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/gpu_worker.py", line 1083, in sample_tokens
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     return self.model_runner.sample_tokens(grammar_output)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     return func(*args, **kwargs)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]            ^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/gpu_model_runner.py", line 4535, in sample_tokens
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     self._update_states_after_model_execute(
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/gpu_model_runner.py", line 1570, in _update_states_after_model_execute
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     mamba_utils.postprocess_mamba_align_gpu(
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/mamba_utils.py", line 1131, in postprocess_mamba_align_gpu
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     ctx.initialize_from_forward_context(
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/mamba_utils.py", line 649, in initialize_from_forward_context
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     self.state_base_addrs[idx[] = state.data_ptr()
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     ~~~~~~~~~~~~~~~~~~~~~^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[] ValueError: Overflow when unpacking long long
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[] Traceback (most recent call last):
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/executor/multiproc_executor.py", line 999, in worker_busy_loop
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     output = func(*args, **kwargs)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]              ^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     return func(*args, **kwargs)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]            ^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/gpu_worker.py", line 1083, in sample_tokens
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     return self.model_runner.sample_tokens(grammar_output)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     return func(*args, **kwargs)
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]            ^^^^^^^^^^^^^^^^^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/gpu_model_runner.py", line 4535, in sample_tokens
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     self._update_states_after_model_execute(
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/gpu_model_runner.py", line 1570, in _update_states_after_model_execute
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     mamba_utils.postprocess_mamba_align_gpu(
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/mamba_utils.py", line 1131, in postprocess_mamba_align_gpu
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     ctx.initialize_from_forward_context(
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]   File "/opt/venv/lib/python3.12/site-packages/vllm/v1/worker/mamba_utils.py", line 649, in initialize_from_forward_context
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     self.state_base_addrs[idx[] = state.data_ptr()
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[]     ~~~~~~~~~~~~~~~~~~~~~^^^^^
(Worker_TP0 pid=783) ERROR 07-25 17:50:33 [multiproc_executor.py:1007[] ValueError: Overflow when unpacking long long

After:

(APIServer pid=1) INFO:     Started server process [1[]
(APIServer pid=1) INFO:     Waiting for application startup.
(APIServer pid=1) INFO:     Application startup complete.
(APIServer pid=1) INFO:     10.0.0.79:47226 - "GET /v1/models HTTP/1.1" 200 OK
(APIServer pid=1) INFO:     10.0.0.79:47226 - "POST /v1/chat/completions HTTP/1.1" 200 OK
(Worker_TP0 pid=783) WARNING 07-25 18:34:56 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: _compute_slot_mapping_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(Worker_TP0 pid=783) WARNING 07-25 18:35:00 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: postprocess_mamba_fused_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(Worker_TP0 pid=783) WARNING 07-25 18:35:03 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: eagle_prepare_next_token_padded_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(Worker_TP0 pid=783) WARNING 07-25 18:35:06 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: eagle_step_slot_mapping_metadata_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(Worker_TP0 pid=783) WARNING 07-25 18:35:10 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: fused_moe_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(Worker_TP0 pid=783) WARNING 07-25 18:35:16 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: batch_memcpy_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(APIServer pid=1) INFO:     10.0.0.79:52838 - "GET /v1/models HTTP/1.1" 200 OK
(Worker_TP0 pid=783) WARNING 07-25 18:35:26 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: expand_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(Worker_TP0 pid=783) WARNING 07-25 18:35:29 [jit_monitor.py:135[] Triton kernel JIT compilation during inference: eagle_prepare_inputs_padded_kernel. This causes a latency spike; consider extending warmup to cover this shape/config.
(APIServer pid=1) INFO 07-25 18:35:34 [loggers.py:310[] Engine 000: Avg prompt throughput: 247.9 tokens/s, Avg generation throughput: 0.8 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 1.9%, Prefix cache hit rate: 0.0%

@mayuyuace

Copy link
Copy Markdown
Contributor

@jikunshang

@jikunshang jikunshang added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 28, 2026
@urakozz

urakozz commented Jul 28, 2026

Copy link
Copy Markdown

And now there is a conflict with freshly merged #48110 😐

@jikunshang jikunshang removed the ready ONLY add when PR is ready to merge/full CI is needed label Jul 29, 2026
@mayuyuace

Copy link
Copy Markdown
Contributor

@Oxygen56
Can you rebase your branch?

@Oxygen56

Oxygen56 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main.

@jikunshang

Copy link
Copy Markdown
Member

/ci run

@jikunshang jikunshang added the verified Run pre-commit for new contributors without triggering other tests label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #82608 for commit 5133492ec356.

@jikunshang

Copy link
Copy Markdown
Member

/ci retry

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

✅ Queued 1 failed job(s) for retry in Buildkite CI #82608.

@mergify

mergify Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @Oxygen56.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Aug 17, 2026
Signed-off-by: Oxygen56 <jiangth99@163.com>
Signed-off-by: Oxygen56 <jiangth99@163.com>
@Oxygen56
Oxygen56 force-pushed the fix/xpu-mamba-state-ptr-overflow branch from 5133492 to 8d88c60 Compare August 17, 2026 09:59
@mergify mergify Bot removed the needs-rebase label Aug 17, 2026
@mayuyuace

Copy link
Copy Markdown
Contributor

/ci run

@github-actions

Copy link
Copy Markdown

@mayuyuace, Only reviewers with write access can use CI commands before CI is delegated to the PR author.

@mayuyuace

Copy link
Copy Markdown
Contributor

/ci run

@github-actions

Copy link
Copy Markdown

@mayuyuace, Only reviewers with write access can use CI commands before CI is delegated to the PR author.

@jikunshang

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #84369 for commit 8d88c60b8085.

@jikunshang
jikunshang merged commit f936a26 into vllm-project:main Aug 19, 2026
88 checks passed
wenhuach21 pushed a commit to wenhuach21/vllm that referenced this pull request Aug 19, 2026
Signed-off-by: Oxygen56 <jiangth99@163.com>
Signed-off-by: Wenhua Cheng <wenhua.cheng@intel.com>
zyp2014 pushed a commit to zyp2014/vllm that referenced this pull request Aug 21, 2026
Signed-off-by: Oxygen56 <jiangth99@163.com>
wyettzeng pushed a commit to wyettzeng/vllm that referenced this pull request Aug 21, 2026
Signed-off-by: Oxygen56 <jiangth99@163.com>
Signed-off-by: Wyett <wyettzeng@gmail.com>
zufangzhu pushed a commit to zufangzhu/vllm that referenced this pull request Aug 24, 2026
Signed-off-by: Oxygen56 <jiangth99@163.com>
Signed-off-by: Zhu, Zufang <zufang.zhu@intel.com>
khushali9 pushed a commit to khushali9/vllm that referenced this pull request Aug 29, 2026
Signed-off-by: Oxygen56 <jiangth99@163.com>
Signed-off-by: khushali9 <khushali.desai9@gmail.com>
am-cohere pushed a commit to am-cohere/vllm that referenced this pull request Sep 1, 2026
Signed-off-by: Oxygen56 <jiangth99@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working intel-gpu Related to Intel GPU v1 verified Run pre-commit for new contributors without triggering other tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][XPU] Mamba align-mode prefix caching crashes: "Overflow when unpacking long long" storing state.data_ptr()

5 participants