Merged
fix(operation): Fix Div operation using int64 dtype #6611
junnyleoAdd on Sep 22
fix(operation): Fix Div operation using int64 dtype #6611
Merged
Merged fromjunnyleo/pyptofix/div920intocann/pypto9.2.0
Pull Request has been successfully merged by CANN-robot.
(Thank you for junnyleo's contribution.)atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
变更摘要
本 PR 修复了 Div 运算对 int64 数据类型的支持问题,涉及向量二元运算 Div 与张量-标量二元运算 Div(Divs)。核心做法是统一 A5 架构下支持的数据类型集合,将 DT_UINT64 从 DIV_A5_TYPES 中移除并纳入 DT_INT64,同时把整数参与运算的处理路径统一为先 Cast 到 DT_FP32 计算、再按需回转,并相应更新了 golden 测试的生成逻辑与错误提示信息。
主要改动
Div支持类型集合调整(张量-张量): 在framework/src/interface/operation/vector/binary.cpp中,DIV_A5_TYPES去掉DT_UINT64、仅保留DT_INT64,并将isDivSupportedInt判定扩展到DT_INT64,同时移除了原先的CheckInt64Broadcast调用。Div整数路径统一为 FP32 计算(张量-标量): 在framework/src/interface/operation/vector/binary_scalar.cpp中,同样调整DIV_A5_TYPES与isDivSupportedInt,删除isDiv64Int判定及其独立分支,整数参与时统一先将self与other转为DT_FP32计算,并通过Cast(..., self.GetDataType(), CastMode::CAST_RINT, ...)回转结果。- 浮点-整数标量分支处理简化: 删除了原
needPromoteToFp32条件分支,改为对所有整数标量统一执行self转DT_FP32、other转DT_FP32后再做TensorBinaryOperationScalarWithOp<BinaryOpType::DIV>并回转类型。 - 错误提示信息更新: 将整数场景下的
ERR_PARAM_DTYPE_UNSUPPORTED报错文案由DT_INT16/DT_INT32、DT_INT64/DT_UINT64等描述统一为DT_INT16/DT_INT32/DT_INT64。 - golden 生成逻辑调整: 在
framework/tests/st/operation/python/vector_operator_golden.py中,gen_div_op_golden与gen_divs_op_golden改用torch.div配合from_numpy/to_numpy计算并返回结果,替换原先的直接除法表达式。


Incorrect?
atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
Sep 22 Added label: cann-cla/yes
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| 9.2.0 | ✅ gcw_kUomxQ2l, wangzheng97 (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
junnyleo, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Sep 22 Set xinweiliu,lyz0328,cam_bxh,dai-zhentao,TianXL,lululu40888,shi-dingkun,gguuaanngg,codehjp423,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,gcw_kUomxQ2l,Andy-lb,WenboCodes as approver
Sep 22 Set xinweiliu,lyz0328,cam_bxh,dai-zhentao,TianXL,lululu40888,shi-dingkun,gguuaanngg,codehjp423,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,gcw_kUomxQ2l,Andy-lb,WenboCodes as approver
Sep 22 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
Sep 22 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
Sep 22 Modify description of pull request
junnyleo
Sep 22 Comments:
Sep 22 Comments:
compile


Sep 22 Pre merge succeeded (commit_id: 442d3b52f41b98219ca46feeab87bb41517e9c43)
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 22 Added label: ci-pipeline-running
Sep 22 Removed label: ci-pipeline-running
Sep 22 Added label: ci-pipeline-passed
lyz0328
Sep 22 Comments:
Sep 22 Comments:
/approve


Sep 22 Pre merge succeeded (commit_id: 14b5264109d3742a57023f4bf54fc7d7ea15a218)
Sep 22 Pre merge succeeded (commit_id: d958421a19b7051c4b34d346ffcfa4c604bf5247)
Sep 22 Removed label: cann-cla/yes
Sep 22 Removed label: ci-pipeline-passed
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
Sep 22 Added label: cann-cla/yes
junnyleo
Sep 22 Comments:
Sep 22 Comments:
compile


Sep 22 Pre merge succeeded (commit_id: fea2a38ac0715176d8a69c2fbc19b62d0828cb90)
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 22 Added label: ci-pipeline-running
Sep 22 Removed label: ci-pipeline-running
Sep 22 Added label: ci-pipeline-passed
Sep 22 Added label: AscendC-SUCC
liulun0308
Sep 22 Comments:
Sep 22 Comments:
/approve


Sep 22 Added label: approved
wangzheng97
Sep 22 Comments:
Sep 22 Comments:
/lgtm


Sep 22 Added label: lgtm
Sep 22 Merged pull request
本次变更主要围绕 Div/Divs 算子对 int64 数据类型的支持进行修复。核心思路是将 int64 纳入整数除法的支持范围,并统一整数路径的处理逻辑:改为将输入 Cast 到 FP32 进行除法运算后再按 self 的数据类型回退转换;同时从平台支持的数据类型配置中移除 uint64,并同步调整了对应的 golden 生成逻辑。
Related Issue: #3416