你的观察基本符合 vLLM 的实际启动流程。几个缓存影响的阶段不同,所以影响启动时间差异很大。
先区分一下:
| 缓存 | 主要内容 | 影响阶段 | 对 vLLM 启动时间影响 |
|---|---|---|---|
/tmp/torchinductor_root/ |
PyTorch Inductor 编译缓存 | 模型运行时图优化、kernel fusion | 通常较小 |
~/.triton/cache/ |
Triton kernel 编译缓存 | Triton 自定义 kernel 编译 | 通常较小 |
~/.cache/vllm/ |
vLLM 自身缓存(含部分编译产物) | vLLM backend 初始化 | 中等 |
flashinfer/ |
FlashInfer kernel autotune / JIT 编译缓存 | attention、MoE、量化 kernel | 非常大 |
为什么 FlashInfer 缓存影响最大?
你的模型:
unsloth/Qwen3.6-27B-NVFP4
启动参数:
--moe-backend flashinfer_b12x
这类模型启动时会大量依赖 FlashInfer。
启动流程大概:
vLLM serve
|
|-- load model weights
|
|-- initialize attention backend
|
|-- initialize MoE backend
|
|-- FlashInfer kernel selection
|
|-- 查找已有 kernel cache
|
|-- 没有:
编译 CUDA kernel
autotune
保存 cache
|
|-- engine ready
第一次启动:
没有 flashinfer cache
|
v
nvcc / nvrtc 编译大量 kernel
|
v
几十秒甚至几分钟
第二次:
读取 ~/.cache/vllm/flashinfer
|
v
直接加载
|
v
快速启动
为什么 Triton cache 不明显?
因为现在 vLLM 的核心路径不一定大量依赖 Triton。
例如:
以前:
vLLM
|
|-- Triton attention
|-- Triton fused kernel
现在很多情况:
vLLM
|
|-- FlashAttention
|
|-- FlashInfer
|
|-- CUTLASS
|
|-- CUDA kernel
尤其 Blackwell:
RTX5090
SM120
NVFP4
大量走:
FlashInfer
+
CUTLASS
+
Tensor Core kernel
不是 Triton。
所以:
~/.triton/cache
可能只有少量 kernel。
/tmp/torchinductor_root 为什么影响小?
PyTorch Inductor主要影响:
-
torch.compile
-
graph capture
-
operator fusion
例如:
torch.compile(model)
|
v
Inductor
|
v
生成优化后的 kernel
但是 vLLM 推理:
不是传统:
PyTorch eager
+
torch.compile
更多是:
CUDA Graph
+
custom kernel
+
FlashInfer
所以 Inductor 贡献有限。
你可以验证
第一次启动:
rm -rf ~/.cache/vllm/flashinfer
time vllm serve ...
观察:
Compiling ...
Generating kernels...
Autotuning...
第二次:
time vllm serve ...
通常会明显减少。
你的环境建议持久化
你之前设置:
export HF_HOME=/hyperai/input/input0/hub
export VLLM_CACHE_ROOT=/local_nvme/vllm_cache
export FLASHINFER_CACHE_DIR=/local_nvme/flashinfer_cache
export TORCHINDUCTOR_CACHE_DIR=/local_nvme/torch_cache
export TRITON_CACHE_DIR=/local_nvme/triton_cache
其中最关键:
第一优先级
FLASHINFER_CACHE_DIR
一定要持久化。
第二优先级
VLLM_CACHE_ROOT
保存 vLLM 相关编译结果。
第三
TRITON_CACHE_DIR
TORCHINDUCTOR_CACHE_DIR
保存也没坏处,但收益明显低。
对你的 RTX5090 + NVFP4 环境还有一个特殊点
Blackwell 的 NVFP4 kernel 比传统 FP16 kernel 更依赖:
CUTLASS
+
FlashInfer
+
architecture specific compilation
例如:
sm_120
sm_121
这些 kernel 不是通用二进制。
所以:
同一个 cache:
RTX5090(sm120)
换到:
B200(sm100)
通常不能复用。
甚至:
RTX5090 A机器
RTX5090 B机器
如果 CUDA / driver / flashinfer 版本不同,也可能重新编译。
所以你的实验结果可以总结为:
启动耗时主要 =
模型权重加载
+
FlashInfer kernel 编译/autotune
不是 =
PyTorch Inductor
+
Triton cache
对于你现在这个 Qwen3.6-27B-NVFP4 + RTX5090 + vLLM FlashInfer MoE backend 场景,flashinfer cache 是最值得持久化的。