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

Add FLAGS_low_precision_op_list to get amp list of current module #48843

Merged
merged 1 commit into from
Dec 21, 2022

Conversation

AnnaTrainingG
Copy link
Contributor

@AnnaTrainingG AnnaTrainingG commented Dec 7, 2022

PR types

Others

PR changes

Others

Describe

新增AMP lIst成员,用于记录当前模型中运行的amp算子
添加 export FLAGS_low_precision_op_list=1 环境变量控制低精度OP列表的统计,当 FLAGS_low_precision_op_list=1 时开始统计当前模型中使用amp计算的算子,否则不统计.(说明:当前FLAG在后续开发完正式接口后会删除
用法
1.开启环境变量:FLAGS_low_precision_op_list=1
2.在模型最后加入: paddle.fluid.dygraph.amp.auto_cast.low_pricision_op_list()
将会打印对应的低精度OP列表
image

@paddle-bot
Copy link

paddle-bot bot commented Dec 7, 2022

你的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.

@AnnaTrainingG AnnaTrainingG changed the title Amp op list Add amp list for current module Dec 7, 2022
@zhangting2020
Copy link
Contributor

zhangting2020 commented Dec 7, 2022

  • 需要加一个开关,只在调试模式下才记录低精度算子
  • 低精度的算子还需要考虑dtype的类型,float16或者bfloat16

@AnnaTrainingG
Copy link
Contributor Author

需要加一个开关,只在调试模式下才记录低精度算子 -> 开关已加
低精度的算子还需要考虑dtype的类型,float16或者bfloat16 -> 这个可以直接使用controller中的amp_type

@AnnaTrainingG AnnaTrainingG force-pushed the amp_op_list branch 3 times, most recently from 64a8e99 to b8743d3 Compare December 14, 2022 01:56
zkh2016
zkh2016 previously approved these changes Dec 20, 2022
zhangting2020
zhangting2020 previously approved these changes Dec 20, 2022
@@ -2543,6 +2543,10 @@ All parameter, weight, gradient are variables in Paddle.
m.def("update_autotune_status",
[] { return phi::autotune::AutoTuneStatus::Instance().Update(); });

m.def("get_low_pricision_op_list", [] {
Copy link
Contributor

Choose a reason for hiding this comment

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

pricision -> precision,下面还有几处拼写错误。下个PR改吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经修改

# amp list elementwise_add, cast
with paddle.amp.auto_cast():
c = a + b
paddle.fluid.dygraph.amp.auto_cast.low_pricision_op_list()
Copy link
Contributor

Choose a reason for hiding this comment

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

单测可以加上对结果正确性的判断,避免后续将功能改坏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经修改

Copy link
Contributor

@lanxianghit lanxianghit left a comment

Choose a reason for hiding this comment

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

LGTM

@AnnaTrainingG AnnaTrainingG changed the title Add amp list for current module Add FLAGS_low_precision_op_list to get amp list of current module Dec 21, 2022
@AnnaTrainingG AnnaTrainingG merged commit 195736c into PaddlePaddle:develop Dec 21, 2022
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.

4 participants