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

【Hackathon 4th No.54】为 Paddle allclose、isclose 算子实现 float16 数据类型支持 #50900

Closed

Conversation

AndPuQing
Copy link
Contributor

PR types

New features

PR changes

OPs

Describe

allclose before after
Case No. input_shape fp32(ms) fp16(ms) fp32(ms) fp16(ms)
0 [16,10,100] 3.9588 3.923 4.0632 4.5353
1 [16, 256, 10, 10] 11.5456 9.1728 9.0451 6.6540
2 [100,100,100] 18.3031 17.8495 11.3204 10.9800
isclose before after
Case No. input_shape fp32(ms) fp16(ms) fp32(ms) fp16(ms)
0 [1700971,1] 12.2054 11.5510 11.6839 12.3301
1 [17009,100] 13.7947 13.3367 12.0218 12.5707

优化思路

  • 将输入 tensor 的元素加载到共享内存中,然后在共享内存上进行比较。这种方法将减少全局内存访问次数,从而提高访问效率。(但是对于小数量可能反而会增加线程同步的开销,导致性能下降)
  • 输入 tensor 只读。添加 __restrict__ 关键字,编译器就可以更好地对代码进行优化

@paddle-bot
Copy link

paddle-bot bot commented Feb 25, 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 contributor External developers status: proposed labels Feb 25, 2023
@luotao1
Copy link
Contributor

luotao1 commented Mar 10, 2023

close due to the following PR is merged:

@luotao1 luotao1 closed this Mar 10, 2023
@AndPuQing AndPuQing deleted the patch-allclose-isclose branch March 20, 2023 07:40
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

5 participants