disable kernel promotion for amp training #5922
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Performance optimizationPR changes
ModelsDescription
背景:过去框架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