-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Dy2St] pir dy2st unittest verification - Part 1 #58630
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
Conversation
…ode.PIR_AST` -> `IrMode.PIR_EXE`
|
你的PR提交成功,感谢你对开源项目的贡献! |
| logger.info("[PIR][AST] running pir api") | ||
| ir_outs = None | ||
| try: | ||
| import paddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import paddle 能不能放在文件顶端呢
|
|
||
| with paddle.pir_utils.IrGuard(): | ||
| paddle.disable_static() | ||
| with sot_mode_guard(False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 sot_mode_guard 可以删掉了,因为之前考虑的是 PIR_AST 是与 SOT 互斥的,但修改后放到 IR mode 里两者其实是可以组合的
如果暂时不需要测最终态 + SOT,那么可以在组合的时候 skip 掉这种情况,就 194 行刚删掉的那部分逻辑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
2742195759
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| logger.info("[PIR][AST] running pir api") | ||
| ir_outs = None | ||
| try: | ||
| with paddle.pir_utils.IrGuard(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以试验尝试一下,先使用Program组网,然后使用pir::Program组网,结果是否正确。
| IR_HANDLER_MAP = { | ||
| IrMode.LEGACY_IR: to_legacy_ir_test, | ||
| IrMode.PIR: to_pir_test, | ||
| IrMode.PIR_EXE: to_pir_test, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_pir_exe_test
| IrMode.LEGACY_IR: to_legacy_ir_test, | ||
| IrMode.PIR: to_pir_test, | ||
| IrMode.PIR_EXE: to_pir_test, | ||
| IrMode.PIR_API: to_pir_ast_test, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_pir_api_test
SigureMo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

PR types
Others
PR changes
Others
Description
背景
从流程图的
dy2st开始垂直向下为早期legacy IR形成的动转静模式。在现阶段如果想要执行
PIR executor需要经过一层ProaramTranslator转写。我们的目标就是让他使用一套完整的
PIR dy2st, 我们也称之为最终态(理想态), 也就是右侧PIR dy2st垂直向下的部分。graph TB A[dy2st] --> B[legacy static APi branch] B --> C[legacy IR] C --> D[legacy IR executor] E[PIR dy2st] --> F[PIR static API branch] F --> G[PIR] G --> H[PIR executor] C -->|ProaramTranslator| G目标
从背景可以看出我们目前需要支持的单测有三种 IR 工作模式, 以及两种 dy2st 模式。
这样组合之后我们就能得到新机制需要运行的单测组合: 2*3=6 (如下图)
graph TB A[SOT] --> B[legacy IR] A --> C[PIR EXE] A --> D[PIR API] E[AST] --> B E[AST] --> C E[AST] --> D修改
原有机制会对
ToStaticMode.PIR_AST和IrMode.LEGACY_IR进行组合, 这明显不合理, 我们不可能在一个执行器中跑两套 IR 模式所以首先对组合模式进行了修改,将
ToStaticMode.PIR_AST模式下沉至IrMode.PIR_EXE, 这样我们就能对不同动转静模式和 IR 模式进行组合测试PIR_EXE对应的就是走的ProaramTranslator达到运行PIR executor模式。PIR_API对应的就是走的全 PIR 模式, 也就是我们的最终态。test_legacy_and_pir_api和test_legacy_and_pir_api_and_pir_exe装饰器任务列表: #58633