Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XPU] prepare ut for bf16 #59389

Merged
merged 7 commits into from Nov 29, 2023
Merged

Conversation

houj04
Copy link
Contributor

@houj04 houj04 commented Nov 27, 2023

PR types

Others

PR changes

Others

Description

为XPU下面的bfloat16单测做准备:

  • 增加mean算子的注册类型,因为:
    • (1)paddle/phi/kernels/reduce_mean_kernel.cc里面已经有了bfloat16的注册;
    • (2)在op_test_xpu.py里面有调用mean_grad_op_types = get_xpu_op_support_types('mean'),根据不同结果,会走不同的计算逻辑。在单测中,float16和bfloat16没啥本质区别,都属于“非float32”的浮点型。
  • op_test_xpu.py里面有个针对float16的特殊处理,本PR增加了对bfloat16的特殊处理,并大幅缩小这个检查阈值(不知道前一个版本中为什么放1.0这么大的数)。先拍一个0.1放在这里,后续如有需求再调整。
  • test_adamw_op_xpu.py里面有个地方用了self.in_type_str,在bfloat16的时候会报错,因此改成了self.in_type

其它:

  • 顺手修改了paddle/phi/kernels/funcs/tensor_formatter.cc,增加对float16和bfloat16的支持。要不然用它来调试的时候,会提示“unprintable type”。为了能过覆盖率检查,修改了PrintOp的GPU单测。

Copy link

paddle-bot bot commented Nov 27, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Nov 27, 2023
@XiaociZhang
Copy link
Contributor

LGTM

@houj04 houj04 merged commit b22b879 into PaddlePaddle:develop Nov 29, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants