Description
Your current environment
The output of python collect_env.py
INFO 05-30 11:05:20 [__init__.py:243] Automatically detected platform cuda.
Collecting environment information...
==============================
System Info
==============================
OS : Ubuntu 22.04.3 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.12.9 | packaged by Anaconda, Inc. | (main, Feb 6 2025, 18:56:27) [GCC 11.2.0] (64-bit runtime)
Python platform : Linux-5.15.0-86-generic-x86_64-with-glibc2.35
==============================
CUDA / GPU Info
==============================
Is CUDA available : True
CUDA runtime version : 11.7.64
CUDA_MODULE_LOADING set to : LAZY
GPU models and configuration :
GPU 0: NVIDIA A800-SXM4-80GB
GPU 1: NVIDIA A800-SXM4-80GB
GPU 2: NVIDIA A800-SXM4-80GB
GPU 3: NVIDIA A800-SXM4-80GB
GPU 4: NVIDIA A800-SXM4-80GB
GPU 5: NVIDIA A800-SXM4-80GB
GPU 6: NVIDIA A800-SXM4-80GB
GPU 7: NVIDIA A800-SXM4-80GB
Nvidia driver version : 525.125.06
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: 46 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Platinum 8358P CPU @ 2.60GHz
CPU family: 6
Model: 106
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 2
Stepping: 6
CPU max MHz: 3400.0000
CPU min MHz: 800.0000
BogoMIPS: 5200.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 3 MiB (64 instances)
L1i cache: 2 MiB (64 instances)
L2 cache: 80 MiB (64 instances)
L3 cache: 96 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
==============================
Versions of relevant libraries
==============================
[pip3] numpy==2.2.6
[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] numpy 2.2.6 pypi_0 pypi
[conda] nvidia-cublas-cu12 12.6.4.1 pypi_0 pypi
[conda] nvidia-cuda-cupti-cu12 12.6.80 pypi_0 pypi
[conda] nvidia-cuda-nvrtc-cu12 12.6.77 pypi_0 pypi
[conda] nvidia-cuda-runtime-cu12 12.6.77 pypi_0 pypi
[conda] nvidia-cudnn-cu12 9.5.1.17 pypi_0 pypi
[conda] nvidia-cufft-cu12 11.3.0.4 pypi_0 pypi
[conda] nvidia-cufile-cu12 1.11.1.6 pypi_0 pypi
[conda] nvidia-curand-cu12 10.3.7.77 pypi_0 pypi
[conda] nvidia-cusolver-cu12 11.7.1.2 pypi_0 pypi
[conda] nvidia-cusparse-cu12 12.5.4.2 pypi_0 pypi
[conda] nvidia-cusparselt-cu12 0.6.3 pypi_0 pypi
[conda] nvidia-nccl-cu12 2.26.2 pypi_0 pypi
[conda] nvidia-nvjitlink-cu12 12.6.85 pypi_0 pypi
[conda] nvidia-nvtx-cu12 12.6.77 pypi_0 pypi
[conda] pyzmq 26.4.0 pypi_0 pypi
[conda] torch 2.7.0 pypi_0 pypi
[conda] torchaudio 2.7.0 pypi_0 pypi
[conda] torchvision 0.22.0 pypi_0 pypi
[conda] transformers 4.52.4 pypi_0 pypi
[conda] triton 3.3.0 pypi_0 pypi
==============================
vLLM Info
==============================
ROCM Version : Could not collect
Neuron SDK Version : N/A
vLLM Version : 0.9.0
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0 GPU1 GPU2 GPU3 GPU4 GPU5 GPU6 GPU7 NIC0 NIC1 CPU Affinity NUMA Affinity
GPU0 X NV8 NV8 NV8 NV8 NV8 NV8 NV8 SYS SYS 0-31,64-95 0
GPU1 NV8 X NV8 NV8 NV8 NV8 NV8 NV8 SYS SYS 0-31,64-95 0
GPU2 NV8 NV8 X NV8 NV8 NV8 NV8 NV8 SYS SYS 0-31,64-95 0
GPU3 NV8 NV8 NV8 X NV8 NV8 NV8 NV8 SYS SYS 0-31,64-95 0
GPU4 NV8 NV8 NV8 NV8 X NV8 NV8 NV8 NODE NODE 32-63,96-127 1
GPU5 NV8 NV8 NV8 NV8 NV8 X NV8 NV8 NODE NODE 32-63,96-127 1
GPU6 NV8 NV8 NV8 NV8 NV8 NV8 X NV8 NODE NODE 32-63,96-127 1
GPU7 NV8 NV8 NV8 NV8 NV8 NV8 NV8 X NODE NODE 32-63,96-127 1
NIC0 SYS SYS SYS SYS NODE NODE NODE NODE X PIX
NIC1 SYS SYS SYS SYS NODE NODE NODE NODE PIX 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
==============================
Environment Variables
==============================
LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64:/usr/local/cuda-12.0/lib64:/usr/local/cuda-11.7/lib64:/usr/local/cuda-12.0/lib64:
NCCL_CUMEM_ENABLE=0
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
CUDA_MODULE_LOADING=LAZY
🐛 Describe the bug
We found that under high concurrent requests, some requests returned duplicate characters. By checking the kvcache content during the running process, we found that this was caused by the kvcache being modified during the request process, and the subsequent requests used the wrong kvcache.
The launch script,we use 64 concurrent:
clear
export CUDA_VISIBLE_DEVICES=7
export VLLM_USE_V1=0
vllm serve Qwen3-32B --enforce-eager\
--gpu-memory-utilization 0.95 --tensor-parallel-size 1 \
--max-model-len 32000 --port 34007 --served-model-name chat \
--swap-space 0 --enable-chunked-prefill --enable-prefix-caching
Each request content is the following format (the uuid used to avoid influence of prefix cache):
{uuid} - {content}
We change the vllm/attention/layer.py/unified_attention_with_output
to record the kvcache chage:
import uuid,json
process_id = str(uuid.uuid4())
block_recorder = dict()
def unified_attention_with_output(
query: torch.Tensor,
key: torch.Tensor,
value: torch.Tensor,
output: torch.Tensor,
layer_name: str,
) -> None:
wait_for_kv_layer_from_connector(layer_name)
forward_context: ForwardContext = get_forward_context()
attn_metadata = forward_context.attn_metadata
if isinstance(attn_metadata, dict):
attn_metadata = attn_metadata[layer_name]
self = forward_context.no_compile_layers[layer_name]
kv_cache = self.kv_cache[forward_context.virtual_engine]
self.impl.forward(self,
query,
key,
value,
kv_cache,
attn_metadata,
output=output)
###################################################
try:
if attn_metadata.prefill_metadata is None and layer_name.strip() == "model.layers.0.self_attn.attn":
block_tables = attn_metadata.block_tables
if block_tables is not None:
for i in range(block_tables.shape[0]):
kv_cache_item = f"{process_id}-{kv_cache[0][block_tables[i][0]][0][0][:8].tolist()}"
if kv_cache_item in block_recorder.keys():
block_recorder[kv_cache_item] += 1
else:
block_recorder[kv_cache_item] = 1
with open(f"/home/qjsys/0zjp/workspace/report-bug/{process_id}-block","w") as f:
block_recorder_str = json.dumps(block_recorder,ensure_ascii=False,indent=2)
f.write(block_recorder_str)
except Exception as e:
print(f"Exception: {e}")
###################################################
maybe_save_kv_layer_to_connector(layer_name, kv_cache)
We record the first 8 values of K of the 0th head of the first token of the first block of each request. Since the first token (<im_start>) of each request is the same, these values should be the same. But we got the following result:
{
"9f1d9342-405b-4ebc-ac96-595cc689f472-[4.71875, -0.609375, 1.515625, -0.1103515625, 3.109375, 2.1875, -2.6875, -4.46875]": 105989,
"9f1d9342-405b-4ebc-ac96-595cc689f472-[0.39453125, 0.2421875, 0.0322265625, -0.8515625, -0.330078125, 0.400390625, -0.60546875, -0.12109375]": 54,
"9f1d9342-405b-4ebc-ac96-595cc689f472-[0.0419921875, -0.67578125, -0.158203125, 1.28125, -0.171875, 0.369140625, -0.001953125, 0.0634765625]": 38,
"9f1d9342-405b-4ebc-ac96-595cc689f472-[1.171875, -2.546875, 1.140625, -1.09375, 2.875, -0.515625, 0.8359375, -0.419921875]": 1390,
"9f1d9342-405b-4ebc-ac96-595cc689f472-[0.953125, 0.32421875, 0.66015625, -1.0390625, 0.54296875, -0.515625, 0.51953125, 0.7421875]": 1409,
"9f1d9342-405b-4ebc-ac96-595cc689f472-[0.0625, 2.71875, 0.0234375, -1.578125, -0.138671875, -0.0703125, 0.75390625, 0.2265625]": 186,
"9f1d9342-405b-4ebc-ac96-595cc689f472-[0.166015625, -0.671875, -1.96875, -1.2265625, -1.265625, 0.4296875, -1.734375, 0.26171875]": 72,
...
}
What could be wrong with this?
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.