快速结论:Compile bug: CUDA11 sm_50 fails in lightning-indexer.cu 通常出现在为旧架构(尤其 sm_50)编译 CUDA 后端时,lightning-indexer.cu 中实例化的 get_dequantize_V 触发 fattn-common.cuh 的静态断言失败;应优先核对实际使用的 CUDA 架构列表是否包含 sm_50,以及是否为默认架构列表。
适用环境:Issue 已确认:llama.cpp(提交 e30ad80 及后续 master,如 4b77dee05)、CUDA 11.7(Linux x86_64 与 Windows 均可复现)、CUDA 12.4(Windows x64 CI 可复现)、CUDA 12.8(CI 可复现);目标架构 sm_50,以及未显式设置架构时默认的 50-virtual;61-virtual;70-virtual。Python、PyTorch、具体显卡型号未在 Issue 中给出。
最快修复方案:暂无确认的一步修复方案。Issue 中给出的修复方向是 PR #31787,需等待合并后更新代码;在此之前,编译时应避免把 sm_50(以及包含 sm_50 的默认架构列表)纳入构建目标。
注意事项:该问题并非仅限 CUDA 11,Release 构建中未设置 CMAKE_CUDA_ARCHITECTURES 的 CUDA 12 任务同样受影响;PR CI 因只构建 89-real 未能发现。CUDA 12.4 失败还可能因默认 fail-fast 取消同一矩阵中的 CUDA 13 任务。PR #31787 是否已完全验证 Issue 未明确。
问题场景
用户在使用 llama.cpp 的 CUDA 后端进行编译构建时触发问题。按 Issue 描述,在 Linux x86_64 CUDA 11.7 上以 sm_50 为目标构建,编译在 lightning-indexer.cu 阶段失败;同样的失败也出现在 Windows CUDA 11.7 构建中。评论进一步指出,当前 master 上未设置 CUDA 架构的 Windows CUDA 12.4 和 Ubuntu CUDA 12.8 Release/CI 构建也会出现相同的 5 个静态断言错误。
该问题从提交 15e5099(CUDA/HIP: matrix-core (MFMA) lightning indexer for CDNA2 (gfx90a) #29050)开始出现。
报错原文
Compile bug: CUDA11 sm_50 fails in lightning-indexer.cu
fattn-common.cuh(449): error: static assertion failed with "bad type"
fattn-common.cuh(489): error: static assertion failed with "bad type"
fattn-common.cuh(539): error: static assertion failed with "bad type"
fattn-common.cuh(589): error: static assertion failed with "bad type"
fattn-common.cuh(622): error: static assertion failed with "unsupported type"
instantiation of:
get_dequantize_V<GGML_TYPE_Q8_0, half, 4>()
lightning-indexer.cu(87): here
5 errors detected in the compilation of "lightning-indexer.cu".
原因分析
最可能的原因是:在旧 CUDA 架构(sm_50)下编译时,lightning-indexer.cu 第 87 行实例化的 get_dequantize_V<GGML_TYPE_Q8_0, half, 4>() 走到了 fattn-common.cuh 中类型不受支持的分支,从而触发多处静态断言。该路径由 #29050 引入,可能未覆盖或未在 sm_50 构建下校验。
对于 CUDA 12 构建:未设置 CMAKE_CUDA_ARCHITECTURES 时默认架构列表为 50-virtual;61-virtual;70-virtual,其中包含 50-virtual,因此即便没有显式指定 sm_50,也可能触发同一编译错误。
环境排查
- 确认 CUDA 版本:Issue 涉及 CUDA 11.7(Linux/Windows)与 CUDA 12.4、12.8。
- 确认
CMAKE_CUDA_ARCHITECTURES是否显式设置为50,或未设置而使用默认的50-virtual;61-virtual;70-virtual。 - 确认代码是否处于 #29050 之后、PR #31787 合并之前。
- 确认构建日志中是否出现上述 5 个
fattn-common.cuh静态断言及lightning-indexer.cu(87)的实例化位置。 - Python、PyTorch、显卡型号不在 Issue 已确认范围内,暂不作为排查前提。
解决步骤
- 检查当前构建使用的 CUDA 架构列表,确认其中是否包含
50或50-virtual;该值是本 Issue 中已确认的触发条件。 - 若只是本机构建遇到问题,移除
sm_50或默认架构中的50-virtual,改为面向实际显卡的架构(可优先尝试;Issue 未给出具体架构取值,需按硬件选择)。 - 若无法自行调整架构(例如使用默认 Release 构建),需等待 PR #31787 合并后更新 llama.cpp 代码再重新编译;Issue 中给出的修复方向即为该 PR。
- 若在 CI 中构建,注意
windows-cuda (12.4, x64)、ubuntu-cuda (12.8, x64)和build-cuda-windows.yml中的对应任务受影响;PR CI 因只构建89-real不会暴露此问题。
验证方法
重新构建后,确认编译输出中不再出现 lightning-indexer.cu 的 get_dequantize_V 实例化错误,也不再出现 fattn-common.cuh 的 “bad type” 或 “unsupported type” 静态断言失败,且构建顺利完成。
参考来源
AI 工具推荐
想把多个 AI 模型放在一个入口?
GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。
推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。
这个方案解决了吗?
可以继续搜索完整报错,或查看同一工具的其他排查指南。

![[Bug]: Reservation reseed marks actual cost applied without incrementing it](https://www.chat-gpts.plus/wp-content/uploads/2026/11/35570-cb9f3004-768x403.jpg)
![[Bug]: Azure AI Claude Mythos 5.1 has no cost-map entry and records zero spend](https://www.chat-gpts.plus/wp-content/uploads/2026/11/49865-d8be4142-768x403.jpg)