Skip to content

Conversation

zhangbo9674
Copy link
Contributor

@zhangbo9674 zhangbo9674 commented Nov 3, 2023

PR types

Performance optimization

PR changes

Others

Description

Performance optimization for program interpreter:静态化 CheckGC 的部分逻辑

Pcard-67164

Copy link

paddle-bot bot commented Nov 3, 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.

@@ -313,5 +313,47 @@ void Instruction::AddInplace(Variable* in, Variable* out) {

void Instruction::ClearInplace() { vec_inplace_in_to_out_.clear(); }

#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
void Instruction::UpdataRecordStreamForGcInfo() {
bool is_interpreter_fast_gc_enabled =
Copy link
Contributor

Choose a reason for hiding this comment

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

这里为什么不直接调用IsInterpretercoreFastGCEnabled,而要把相关的判断逻辑代码拷贝一份?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

考虑到这个函数只是两个 flags 的判断,为了减少一个函数的调度,就直接在这里拷贝了一份逻辑

// record stream for gc
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
bool need_record_stream_for_gc_ = false;
gpuStream_t record_stream_for_gc_;
Copy link
Contributor

Choose a reason for hiding this comment

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

record_stream_for_gc_命名比较拗口,且和函数名RecordStreamForGC容易混淆。这里需要存储在Instruction中的本质上是分配给该OP的运行stream,可否直接命名为stream?另外建议将其初始化为空。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done,tks

Copy link
Contributor

@From00 From00 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhangbo9674 zhangbo9674 merged commit 4bf839a into PaddlePaddle:develop Nov 7, 2023
jiahy0825 pushed a commit to jiahy0825/Paddle that referenced this pull request Nov 7, 2023
zeroRains pushed a commit to zeroRains/Paddle that referenced this pull request Nov 8, 2023
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
SecretXV pushed a commit to SecretXV/Paddle that referenced this pull request Nov 28, 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.

2 participants