Thanks to visit codestin.com
Credit goes to github.com

Skip to content

disable kernel promotion for amp training#5922

Merged
JunnYu merged 3 commits into
PaddlePaddle:developfrom
zhangting2020:promote
Jun 6, 2023
Merged

disable kernel promotion for amp training#5922
JunnYu merged 3 commits into
PaddlePaddle:developfrom
zhangting2020:promote

Conversation

@zhangting2020

Copy link
Copy Markdown
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

paddle-bot Bot commented May 15, 2023

Copy link
Copy Markdown

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

codecov Bot commented May 17, 2023

Copy link
Copy Markdown

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

@JunnYu JunnYu left a comment

Copy link
Copy Markdown
Member

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