[XPU] Fix paddle.tile fp16 gradient error#79103
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-05-22 10:00:00
📋 Review 摘要
PR 概述:为 XPU tile_grad kernel 补齐 fp16 dtype 注册,采用 cast-to-fp32 → reduce_sum → cast-back-to-fp16 路径,与 GPU 行为对齐,修复 XPU fp16 梯度执行报错。
变更范围:paddle/phi/backends/xpu/xpu2_op_list.cc、xpu3_op_list.cc、paddle/phi/kernels/xpu/tile_grad_kernel.cc
影响面 Tag:[Operator Mechanism] [Custom Device]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | paddle/phi/kernels/xpu/tile_grad_kernel.cc |
新增 fp16 支持但未在 test/xpu/ 中添加对应回归单测 |
| 📝 PR 规范 | — | 标题 tag [XPU] 不在官方 PR Category 枚举中 |
📝 PR 规范检查
标题使用了 [XPU],但根据 checklist §D1,标题 Tag 应来自 PR Category 或 PR Types 枚举。该 PR 的 PR Category 为 Operator Mechanism,更合规的标题如下。
标题建议(可直接复制):
[Operator Mechanism] Fix paddle.tile fp16 gradient error on XPU
四个必填描述 section(PR Category / PR Types / Description / 是否引起精度变化)均已填写且内容完整,无需修改描述。
总体评价
fp16 梯度路径的实现方式(if constexpr + cast-compute-cast)逻辑正确,与 GPU 行为一致,XPU2/XPU3 op list 也已同步更新。建议补充 test/xpu/ 回归单测以防止后续回退。
|
/re-run all-failed |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-05-26T18:07:25+08:00
📋 Review 摘要
PR 概述:为 XPU tile_grad kernel 新增 fp16 支持,通过 fp32 中间计算对齐 GPU 行为。
变更范围:paddle/phi/kernels/xpu/tile_grad_kernel.cc、paddle/phi/backends/xpu/xpu2_op_list.cc、paddle/phi/backends/xpu/xpu3_op_list.cc
影响面 Tag:[Operator Mechanism] [XPU]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | paddle/phi/backends/xpu/xpu3_op_list.cc:887 |
XPU3 tile 前向不支持 fp16,但反向 tile_grad 新增了 fp16,前向/反向 dtype 支持存在不一致 |
| 🟡 建议 | paddle/phi/kernels/xpu/tile_grad_kernel.cc |
缺少 test/xpu/ 下的回归测试 |
📝 PR 规范检查
PR 标题 [XPU] Tag 不在 checklist §D1 标准枚举中(应来自 PR Category 或 PR Types)。建议使用如下标准格式:
标题建议(可直接复制):
[Operator Mechanism] Fix paddle.tile fp16 gradient error on XPU
PR 描述四个必填 section 均存在且内容完整,结构合规,无需修改。
总体评价
整体方案合理,与 GPU tile_grad fp16 行为对齐(cast to fp32 → reduce → cast back)。XPU3 的前向/反向 fp16 支持不一致点需要作者确认是否符合预期;建议在 test/xpu/ 添加 fp16 tile 梯度回归用例以防后续回归。
| XPUKernelSet({FLOAT32, INT32, INT64, FLOAT16, BFLOAT16, BOOL})}, | ||
| {"tile", XPUKernelSet({INT32, INT64, BOOL, FLOAT64, FLOAT32, BFLOAT16})}, | ||
| {"tile_grad", XPUKernelSet({FLOAT32, BFLOAT16})}, | ||
| {"tile_grad", XPUKernelSet({FLOAT32, FLOAT16, BFLOAT16})}, |
There was a problem hiding this comment.
🟡 建议 XPU3 的 tile 前向算子不支持 FLOAT16(tile XPU3 支持列表为 {INT32, INT64, BOOL, FLOAT64, FLOAT32, BFLOAT16},无 FLOAT16),但此处为 tile_grad 在 XPU3 上新增了 FLOAT16 支持。
若 XPU3 上 tile 前向不支持 fp16,反向理论上不会以 fp16 被调用。建议同步确认:
- XPU3 是否计划支持 fp16 的 tile 前向(若是,应同步补充 xpu3_op_list.cc 中
tile的 FLOAT16)。 - 若 XPU3 暂不支持 fp16 tile 前向,此处注册 tile_grad fp16 是否有必要(或留作预留注册)。
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
This PR fixes an XPU
paddle.tileerror for fp16 gradient execution. The XPUtile_gradkernel previously omitted fp16 registration, while the forward tile kernel supports fp16 and GPU tile gradient supports fp16 by accumulating in fp32.paddle.tile
tile_gradkernel.out_gradto fp32, reduces in fp32, and casts the result back to fp16 to align with GPU behavior.tile_grad.Validation: all 805
paddle.tilecases from/workspace/PaddleAPITest/all_config.txtpassed XPU vs GPU verification.是否引起精度变化
否