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

disable kernel promotion for amp training #5922

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

zhangting2020
Copy link
Contributor

PR types

Performance optimization

PR changes

Models

Description

背景:过去框架AMP在O2模式下,当OP支持低精度就会选择低精度的kernel,但这样的策略出现精度问题的风险较高。为保障训练精度,框架在2.5版本对AMP 策略进行了调整,即在O2模式下,仅当Op所有输入为低精度时才会选择低精度kernel,否则则采用FP32 Kernel(即promote的策略),因此可能会引起部分模型出现性能下降。

目前可以通过给auto_cast设置use_promote=False参数来回退到旧版本的O2策略,为了减少对模型配置的修改,本PR给模型库添加该参数的设置功能,当前模型库默认设置为use_promote=False,使用的是旧版本的O2策略,以解决性能下降问题。

PaddlePaddle框架动态图下默认的行为是use_promote=True,未来新增的模型如果出现精度问题,可以尝试给模型配置中增加设置去进行调试。

框架PR:PaddlePaddle/Paddle#53742

@paddle-bot
Copy link

paddle-bot bot commented May 15, 2023

Thanks for your contribution!

@zhangting2020 zhangting2020 force-pushed the promote branch 2 times, most recently from 4c61cde to ec38311 Compare May 17, 2023 07:17
@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Merging #5922 (2fe8bff) into develop (d066460) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #5922      +/-   ##
===========================================
- Coverage    63.52%   63.52%   -0.01%     
===========================================
  Files          514      514              
  Lines        73605    73607       +2     
===========================================
- Hits         46761    46760       -1     
- Misses       26844    26847       +3     

see 3 files with indirect coverage changes

fightfat
fightfat previously approved these changes May 29, 2023
Copy link
Member

@JunnYu JunnYu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JunnYu JunnYu merged commit e831abd into PaddlePaddle:develop Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants