You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
你的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.
SigureMo
changed the title
[WIP][Dy2St][AMP] add should_auto_cast attribute for each operator
[Dy2St][AMP] add should_auto_cast attribute for each operator
Nov 9, 2023
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
New features
PR changes
Others
Description
为 Operator 增加
should_auto_cast
属性,该属性的语义是在全局开启 AMP 的情况下,该 OP 是否应该被 cast,如果全局没有开启 AMP,该属性无效此为局部 AMP 在旧 IR 下的临时方案,新 IR 会有其他的动静统一的长期方案来做,在旧 IR 退场时可以直接删掉
Usage
在动转静之后拿到 Program 时,根据组网时期记录的局部 AMP 信息
ProgramTranslator.get_instance()._amp_records
,调用prepare_op_should_auto_cast
传入Program
和该 records,此时所有 OP 都会有should_auto_cast
属性,之后可根据此属性在后续 PASS 进行 cast,具体示例可参考test/dygraph_to_static/test_local_cast.py
目前组网时会记录完整的 AmpOptions,但 prepare 仅仅处理了其中的 enable,如果后续有更复杂的需求再考虑将所有 options set 上去
PCard-66972