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

[opt] [async] Fix constant folding in async mode #2034

Merged
merged 9 commits into from
Nov 8, 2020

Conversation

xumingkuan
Copy link
Contributor

Related issue = #954 #2032

Kernel::Kernel() does not support multi-threads unless we lock the following part with a mutex:

  taichi::lang::context = std::make_unique<FrontendContext>();
  ir = taichi::lang::context->get_root();

  {
    CurrentKernelGuard _(program, this);
    program.start_function_definition(this);
    func();
    program.end_function_definition();
    ir->as<Block>()->kernel = this;
  }

This PR simply locks get_jit_evaluator_kernel() monolithically to prevent two threads from calling Kernel::Kernel() concurrently.

[Click here for the format server]


Comment on lines +215 to +217
TI_TRACE("Synchronizing SFG of {} nodes ({} pending)", sfg->size(),
sfg->num_pending_tasks());
debug_sfg("initial");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Off-topic change: num_pending_tasks() matches the following Ended up with {} nodes better.

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, thanks!


I'll merge to see if this fixes problems on my end.

@codecov
Copy link

codecov bot commented Nov 8, 2020

Codecov Report

Merging #2034 (59bdedc) into master (3e2d3e6) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2034   +/-   ##
=======================================
  Coverage   43.54%   43.54%           
=======================================
  Files          45       45           
  Lines        6267     6267           
  Branches     1110     1110           
=======================================
  Hits         2729     2729           
  Misses       3366     3366           
  Partials      172      172           

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 3e2d3e6...59bdedc. Read the comment docs.

@k-ye k-ye merged commit 980886e into taichi-dev:master Nov 8, 2020
@xumingkuan xumingkuan deleted the fix-fuse-dense branch November 8, 2020 14:52
@yuanming-hu yuanming-hu mentioned this pull request Nov 11, 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