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

[async] Faster SFG rebuilding #2069

Merged
merged 4 commits into from
Nov 29, 2020
Merged

Conversation

yuanming-hu
Copy link
Member

@yuanming-hu yuanming-hu commented Nov 29, 2020

Related issue = #742

This PR avoids the relatively expensive std::variant<...>::operator==.
We also adjust the order of optimize_listgen and demote_activation so that more list generations can be removed in the first iteration.

Before:

  • synchronize: 5.935
    • rebuild_graph in optimize_listgen: 1.668

After (1.38x faster):

  • synchronize: 4.281
    • rebuild_graph in optimize_listgen: 0.799

[Click here for the format server]


benchmark rebuild graph

benchmark rebuild graph script

better profile

reproduce 741 ns

684 ns

std::variant operator== takes 60ns...

clean

1578->1121 ns

1121 ns-> 1092 ns

vtune
@@ -63,6 +66,13 @@ std::string AsyncState::name() const {
return prefix + "_" + type_name;
}

std::size_t AsyncState::get_unique_id(void *ptr, AsyncState::Type type) {
Copy link
Member Author

@yuanming-hu yuanming-hu Nov 29, 2020

Choose a reason for hiding this comment

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

This will be replaced with a more compact version (ranging in [0, ~1000)) in the next PR.

@@ -121,6 +123,8 @@ struct AsyncState {
const SNode *snode() const {
return std::get<SNode *>(snode_or_global_tmp);
}

static std::size_t get_unique_id(void *ptr, Type type);
Copy link
Member Author

Choose a reason for hiding this comment

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

This will be replaced in the next PR.

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.

Great LGTM!

@yuanming-hu yuanming-hu merged commit b31111d into taichi-dev:master Nov 29, 2020
@yuanming-hu yuanming-hu deleted the fast-rebuild branch November 29, 2020 19:55
@yuanming-hu yuanming-hu mentioned this pull request Nov 30, 2020
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