Prhub

#23604 [NPU]Fix support_triton bug

原始 PR 作者 Liwansi 合并时间 2026-04-26 21:34 文件变更 1 提交数 3 评论 6 代码增减 +1 / -1

执行摘要

NPU 上 support_triton 误将 ascend 排除,修复 MTP 性能

修复 support_triton bug,该 bug 影响 MTP 性能。compute_position 应该使用 Triton。

值得合入,修复性能回退。审查简单,风险低。

讨论亮点

无 review 评论。

实现拆解

修改 python/sglang/srt/utils/common.py 中的 support_triton 函数,从排除列表中移除 "ascend"。变更仅一行,将 return backend not in ["torch_native", "intel_amx", "ascend"] 改为 return backend not in ["torch_native", "intel_amx"]

文件 模块 状态 重要度
python/sglang/srt/utils/common.py 工具函数 modified 5.12

关键符号

support_triton

关键源码片段

python/sglang/srt/utils/common.py core-logic

修改了 support_triton 函数,从排除列表中移除 "ascend",修复 NPU 性能 bug。

def support_triton(backend: str) -> bool:
    # 之前在 #21507 中错误地将 "ascend" 加入了排除列表,
    # 导致 Ascend NPU 后端无法使用 Triton 内核,
    # 进而影响 compute_position 等操作的性能。
    # 本 PR 将其移除,恢复 Ascend 对 Triton 的支持。
    return backend not in ["torch_native", "intel_amx"]

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

低风险。变更简单,仅影响 Ascend NPU 后端。需要确保其他使用 support_triton 的地方不会因为 "ascend" 不被排除而产生问题。

影响:主要面向 NPU 用户,修复 MTP 性能回退。影响范围限于 Ascend 后端。

缺少测试覆盖

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论