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][refactor] First step to move Frontend IR to its own file #914

Merged
merged 2 commits into from May 3, 2020

Conversation

k-ye
Copy link
Member

@k-ye k-ye commented May 3, 2020

In this PR, I just moved FrontendAllocaStmt to a new file frontend_ir.h. If this looks OK, I will move all the other Frontend*Stmt (maybe *Expression as well ?)

Related issue = #689

[Click here for the format server]

Copy link
Member

@yuanming-hu yuanming-hu left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! And yes, let's move the Expressions as well. The expressions are only useful in the frontend before lower_ast. Not sure if we should create a separate file for the Expressions, but you should clearly have better judgment than I do! :-)

@k-ye k-ye changed the title [ir][refactor] First step to move Frontendd IR to its own file [ir][refactor] First step to move Frontend IR to its own file May 3, 2020
@k-ye
Copy link
Member Author

k-ye commented May 3, 2020

Not sure if we should create a separate file for the Expressions

Cool! Not sure either, but I don't see an immediate need for separate Frontend Stmt and Expressions, so I will go with one file...

@yuanming-hu
Copy link
Member

Sounds good! Given the current code structure, I don't think separating Exprs and Stmts is an easy job anyway...

@k-ye
Copy link
Member Author

k-ye commented May 3, 2020

Will create another PR for the rest of the works..

@k-ye k-ye merged commit ad6fcbf into taichi-dev:master May 3, 2020
@k-ye k-ye deleted the f1 branch May 3, 2020 01:59
Copy link
Collaborator

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -7,6 +7,7 @@
#include <unordered_map>

#include "taichi/ir/frontend.h"
#include "taichi/ir/frontend_ir.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this is necessary after we move all Frontend*Stmts to their own file.

Copy link
Member Author

@k-ye k-ye May 4, 2020

Choose a reason for hiding this comment

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

I guess they have to be around for a while, since currently there are some legacy stuff referring to the Frontend stmts, e.g.

taichi/taichi/ir/ir.cpp

Lines 933 to 941 in 4d228b9

For::For(const ExprGroup &i,
const Expr &global,
const std::function<void()> &func) {
auto stmt_unique = std::make_unique<FrontendForStmt>(i, global);
auto stmt = stmt_unique.get();
current_ast_builder().insert(std::move(stmt_unique));
auto _ = current_ast_builder().create_scope(stmt->body);
func();
}

I think once these legacy constructs are removed, then it should be fine to remove this dependency..

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.

None yet

4 participants