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

[D2SCinn]Fix self.infer_program always build cinn pass without cache #49696

Merged
merged 2 commits into from
Jan 11, 2023

Conversation

Aurelius84
Copy link
Contributor

PR types

Function optimization

PR changes

APIs

Describe

优化了 self.infer_program 在每次被调用时都会重复的_build_infer_program,导致性能下降。

将_build_infer_program 逻辑下放到 self._XX 函数中。因为已经提供了self._create_XXX_program接口获取原生的program,因此此处采取了当前方案。

@paddle-bot
Copy link

paddle-bot bot commented Jan 10, 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.

@@ -280,23 +280,32 @@ def _train_program(self):

@LazyInitialized
def _infer_program(self):
return self._create_program(is_infer_mode=True)
program = self._create_program(is_infer_mode=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

若内部开发者想获取原生program,可以调用self._create_program

zhangbo9674
zhangbo9674 previously approved these changes Jan 10, 2023
Copy link
Contributor

@zhangbo9674 zhangbo9674 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -317,62 +346,6 @@ def _train_pure_fp16_forward_backward_program(self):
program = self._create_forward_backward_train_pure_fp16_program()
return program

@property
def whole_program(self):
if self.training:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

删除了此接口,与program重复了

return names

@property
def whole_program_id(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

删除了此接口,与program_id重复了

Copy link
Contributor

@0x45f 0x45f left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@zhangbo9674 zhangbo9674 left a comment

Choose a reason for hiding this comment

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

LGTM

@Aurelius84 Aurelius84 merged commit 18a7e13 into PaddlePaddle:develop Jan 11, 2023
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.

3 participants