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

[CINN][Backend Pass Update No.13] Update UpdateBufferAxis pass #70533

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Albresky
Copy link
Contributor

PR Category

CINN

PR Types

Improvements

Description

改造了 UpdateBufferAxis

Copy link

paddle-bot bot commented Dec 28, 2024

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

Comment on lines 298 to 299
AnalyzeBufferAxis analyzeBufferAxis;
analyzeBufferAxis(block);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里注意遵守变量命名规范,保持buffer_axis_analyzer即可

@Albresky Albresky force-pushed the cinn-pass-update_buffer_axis branch from 8f62f90 to 04b82bf Compare January 2, 2025 07:00
Comment on lines 86 to 90
if (stmt->bind_info().valid()) {
var_bind_threads.insert(stmt->loop_var()->name);
StmtMutator::VisitBlock(stmt->body());
var_bind_threads.erase(stmt->loop_var()->name);
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里为什么不使用is_gpu_thread_binded()呢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

之前没发现Stmt的For继承了Forbase,我后面改一下

Comment on lines +75 to +76
class AnalyzeBufferAxis : public ir::IRMutator<>,
public ir::stmt::StmtMutator<> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Analyze阶段使用StmtVisitor就可以了,这里没有mutate

@Albresky Albresky force-pushed the cinn-pass-update_buffer_axis branch 2 times, most recently from 5101d54 to cad554d Compare January 6, 2025 07:20
@Albresky Albresky force-pushed the cinn-pass-update_buffer_axis branch from d173a55 to ecbd3b5 Compare January 8, 2025 04:19
Comment on lines 86 to 90
if (stmt->bind_info().valid()) {
var_bind_threads.insert(stmt->loop_var()->name);
StmtMutator::VisitBlock(stmt->body());
var_bind_threads.erase(stmt->loop_var()->name);
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

之前没发现Stmt的For继承了Forbase,我后面改一下

return;
}
FormalizeSingleIndex(tensor, &(store->indices));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Hongqing-work
之前的实现里面,有调用 FormalizeSingleIndex 更新 store 的 indices,我理解的是这里是应该继承 StmtMutator?

Copy link
Contributor

Choose a reason for hiding this comment

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

嗯嗯,那目前还应该需要继承一下,后续IndexExpr能自动化简之后可以修改一下 @liuruyan

if (!tensor->buffer.defined() ||
tensor->buffer->memory_type == ir::MemoryType::Heap) {
ir::IRMutator<>::Visit(op, expr);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里应该还是得继续Visit一下其它Expr,store的value里应该会有load

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants