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

[Refactor] [ir] Move statements from ir.h to statements.h #1898

Merged
merged 7 commits into from Sep 26, 2020

Conversation

xumingkuan
Copy link
Collaborator

@xumingkuan xumingkuan commented Sep 26, 2020

Related issue = #933

Changes:

  • Move all XxxStmt from ir.h to statements.h;
  • Move all implementations of frontend statements from ir.cpp to frontend_ir.cpp;
  • Remove #include "statements.h" from visitors.h.

Something that may be useful to reduce the compilation time of the Taichi compiler but I don't know how to do:

  • We need OffloadedStmt::TaskType in some files (async_utils.h for example). For now, we can only include statements.h, which includes ir.h. statements.h needs ir.h because it needs the implementation of Stmt, which also needs the implementation of IRNode. However, ir.h may become too short if even IRNode is in statements.h. So shall we separate OffloadedStmt::TaskType in a light-weighted file which doesn't need statements.h?

[Click here for the format server]


Copy link
Member

@k-ye k-ye left a comment

Choose a reason for hiding this comment

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

LGTM!

So shall we separate OffloadedStmt::TaskType in a light-weighted file which doesn't need statements.h

+N on this

@codecov
Copy link

codecov bot commented Sep 26, 2020

Codecov Report

Merging #1898 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1898   +/-   ##
=======================================
  Coverage   43.81%   43.81%           
=======================================
  Files          45       45           
  Lines        6174     6174           
  Branches     1097     1097           
=======================================
  Hits         2705     2705           
  Misses       3300     3300           
  Partials      169      169           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d266c0f...de9f18c. Read the comment docs.

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.

Awesome!!

So shall we separate OffloadedStmt::TaskType in a light-weighted file which doesn't need statements.h

+N on this

Maybe we can create an ir_fwd.h file that contains all the existing forward declarations

taichi/taichi/ir/ir.h

Lines 20 to 34 in d266c0f

class IRBuilder;
class IRNode;
class Block;
class Stmt;
using pStmt = std::unique_ptr<Stmt>;
class SNode;
class ScratchPads;
using ScratchPadOptions = std::vector<std::pair<int, SNode *>>;
#define PER_STATEMENT(x) class x;
#include "taichi/inc/statements.inc.h"
#undef PER_STATEMENT
IRBuilder &current_ast_builder();

and a new OffloadedTaskType (which used to be OffloadedStmt::TaskType)?

@yuanming-hu yuanming-hu merged commit 04abab5 into taichi-dev:master Sep 26, 2020
@yuanming-hu yuanming-hu mentioned this pull request Sep 26, 2020
@k-ye
Copy link
Member

k-ye commented Sep 28, 2020

and a new OffloadedTaskType (which used to be OffloadedStmt::TaskType)?

SGTM! (But i'd suggest to separate OffloadedTaskType from ir_fwd.h... I think it's even fine to have a header just for this type)

@xumingkuan xumingkuan deleted the refactor-ir branch October 12, 2020 08:49
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