Skip to content

[Bug]:MooncakeStoreConnector with IndexError('Dimension out of range (expected to be in range of [-2, 1], but got 2)') ,because the new cache_kernels.cu changed. #19683

@67lc

Description

@67lc

Your current environment

The output of python collect_env.py
INFO 06-16 12:05:17 [__init__.py:244] Automatically detected platform cuda.
Collecting environment information...
==============================
        System Info
==============================
OS                           : Ubuntu 22.04.4 LTS (x86_64)
GCC version                  : (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version                : Could not collect
CMake version                : version 3.22.1
Libc version                 : glibc-2.35

==============================
       PyTorch Info
==============================
PyTorch version              : 2.7.0+cu126
Is debug build               : False
CUDA used to build PyTorch   : 12.6
ROCM used to build PyTorch   : N/A

==============================
      Python Environment
==============================
Python version               : 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform              : Linux-6.8.0-60-generic-x86_64-with-glibc2.35

==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.4.131
CUDA_MODULE_LOADING set to   : LAZY
GPU models and configuration :
GPU 0: Tesla V100-SXM2-16GB
GPU 1: Tesla V100-SXM2-16GB
GPU 2: Tesla V100-SXM2-16GB
GPU 3: Tesla V100-SXM2-16GB
GPU 4: Tesla V100-SXM2-16GB
GPU 5: Tesla V100-SXM2-16GB
GPU 6: Tesla V100-SXM2-16GB
GPU 7: Tesla V100-SXM2-16GB

Nvidia driver version        : 570.133.20
cuDNN version                : Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.2
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.2
HIP runtime version          : N/A
MIOpen runtime version       : N/A
Is XNNPACK available         : True

==============================
          CPU Info
==============================
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        43 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               64
On-line CPU(s) list:                  0-63
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 7532 32-Core Processor
CPU family:                           23
Model:                                49
Thread(s) per core:                   2
Core(s) per socket:                   32
Socket(s):                            1
Stepping:                             0
Frequency boost:                      enabled
CPU max MHz:                          2400.0000
CPU min MHz:                          1500.0000
BogoMIPS:                             4800.00
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es
Virtualization:                       AMD-V
L1d cache:                            1 MiB (32 instances)
L1i cache:                            1 MiB (32 instances)
L2 cache:                             16 MiB (32 instances)
L3 cache:                             256 MiB (16 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-63
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow:   Mitigation; Safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Retpolines; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

==============================
Versions of relevant libraries
==============================
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu12==12.6.4.1
[pip3] nvidia-cuda-cupti-cu12==12.6.80
[pip3] nvidia-cuda-nvrtc-cu12==12.6.77
[pip3] nvidia-cuda-runtime-cu12==12.6.77
[pip3] nvidia-cudnn-cu12==9.5.1.17
[pip3] nvidia-cufft-cu12==11.3.0.4
[pip3] nvidia-cufile-cu12==1.11.1.6
[pip3] nvidia-curand-cu12==10.3.7.77
[pip3] nvidia-cusolver-cu12==11.7.1.2
[pip3] nvidia-cusparse-cu12==12.5.4.2
[pip3] nvidia-cusparselt-cu12==0.6.3
[pip3] nvidia-nccl-cu12==2.26.2
[pip3] nvidia-nvjitlink-cu12==12.6.85
[pip3] nvidia-nvtx-cu12==12.6.77
[pip3] pyzmq==26.4.0
[pip3] torch==2.7.0
[pip3] torchaudio==2.7.0
[pip3] torchvision==0.22.0
[pip3] transformers==4.52.4
[pip3] triton==3.3.0
[conda] Could not collect

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
Neuron SDK Version           : N/A
vLLM Version                 : 0.9.2.dev44+gc742438f8.d20250616 (git sha: c742438f8, date: 20250616)
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
        GPU0    GPU1    GPU2    GPU3    GPU4    GPU5    GPU6    GPU7    NIC0    NIC1    NIC2    NIC3    NIC4    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      NV2     NV2     NV2     NODE    NODE    NODE    NODE    NODE    NODE    NODE    NODE    PIX     0-63    0               N/A
GPU1    NV2      X      NV2     NV2     NODE    NODE    NODE    NODE    NODE    NODE    NODE    NODE    PIX     0-63    0               N/A
GPU2    NV2     NV2      X      NV2     PHB     PHB     NODE    NODE    NODE    NODE    PIX     PHB     NODE    0-63    0               N/A
GPU3    NV2     NV2     NV2      X      PHB     PHB     NODE    NODE    NODE    NODE    PIX     PHB     NODE    0-63    0               N/A
GPU4    NODE    NODE    PHB     PHB      X      NV2     NV2     NV2     NODE    NODE    PHB     PIX     NODE    0-63    0               N/A
GPU5    NODE    NODE    PHB     PHB     NV2      X      NV2     NV2     NODE    NODE    PHB     PIX     NODE    0-63    0               N/A
GPU6    NODE    NODE    NODE    NODE    NV2     NV2      X      NV2     PHB     PIX     NODE    NODE    NODE    0-63    0               N/A
GPU7    NODE    NODE    NODE    NODE    NV2     NV2     NV2      X      PHB     PIX     NODE    NODE    NODE    0-63    0               N/A
NIC0    NODE    NODE    NODE    NODE    NODE    NODE    PHB     PHB      X      PHB     NODE    NODE    NODE
NIC1    NODE    NODE    NODE    NODE    NODE    NODE    PIX     PIX     PHB      X      NODE    NODE    NODE
NIC2    NODE    NODE    PIX     PIX     PHB     PHB     NODE    NODE    NODE    NODE     X      PHB     NODE
NIC3    NODE    NODE    PHB     PHB     PIX     PIX     NODE    NODE    NODE    NODE    PHB      X      NODE
NIC4    PIX     PIX     NODE    NODE    NODE    NODE    NODE    NODE    NODE    NODE    NODE    NODE     X

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing at most a single PCIe bridge
  NV#  = Connection traversing a bonded set of # NVLinks

NIC Legend:

  NIC0: mlx5_0
  NIC1: mlx5_1
  NIC2: mlx5_2
  NIC3: mlx5_3
  NIC4: mlx5_4

==============================
     Environment Variables
==============================
NVIDIA_VISIBLE_DEVICES=all
NVIDIA_REQUIRE_CUDA=cuda>=12.1 brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=geforce,driver>=470,driver<471 brand=geforcertx,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=titan,driver>=470,driver<471 brand=titanrtx,driver>=470,driver<471 brand=tesla,driver>=525,driver<526 brand=unknown,driver>=525,driver<526 brand=nvidia,driver>=525,driver<526 brand=nvidiartx,driver>=525,driver<526 brand=geforce,driver>=525,driver<526 brand=geforcertx,driver>=525,driver<526 brand=quadro,driver>=525,driver<526 brand=quadrortx,driver>=525,driver<526 brand=titan,driver>=525,driver<526 brand=titanrtx,driver>=525,driver<526
NVIDIA_DRIVER_CAPABILITIES=compute,utility
CUDA_VERSION=12.1.1
LD_LIBRARY_PATH=/usr/local/lib
NCCL_CUMEM_ENABLE=0
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
CUDA_MODULE_LOADING=LAZY

🐛 Describe the bug

When i use the Mooncakestoreconnector,there is a bug between Mooncake and cache_kernels.cu.
ERROR 06-16 11:58:22 [engine.py:166] IndexError('Dimension out of range (expected to be in range of [-2, 1], but got 2)') ERROR 06-16 11:58:22 [engine.py:166] Traceback (most recent call last): ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/engine/multiprocessing/engine.py", line 164, in start ERROR 06-16 11:58:22 [engine.py:166] self.run_engine_loop() ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/engine/multiprocessing/engine.py", line 227, in run_engine_loop ERROR 06-16 11:58:22 [engine.py:166] request_outputs = self.engine_step() ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/engine/multiprocessing/engine.py", line 253, in engine_step ERROR 06-16 11:58:22 [engine.py:166] raise e ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/engine/multiprocessing/engine.py", line 236, in engine_step ERROR 06-16 11:58:22 [engine.py:166] return self.engine.step() ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/engine/llm_engine.py", line 1352, in step ERROR 06-16 11:58:22 [engine.py:166] outputs = self.model_executor.execute_model( ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/executor/executor_base.py", line 141, in execute_model ERROR 06-16 11:58:22 [engine.py:166] output = self.collective_rpc("execute_model", ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/executor/uniproc_executor.py", line 57, in collective_rpc ERROR 06-16 11:58:22 [engine.py:166] answer = run_method(self.driver_worker, method, args, kwargs) ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/utils.py", line 2680, in run_method ERROR 06-16 11:58:22 [engine.py:166] return func(*args, **kwargs) ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/worker/worker_base.py", line 421, in execute_model ERROR 06-16 11:58:22 [engine.py:166] output = self.model_runner.execute_model( ERROR 06-16 11:58:22 [engine.py:166] File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context ERROR 06-16 11:58:22 [engine.py:166] return func(*args, **kwargs) ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/worker/model_runner.py", line 1818, in execute_model ERROR 06-16 11:58:22 [engine.py:166] get_kv_transfer_group().recv_kv_caches_and_hidden_states( ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/distributed/kv_transfer/kv_connector/mooncake_store_connector.py", line 175, in recv_kv_caches_and_hidden_states ERROR 06-16 11:58:22 [engine.py:166] self.kv_helper.put_kv_to_cache(model_executable, remote_k, ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/distributed/kv_transfer/kv_connector/utils.py", line 84, in put_kv_to_cache ERROR 06-16 11:58:22 [engine.py:166] ops.reshape_and_cache_flash( ERROR 06-16 11:58:22 [engine.py:166] File "/vllm/vllm/_custom_ops.py", line 1647, in reshape_and_cache_flash ERROR 06-16 11:58:22 [engine.py:166] torch.ops._C_cache_ops.reshape_and_cache_flash(key, value, key_cache, ERROR 06-16 11:58:22 [engine.py:166] File "/usr/local/lib/python3.10/dist-packages/torch/_ops.py", line 1158, in __call__ ERROR 06-16 11:58:22 [engine.py:166] return self._op(*args, **(kwargs or {})) ERROR 06-16 11:58:22 [engine.py:166] IndexError: Dimension out of range (expected to be in range of [-2, 1], but got 2)
When using disaggregated prefill with the mooncake store connector, the decoding instance crashes with an from the kernel.IndexError: Dimension out of rangereshape_and_cache_flash

The bug is not triggered when using MooncakeConnector serving with the same model. It seems that it is the vLLM Mooncake integration not conforming to the new expected shape of the KV cache.

The bug appears to be a regression, triggered by the following change: (#16605)

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions