Pull Request已成功合入, 合并人@ascend-robot
(感谢 SCh_zx 的贡献)变更摘要
此 PR 主要跟进上游 #187357 的接口变更,对 ScaledGroupMmV2KernelNpuOpApi.cpp 中的 _scaled_grouped_mm_v2 函数签名进行兼容性适配:将 scale_a 和 scale_b 两个参数类型从 c10::ArrayRef<at::Tensor> 替换为 const at::ITensorListRef&,以匹配上游 PyTorch 对张量列表引用的新接口规范。
主要改动
scale_a参数类型变更:将函数参数scale_a的类型从c10::ArrayRef<at::Tensor>改为const at::ITensorListRef&,以适配上游对张量列表引用的统一封装。scale_b参数类型变更:将函数参数scale_b的类型从c10::ArrayRef<at::Tensor>改为const at::ITensorListRef&,与scale_a保持一致,确保接口兼容性。


代码审查
我已审查完毕。以下是最终结论。
审查总结
| 优先级 | 数量 |
|---|---|
| P0 | 1 |
| P1 | 0 |
| P2 | 0 |
| P3 | 0 |
已审查文件:
op_plugin/ops/opapi/ScaledGroupMmV2KernelNpuOpApi.cpp— 发现 1 个 P0 问题
整体风险评估:此变更不可合入。 DIFF 仅将 _scaled_grouped_mm_v2 函数签名中的 scale_a / scale_b 参数类型从 c10::ArrayRef<at::Tensor> 改为 const at::ITensorListRef&,但未在函数体中添加 materialize 代码。函数体第 174、177 行将 scale_a / scale_b 传递给期望 c10::ArrayRef<at::Tensor>& 的 matcher(check_rowwise_recipe / check_mxfp8_recipe),由于 ITensorListRef 无法隐式转换为 ArrayRef,必然导致编译失败。修复需参照同仓库 ScaledMmV2KernelNpuOpApi.cpp 中 _scaled_mm_v2 的完整 materialize 模式(第 333–338 行)。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 1 |
| 🟡 建议 | 0 |
⛔ 需要修改


/approve


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


【合入来源】
【修改方案】
torch_npu CI 流水线编译阶段失败,错误位于自动生成的 torch_npu/csrc/aten/RegisterNPU.cpp 中 _scaled_grouped_mm_v2 算子的 wrapper 函数。codegen 生成的 wrapper 将 scale_a 和 scale_b 参数类型生成为 const at::ITensorListRef &,但 op-plugin 中 ScaledGroupMmV2KernelNpuOpApi.cpp 的实现仍使用 c10::ArrayRefat::Tensor(即 at::TensorList),两者不兼容导致编译失败。
【资料变更】
【接口变更】
【功能验证】
【CheckList】