# PR #45454 完整报告

- 仓库：`vllm-project/vllm`
- 标题：[Refactor] Remove dead quantization code and tests
- 合并时间：2026-06-18 04:12
- 原文链接：http://prhub.com.cn/vllm-project/vllm/pull/45454

---

# 执行摘要

- 一句话：移除无用量化代码和测试
- 推荐动作：值得精读，可作为代码清理的理想范例：审慎移除标记为跳过或遗留的路径，保持代码库整洁。

# 功能与动机

PR body 仅标明移除死量化代码和测试。这样做可以减少代码库中无用的测试和已废弃的配置路径，避免误导开发者和 CI 资源浪费。

# 实现拆解

1. **移除 FP8 KV cache 测试**：删除 `tests/quantization/test_fp8.py` 中已标记跳过的 `KV_CACHE_MODELS` 列表和 `test_kv_cache_model_load_and_run` 函数，这些测试依赖已被移除的 checkpoint。
2. **移除 FPQuant 测试**：删除整个 `tests/quantization/fp_quant.py` 文件，该文件测试已不再支持的 FPQuant 方法。
3. **移除 AWQ 已跳过测试**：删除 `tests/kernels/quantization/test_awq.py` 中已标记跳过且需调查的 `test_awq_gemm_opcheck` 函数。
4. **清理 fp8.py 死分支**：移除 `vllm/model_executor/layers/quantization/fp8.py` 中冗余的 `if self.use_marlin` 分支，该分支逻辑与后续统一调用相同。
5. **移除自动舍入配置键**：从 `vllm/model_executor/layers/quantization/__init__.py` 中删除 `"auto-round": INCConfig` 映射，该配置已在 INC 重构后废弃。

关键文件：
- `tests/quantization/test_fp8.py`（模块 FP8 量化；类别 test；类型 test-coverage；符号 test_kv_cache_model_load_and_run, check_model）: 删除了 64 行，包括已跳过的 KV cache 列表和对应的测试函数，是本次清理中删除量最大的测试文件。
- `tests/quantization/fp_quant.py`（模块 FP 量化；类别 test；类型 deletion；符号 test_fpquant）: 整个测试文件被删除，该文件用于测试已废弃的 FPQuant 方法，共 32 行。
- `tests/kernels/quantization/test_awq.py`（模块 AWQ 量化；类别 test；类型 test-coverage；符号 test_awq_gemm_opcheck）: 移除了已标记跳过且需调查的 test_awq_gemm_opcheck 函数，共 20 行，保持代码整洁。
- `vllm/model_executor/layers/quantization/fp8.py`（模块 FP8 量化；类别 source；类型 core-logic）: 移除了 apply 方法中冗余的 if self.use_marlin 分支，简化了控制流。
- `vllm/model_executor/layers/quantization/__init__.py`（模块 量化注册；类别 source；类型 configuration）: 删除了 "auto-round": INCConfig 配置映射，该配置随 INC 重构已废弃。

关键符号：test_kv_cache_model_load_and_run, check_model, test_fpquant, test_awq_gemm_opcheck

## 关键源码片段

### `vllm/model_executor/layers/quantization/fp8.py`

移除了 apply 方法中冗余的 if self.use_marlin 分支，简化了控制流。

```python
# vllm/model_executor/layers/quantization/fp8.py (cleanup)
# 在 `apply` 方法尾部，去除了重复的 Marlin 分支

        # ... 前置逻辑：dequant 到 BF16 并执行 GEMM
        if weight_scale.dim() == 1 and weight_scale.shape[0] == weight_fp8.shape[0]:
            weight_bf16 = weight_fp8 * weight_scale.unsqueeze(1)
        else:
            weight_bf16 = weight_fp8 * weight_scale
        return torch.nn.functional.linear(x, weight_bf16.t(), bias)

    # 移除了以下死分支：
    # if self.use_marlin:
    # return self.fp8_linear.apply_weights(layer, x, bias)
    # 现在所有非 dequant 路径统一调用 :
    return self.fp8_linear.apply_weights(layer, x, bias)

```

# 评论区精华

无 review 讨论。sfeng33 快速批准。

- 暂无高价值评论线程

# 风险与影响

- 风险：移除已标记跳过的测试和死分支风险很低。但需要注意：如果任何外部代码或自定义路径依赖了 `__init__.py` 中 `auto-round` 键或 `fp8.py` 中 `use_marlin` 标志，会引发配置错误。鉴于这些代码已被标记为废弃或跳过，影响面极小。
- 影响：对用户无功能影响；对开发者减少了混淆，清洁了量化模块。CI 可能略微加速，因为移除了无用的测试数据加载。
- 风险标记：配置兼容性 , 测试清理

# 关联脉络

- PR #40601 [quant][autoround]Refactor INC quantization into package with INCScheme orchestrator: 此 PR 移除了 INC 重构后遗留的 'auto-round' 配置键，是 INC 重构的后续清理。