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] Classify tasks to make fusion 10.6x faster #1887

Merged
merged 10 commits into from Sep 23, 2020

Conversation

xumingkuan
Copy link
Collaborator

@xumingkuan xumingkuan commented Sep 21, 2020

Related issue = #742

Benchmark: async_mgpcg.py, taichi::lang::StateFlowGraph::fuse:
Before: 2.815 s
At commit 691f706: 520.011 ms
At commit 3c78343: 332.199 ms
At commit 42da16c: 283.921 ms
At commit 366af3d (buggy): 197.838 ms
At commit 826d053: 241.768 ms
After (at commit 6e6892f): 152.634 ms

On kun: ~1.03s -> ~97ms (10.6x faster)

The following statistics may change even at the same commit...
Without fusion:

codegen_accessor_statements: 20.00
codegen_evaluator_statements: 79.00
codegen_kernel_statements: 4224.00
codegen_offloaded_tasks: 117.00
codegen_statements  : 4323.00
launched_tasks      : 5034.00
launched_tasks_compute: 4990.00
launched_tasks_list_gen: 44.00
launched_tasks_list_op: 44.00
launched_tasks_range_for: 1.00
launched_tasks_serial: 106.00
launched_tasks_struct_for: 4883.00

With fusion (before this PR):

codegen_accessor_statements: 20.00
codegen_evaluator_statements: 79.00
codegen_kernel_statements: 4529.00
codegen_offloaded_tasks: 101.00
codegen_statements  : 4628.00
launched_tasks      : 4891.00
launched_tasks_compute: 4847.00
launched_tasks_list_gen: 44.00
launched_tasks_list_op: 44.00
launched_tasks_range_for: 1.00
launched_tasks_serial: 37.00
launched_tasks_struct_for: 4809.00

With fusion (at commit 691f706):

codegen_accessor_statements: 20.00
codegen_evaluator_statements: 79.00
codegen_kernel_statements: 4493.00
codegen_offloaded_tasks: 98.00
codegen_statements  : 4581.00
launched_tasks      : 4889.00
launched_tasks_compute: 4845.00
launched_tasks_list_gen: 44.00
launched_tasks_list_op: 44.00
launched_tasks_range_for: 1.00
launched_tasks_serial: 35.00
launched_tasks_struct_for: 4809.00

With fusion (at commit 42da16c):

codegen_accessor_statements: 20.00
codegen_evaluator_statements: 79.00
codegen_kernel_statements: 4399.00
codegen_offloaded_tasks: 94.00
codegen_statements  : 4498.00
launched_tasks      : 4880.00
launched_tasks_compute: 4836.00
launched_tasks_list_gen: 44.00
launched_tasks_list_op: 44.00
launched_tasks_range_for: 1.00
launched_tasks_serial: 26.00
launched_tasks_struct_for: 4809.00

With fusion (at commit 366af3d):

codegen_accessor_statements: 20.00
codegen_evaluator_statements: 79.00
codegen_kernel_statements: 4397.00
codegen_offloaded_tasks: 93.00
codegen_statements  : 4496.00
launched_tasks      : 4879.00
launched_tasks_compute: 4835.00
launched_tasks_list_gen: 44.00
launched_tasks_list_op: 44.00
launched_tasks_range_for: 1.00
launched_tasks_serial: 25.00
launched_tasks_struct_for: 4809.00

With fusion (at commit 826d053):

codegen_accessor_statements: 20.00
codegen_evaluator_statements: 79.00
codegen_kernel_statements: 4367.00
codegen_offloaded_tasks: 92.00
codegen_statements  : 4466.00
launched_tasks      : 4880.00
launched_tasks_compute: 4836.00
launched_tasks_list_gen: 44.00
launched_tasks_list_op: 44.00
launched_tasks_range_for: 1.00
launched_tasks_serial: 26.00
launched_tasks_struct_for: 4809.00

With fusion (at commit 6e6892f):

codegen_accessor_statements: 20.00
codegen_evaluator_statements: 79.00
codegen_kernel_statements: 4395.00
codegen_offloaded_tasks: 94.00
codegen_statements  : 4494.00
launched_tasks      : 4880.00
launched_tasks_compute: 4836.00
launched_tasks_list_gen: 44.00
launched_tasks_list_op: 44.00
launched_tasks_range_for: 1.00
launched_tasks_serial: 26.00
launched_tasks_struct_for: 4809.00

[Click here for the format server]


@codecov
Copy link

codecov bot commented Sep 21, 2020

Codecov Report

Merging #1887 into master will increase coverage by 0.61%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1887      +/-   ##
==========================================
+ Coverage   43.19%   43.80%   +0.61%     
==========================================
  Files          44       45       +1     
  Lines        6330     6168     -162     
  Branches     1092     1097       +5     
==========================================
- Hits         2734     2702      -32     
+ Misses       3426     3297     -129     
+ Partials      170      169       -1     
Impacted Files Coverage Δ
python/taichi/lang/ast_checker.py 70.58% <0.00%> (-1.64%) ⬇️
python/taichi/testing.py 75.00% <0.00%> (-0.72%) ⬇️
python/taichi/lang/linalg.py 89.33% <0.00%> (-0.67%) ⬇️
python/taichi/lang/meta.py 62.31% <0.00%> (-0.54%) ⬇️
python/taichi/misc/util.py 17.48% <0.00%> (-0.26%) ⬇️
python/taichi/misc/task.py 0.00% <0.00%> (ø)
python/taichi/cc_compose.py 0.00% <0.00%> (ø)
python/taichi/lang/shell.py 0.00% <0.00%> (ø)
python/taichi/core/__init__.py 0.00% <0.00%> (ø)
python/taichi/tools/patterns.py 0.00% <0.00%> (ø)
... and 13 more

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 9a23ecd...6cff4cc. Read the comment docs.

@xumingkuan xumingkuan marked this pull request as ready for review September 22, 2020 10:19
@xumingkuan xumingkuan changed the title [async] Classify tasks to improve fusion speed [async] Classify tasks to make fusion 10.6x faster Sep 22, 2020
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.

LGTM. Thank you!

taichi/util/bit.h Outdated Show resolved Hide resolved
taichi/util/bit.h Outdated Show resolved Hide resolved
@xumingkuan xumingkuan merged commit 3a53bbd into taichi-dev:master Sep 23, 2020
@xumingkuan xumingkuan deleted the fuse4 branch September 25, 2020 05:51
@yuanming-hu yuanming-hu mentioned this pull request Sep 26, 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.

None yet

2 participants