# PR #45072 完整报告

- 仓库：`vllm-project/vllm`
- 标题：[bugfix] skip conch kernel for g_idx reordering
- 合并时间：2026-06-10 23:04
- 原文链接：http://prhub.com.cn/vllm-project/vllm/pull/45072

---

# 执行摘要

- 一句话：跳过 conch kernel 处理 g_idx 重排
- 推荐动作：小而精准的 bugfix，值得合并。对于全量量化模型用户，避免潜在无声错误。

# 功能与动机

Conch kernel 不支持 g_idx 重排，导致使用此功能的量化模型（如 LoRA 测试）在 ROCm 上失败。PR 作者指出问题非 ROCm 特有，但 CUDA 上因 kernel 选择顺序（Marlin 优先）而未被触发。详情见 PR body 中的链接。

# 实现拆解

在 `vllm/model_executor/kernels/linear/mixed_precision/conch.py` 的 `ConchLinearKernel.can_implement` 方法中，在检查 `group_size` 之后、检查 conch 安装之前，新增一个判断：如果 `c.has_g_idx` 为真，则返回 `(False, "Activation reordering (g_idx) is not supported by ConchLinearKernel")`。这样，当模型需要 g_idx 重排时，Conch 不会被选中，后续的 ExllamaLinearKernel（ROCm 上的下一个候选）将被使用。

关键文件：
- `vllm/model_executor/kernels/linear/mixed_precision/conch.py`（模块 内核选择；类别 source；类型 data-contract；符号 ConchLinearKernel.can_implement）: 核心改动文件，在 can_implement 方法中新增 g_idx 支持判断。

关键符号：ConchLinearKernel.can_implement

## 关键源码片段

### `vllm/model_executor/kernels/linear/mixed_precision/conch.py`

核心改动文件，在 can_implement 方法中新增 g_idx 支持判断。

```python
# vllm/model_executor/kernels/linear/mixed_precision/conch.py

    @classmethod
    def can_implement(cls, c: MPLinearLayerConfig) -> tuple[bool, str | None]:
        if c.weight_type not in _CONCH_SUPPORTED_WEIGHT_TYPES:
            return False, f"Weight type ({c.weight_type}) not supported"
        if c.group_size not in _CONCH_SUPPORTED_GROUP_SIZES:
            return False, f"Group size ({c.group_size}) not supported"
        # 新增：若配置要求 g_idx 重排，则不可用
        if c.has_g_idx:
            return (
                False,
                "Activation reordering (g_idx) is not supported by ConchLinearKernel",
            )
        if find_spec("conch") is None:
            return False, "conch-triton-kernels is not installed"
        return True, None

```

# 评论区精华

无 review 评论。

- 暂无高价值评论线程

# 风险与影响

- 风险：风险极低：仅新增一条条件判断，无破坏性。若 `has_g_idx` 属性存在且为 True 时正确跳过，其他情况行为不变。需确认 `MPLinearLayerConfig` 中 `has_g_idx` 字段是否存在（从代码看已在其他地方使用）。
- 影响：影响范围限于使用 Conch kernel 且模型配置了 g_idx 重排的场景。修复了 LoRA 量化测试失败，对其他用户无影响。
- 风险标记：低风险

# 关联脉络

- 暂无明显关联 PR