Merged
fix(operation): Correct packed FP4 UB offsets [9.2.0] #6692
bynshardAdd on Sep 23
fix(operation): Correct packed FP4 UB offsets [9.2.0] #6692
Merged
Merged frombynshard/pyptocodex/fix-fp4-ub-offset-9.2.0intocann/pypto9.2.0
Pull Request has been successfully merged by CANN-robot.
(Thank you for bynshard's contribution.)atomgit-bot
Sep 23 Comments:
Sep 23 Comments:
变更摘要
本 PR 修正 A5 架构上打包 FP4 类型的 UB 地址偏移计算。由于 float4_e1m2x2_t 和 float4_e2m1x2_t 每字节存放两个 4-bit 元素,而布局 stride 以 4-bit 元素计数,因此在 TileTensor::GetLinearAddr 中需要将逻辑 FP4 tile 偏移转换为打包字节偏移,避免地址超出已分配的 tile。改动仅涉及 TileTensor::GetLinearAddr,其他数据类型与代码生成保持不变。
主要改动
- FP4 偏移量右移转换为字节偏移: 在
TileTensor::GetLinearAddr中新增条件分支,当Type为float4_e1m2x2_t或float4_e2m1x2_t时对计算出的offset执行offset >>= 1,使逻辑 4-bit 元素偏移减半为打包字节偏移。 - 限定 A5 架构生效: 上述 FP4 偏移修正被包裹在
#if defined PTO_NPU_ARCH_A5条件编译中,仅在 A5 架构下启用,不影响其他架构。 - 引入类型判断所需头文件: 新增
#include <type_traits>,以支持通过std::is_same_v在编译期判断 FP4 类型。


Incorrect?
atomgit-bot
Sep 23 Comments:
Sep 23 Comments:
Sep 23 Added label: cann-cla/yes
CANN-robot
Sep 23 Comments:
Sep 23 Comments:
CANN-robot
Sep 23 Comments:
Sep 23 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, congqiannan (2/2) | ✅ gcw_kUomxQ2l (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


Sep 23 Set xinweiliu,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 23 Set xinweiliu,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 23 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
Sep 23 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
Sep 23 Change title to "fix(operation): Correct packed FP4 UB offsets [9.2.0]", originally titled "fix(tileop): Correct packed FP4 UB offsets [9.2.0]".
Sep 23 Change title to "fix(operation): Correct packed FP4 UB offsets [9.2.0]", originally titled "fix(tileop): Correct packed FP4 UB offsets [9.2.0]".
Sep 23 Associated issue: [Bug-Report|缺陷反馈]: fp4cast精度错误
bynshard
Sep 23 Comments:
Sep 23 Comments:
compile


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


Sep 23 Added label: ci-pipeline-running
Sep 23 Removed label: ci-pipeline-running
Sep 23 Added label: ci-pipeline-passed
Sep 24 Modify description of pull request
liulun0308
Sep 24 Comments:
Sep 24 Comments:
/approve


Sep 24 Added label: approved
陈晨
Sep 24 Comments:
Sep 24 Comments:
/lgtm


congqiannan
Sep 24 Comments:
Sep 24 Comments:
/lgtm


CANN-robot
Sep 24 Comments:
Sep 24 Comments:
The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/lgtm: chen_chenn


Sep 24 Added label: lgtm
Sep 24 Merged pull request
在 A5 上的 TileTensor::GetLinearAddr 中,将逻辑的 FP4 瓦片偏移量转换为打包的字节偏移量。
Related Issue:
https://gitcode.com/cann/pypto/issues/3443