vllm: [Bug]: "Triton Error [CUDA]: device kernel image is invalid" when loading Mixtral-8x7B-Instruct-v0.1 in fused_moe.py
Your current environment
2024-06-19 17:30:02,514 - [Collecting environment information...
PyTorch version: 2.3.0
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A
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.29.5
Libc version: glibc-2.35
Python version: 3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.4.231-137.341.amzn2.x86_64-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA A100-SXM4-40GB
GPU 1: NVIDIA A100-SXM4-40GB
GPU 2: NVIDIA A100-SXM4-40GB
GPU 3: NVIDIA A100-SXM4-40GB
Nvidia driver version: 470.161.03
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 96
On-line CPU(s) list: 0-95
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Platinum 8275CL CPU @ 3.00GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 24
Socket(s): 2
Stepping: 7
BogoMIPS: 5999.99
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 1.5 MiB (48 instances)
L1i cache: 1.5 MiB (48 instances)
L2 cache: 48 MiB (48 instances)
L3 cache: 71.5 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-23,48-71
NUMA node1 CPU(s): 24-47,72-95
Vulnerability Itlb multihit: KVM: Vulnerable
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Retbleed: Vulnerable
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] optree==0.11.0
[pip3] torch==2.3.0
[pip3] torchaudio==2.3.0
[pip3] torchelastic==0.2.2
[pip3] torchvision==0.18.0
[pip3] transformers==4.41.2
[pip3] triton==2.3.0
[conda] blas 1.0 mkl
[conda] ffmpeg 4.3 hf484d3e_0 pytorch
[conda] libjpeg-turbo 2.0.0 h9bf148f_0 pytorch
[conda] mkl 2023.1.0 h213fc3f_46344
[conda] mkl-service 2.4.0 py310h5eee18b_1
[conda] mkl_fft 1.3.8 py310h5eee18b_0
[conda] mkl_random 1.2.4 py310hdb19cb5_0
[conda] numpy 1.26.4 py310h5f9d8c6_0
[conda] numpy-base 1.26.4 py310hb5e798b_0
[conda] optree 0.11.0 pypi_0 pypi
[conda] pytorch 2.3.0 py3.10_cuda11.8_cudnn8.7.0_0 pytorch
[conda] pytorch-cuda 11.8 h7e8668a_5 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 2.3.0 py310_cu118 pytorch
[conda] torchelastic 0.2.2 pypi_0 pypi
[conda] torchtriton 2.3.0 py310 pytorch
[conda] torchvision 0.18.0 py310_cu118 pytorch
[conda] transformers 4.41.2 pypi_0 pypi
ROCM Version: Could not collect
Neuron SDK Version: N/A
vLLM Version: 0.5.0.post1
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; Neuron: Disabled
GPU Topology:
GPU0 GPU1 GPU2 GPU3 CPU Affinity NUMA Affinity
GPU0 X NV12 NV12 NV12 0-23,48-71 0
GPU1 NV12 X NV12 NV12 0-23,48-71 0
GPU2 NV12 NV12 X NV12 24-47,72-95 1
GPU3 NV12 NV12 NV12 X 24-47,72-95 1
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
🐛 Describe the bug
pip3 install https://github.com/vllm-project/vllm/releases/download/v0.5.0.post1/vllm-0.5.0.post1+cu118-cp310-cp310-manylinux1_x86_64.whl --extra-index-url https://download.pytorch.org/whl/cu118
I hit this issue when running vllm worker in fastchat: https://github.com/lm-sys/FastChat/blob/main/fastchat/serve/vllm_worker.py
engine = AsyncLLMEngine.from_engine_args(engine_args)
it failed when loading the model `Mixtral-8x7B-Instruct-v0.1`
Error:
INFO 06-20 00:31:58 model_runner.py:160] Loading model weights took 21.7573 GB
INFO 06-20 00:31:58 model_runner.py:160] Loading model weights took 21.7573 GB
INFO 06-20 00:31:58 model_runner.py:160] Loading model weights took 21.7573 GB
INFO 06-20 00:31:58 model_runner.py:160] Loading model weights took 21.7573 GB
INFO 06-20 00:32:01 fused_moe.py:300] Using configuration from /opt/conda/lib/python3.10/site-packages/vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json for MoE layer.
INFO 06-20 00:32:01 fused_moe.py:300] Using configuration from /opt/conda/lib/python3.10/site-packages/vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json for MoE layer.
INFO 06-20 00:32:01 fused_moe.py:300] Using configuration from /opt/conda/lib/python3.10/site-packages/vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json for MoE layer.
INFO 06-20 00:32:01 fused_moe.py:300] Using configuration from /opt/conda/lib/python3.10/site-packages/vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_A100-SXM4-40GB.json for MoE layer.
wait for model worker to start
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] Exception in worker VllmWorkerProcess while processing method determine_num_available_blocks: Triton Error [CUDA]: device kernel image is invalid, Traceback (most recent call last):
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/executor/multiproc_worker_utils.py", line 223, in _run_worker_process
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] output = executor(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return func(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/worker/worker.py", line 162, in determine_num_available_blocks
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] self.model_runner.profile_run()
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return func(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/worker/model_runner.py", line 844, in profile_run
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] self.execute_model(seqs, kv_caches)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return func(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/worker/model_runner.py", line 749, in execute_model
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] hidden_states = model_executable(
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return self._call_impl(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return forward_call(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/model_executor/models/mixtral.py", line 535, in forward
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] hidden_states = self.model(input_ids, positions, kv_caches,
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return self._call_impl(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return forward_call(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/model_executor/models/mixtral.py", line 468, in forward
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] hidden_states, residual = layer(positions, hidden_states,
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return self._call_impl(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return forward_call(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/model_executor/models/mixtral.py", line 424, in forward
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] hidden_states = self.block_sparse_moe(hidden_states)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return self._call_impl(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return forward_call(*args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/model_executor/models/mixtral.py", line 271, in forward
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] final_hidden_states = fused_moe(hidden_states,
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/model_executor/layers/fused_moe/fused_moe.py", line 515, in fused_moe
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return fused_experts(hidden_states,
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/model_executor/layers/fused_moe/fused_moe.py", line 427, in fused_experts
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] invoke_fused_moe_kernel(hidden_states,
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/vllm/model_executor/layers/fused_moe/fused_moe.py", line 245, in invoke_fused_moe_kernel
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] fused_moe_kernel[grid](
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/triton/runtime/jit.py", line 167, in <lambda>
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] return lambda *args, **kwargs: self.run(grid=grid, warmup=False, *args, **kwargs)
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/triton/runtime/jit.py", line 425, in run
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] kernel.run(grid_0, grid_1, grid_2, kernel.num_warps, kernel.num_ctas, # number of warps/ctas per instance
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/triton/compiler/compiler.py", line 255, in __getattribute__
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] self._init_handles()
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] File "/opt/conda/lib/python3.10/site-packages/triton/compiler/compiler.py", line 250, in _init_handles
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] self.module, self.function, self.n_regs, self.n_spills = driver.utils.load_binary(
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] RuntimeError: Triton Error [CUDA]: device kernel image is invalid
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226]
ERROR 06-20 00:32:02 multiproc_worker_utils.py:226] Exception in worker VllmWorkerProcess while processing method determine_num_available_blocks: Triton Error [CUDA]: device kernel image is invalid, Traceback (most recent call last):
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (6 by maintainers)
把你自己的cuda 下面/usr/local/cuda/bin/ptxas 覆盖 triton 目录下的ptxas就好啦!就是这么简单!
In my case, I copied the ptxas file from
/usr/local/cuda/bin/(Linux) and replaced the one in the directory.../python3.8/site-packages/triton/third_party/cuda/bin(specific to my environment).The ptxas file is used by nvcc, and the error message indicated that the existing ptxas version was outdated.
good idea, thx! i did this and it works! but my path is different from yours. i copied ptxas file to
.../lib/python3.12/site-packages/triton/backends/nvidia/bin/.For anyone else facing the same issue: For us this was resolved when we updated our CUDA version from 11.8 to 12.2
Is there any other solutions except updating the driver version? 😢 We can only use driver 470.x and cu118 in our cluster😭