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

【静态图性能优化】Event analysis 共享 #55588

Closed
wants to merge 32 commits into from

Conversation

AndSonder
Copy link
Contributor

@AndSonder AndSonder commented Jul 20, 2023

PR types

Performance optimization

PR changes

Others

Description

复用信息分析:

在Paddle中,事件分析器(event analyzer)发生在Convert过程中。事件分析器的主要作用是为不同op的执行添加Event进行同步,便于后续并行。对于一样的子图,事件分析器分析的结果是一样的,因此可以进行复用。

事件分析器依赖于图依赖分析的结果,其核心逻辑在 stream_analyzer_.ConstructEvents 中实现。主要逻辑是通过Instruction的 AddEventToRecord 和 AddEventToWait 完成。分析的结果也是存储在vec_instruction_当中。

代码实现思路:

事件分析器的复用与op依赖复用类似,且vec_instruction_在op依赖复用中已进行复用。是否能共享的相关逻辑也与op依赖复用相同。因此在实现了op依赖的复用后只需要添加共享后跳过事件分析部分的代码即可。

对于跳过共享相关的逻辑可以通过判断vec_instruction_里Instruction的event_to_record_和events_to_wait_是否有数据来判断。

详细介绍见Issue:

@paddle-bot
Copy link

paddle-bot bot commented Jul 20, 2023

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

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Jul 20, 2023
@AndSonder
Copy link
Contributor Author

当下的实现方案是将 event_to_record_events_to_wait_ 共享,但是这样可能会导致一些Instruction产生多余的等待,因此本PR迁移到 #55650 中继续完成,将方案修改为共享Event分析的结果,每个Instruction独立构造Event。

@AndSonder AndSonder closed this Jul 24, 2023
@AndSonder AndSonder deleted the share_event_analyzer branch April 23, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant