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

[ir] Basic function definition/call instructions #612

Merged
merged 5 commits into from
Mar 28, 2020

Conversation

archibate
Copy link
Collaborator

Related issue id = #602

@archibate
Copy link
Collaborator Author

archibate commented Mar 18, 2020

好累啊…taichi/ir/ir.h的修改总是导致很长时间的编译,69个文件#include了它,能否将其拆分成不同部分?如taichi/ir/ir_frontend.h

@archibate
Copy link
Collaborator Author

当前我们只有一个kernel offload,如何插入新的offload为了FrontendFuncDefStmt?

@yuanming-hu
Copy link
Member

好累啊…taichi/ir/ir.h的修改总是导致很长时间的编译,能否将其拆分成不同部分?如taichi/ir/ir_frontend.h

"Modifying a low-level header causes a recompilation of every cpp file that depends on it" is something notorious about C++. Maybe a more fundamental solution is to improve compilation speed in general. Currently, we have too many stuff in the headers (which gets recompiled over and over again) - maybe we should move these to the cpp files.

Btw do you use WeChat? Do you mind emailing me ([email protected]) your WeChat id?

@yuanming-hu
Copy link
Member

当前我们只有一个kernel offload,如何插入新的offload为了FrontendFuncDefStmt?

I guess it's better to store FrontendFuncDefStmt at the top level - I.e., the same level as OffloadedStmt.

@archibate
Copy link
Collaborator Author

当前我们只有一个kernel offload,如何插入新的offload为了FrontendFuncDefStmt?

I guess it's better to store FrontendFuncDefStmt at the top level - I.e., the same level as OffloadedStmt.

Sounds reasonable, but where is OffloadedStmt stored? Can't find OffloadedStmt creation anywhere in export_lang. Isn't it done until lowering AST?

@yuanming-hu
Copy link
Member

当前我们只有一个kernel offload,如何插入新的offload为了FrontendFuncDefStmt?

I guess it's better to store FrontendFuncDefStmt at the top level - I.e., the same level as OffloadedStmt.

Sounds reasonable, but where is OffloadedStmt stored? Can't find OffloadedStmt creation anywhere in export_lang. Isn't it done until lowering AST?

It's stored at the root level. Note that OffloadedStmt is created only after the offload pass, so in the frontend, it's not visible...

@archibate
Copy link
Collaborator Author

Currently, we have too many stuff in the headers (which gets recompiled over and over again) - maybe we should move these to the cpp files.

Move some into cpp means no longer keep sync with defs in h? I still want to make ir_xxx.h's..

Btw do you use WeChat? Do you mind emailing me ([email protected]) your WeChat id?

Email sent, hopefully gmail won't be forbidden by tianchao GFW.

@archibate
Copy link
Collaborator Author

archibate commented Mar 18, 2020

当前我们只有一个kernel offload,如何插入新的offload为了FrontendFuncDefStmt?

I guess it's better to store FrontendFuncDefStmt at the top level - I.e., the same level as OffloadedStmt.

Sounds reasonable, but where is OffloadedStmt stored? Can't find OffloadedStmt creation anywhere in export_lang. Isn't it done until lowering AST?

It's stored at the root level. Note that OffloadedStmt is created only after the offload pass, so in the frontend, it's not visible...

So I should modify offload.cpp?
Our inserted-to-roots seems will fallback here:

pending_serial_statements->body->insert(std::move(stmt));

Can translate to FunctionDefStmt here.

@yuanming-hu
Copy link
Member

Just a minute. I'm updating #602 to make things clear...

@archibate archibate requested a review from yuanming-hu March 26, 2020 03:48
@archibate archibate self-assigned this Mar 26, 2020
@archibate archibate changed the title real function support rather than force inline [IR] real function support rather than force inline Mar 26, 2020
@yuanming-hu
Copy link
Member

I'll merge this in for now, but I suggest that we first come up with a detailed implementation plan before we start coding on this issue again.

@yuanming-hu yuanming-hu changed the title [IR] real function support rather than force inline [ir] Basic function definition/call instructions Mar 28, 2020
@yuanming-hu yuanming-hu merged commit 675338b into taichi-dev:master Mar 28, 2020
archibate added a commit to archibate/taichi that referenced this pull request Mar 31, 2020
* [skip ci] add FuncBodyStmt

* add FrontendFuncDefStmt & begin_func/end_func

* function using scope_stack & real func_call

* [skip ci] enforce code format

* Update TaichiCore.cmake

Co-authored-by: Taichi Gardener <[email protected]>
Co-authored-by: Yuanming Hu <[email protected]>
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