Closed
npu_swiglu_mx_quant 扩展 swiglu_mode 参数取值范围至 0-3 #452
caorenleiAdd on  Aug 26Closed at  Sep 29
caorenlei
Aug 26 Create

一、背景信息

npu_swiglu_mx_quant 算子的 swiglu_mode 参数用于控制 SwiGLU 激活函数的变体类型。当前 op-plugin 前端接口中 TORCH_CHECK 仅允许 swiglu_mode 取值 0 和 1,限制了底层 aclnnSwigluMxQuant 算子已支持的 mode 2(ClippedSwiGLU)和 mode 3 变体的使用。

二、价值/作用

扩展 swiglu_mode 取值范围至 0-3,使用户能够使用 ClippedSwiGLU 变体(mode 2、3),满足大模型量化场景下更多激活函数变体的需求。

三、设计方案

修改 op_plugin/ops/opapi/SwigluMxQuantOpApi.cpp 中 npu_swiglu_mx_quant 函数的 TORCH_CHECK 校验逻辑:

  • 将 swiglu_mode == 0 || swiglu_mode == 1 扩展为 swiglu_mode == 0 || swiglu_mode == 1 || swiglu_mode == 2 || swiglu_mode == 3
  • 更新错误提示信息为 "swiglu_mode only support [0 - 3]"

关联 PR:https://gitcode.com/Ascend/op-plugin/pull/5786

likedislike
Ccaorenlei
Aug 26 Added label: requirement
caorenlei
Aug 26 Comments:

/assign @caorenlei

likedislike
ascend-robotascend-robotCollaborators
Aug 26 Assign caorenlei as responsible person
TorchNPU-BotTorchNPU-BotCollaborators
Sep 15 Added label: bot-triaged
TorchNPU-Bot
TorchNPU-BotCollaborators
Sep 15 Comments:

检测到当前 issue 已关联 PR,自动添加标签:bot-triaged

likedislike
chenrayray
chenrayrayCollaborators
Sep 29 Comments:

该 issue 关联的 PR 均已合入或关闭:Ascend/op-plugin !5786(已合入)。因此本轮 issue 梳理先关闭此单。PR 已关闭不代表相关功能一定已实现;如问题仍存在或还有未完成事项,请重新打开,并补充当前版本、复现步骤及日志,或具体待办和后续 PR。

likedislike
chenrayraychenrayrayCollaborators
Sep 29 Close issue
chenrayraychenrayrayCollaborators
Sep 29 changed custom state from TODO to DONE
ascend-robotascend-robotCollaborators
Sep 29 Added label: resolved