-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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] Add allocator async state #1973
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1973 +/- ##
==========================================
+ Coverage 42.76% 43.72% +0.96%
==========================================
Files 45 45
Lines 6431 6221 -210
Branches 1105 1105
==========================================
- Hits 2750 2720 -30
+ Misses 3507 3328 -179
+ Partials 174 173 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general! I think we should also change some code in task fusion:
taichi/taichi/program/state_flow_graph.cpp
Lines 455 to 458 in b8a1bc4
if (state.first.type != AsyncState::Type::value) { | |
// No need to check mask/list states as there must be value states. | |
continue; | |
} |
IIUC allocator states should be treated like value states here: if A->B is an allocator edge on SNode s
, only if both A and B are element-wise (or loop-unique on the same value in the future), can A and B be fused. For example, these two tasks cannot be fused:
@ti.kernel()
def foo():
for i in x:
ti.activate(y, i + 1)
@ti.kernel()
def bar():
for i in x:
ti.deactivate(y, i)
BTW, do these SNodeOpStmt
s change mask states?
Great catch! I've updated the code accordingly. However, note that I checked for
Yes, thanks! |
deactivate_y() | ||
ti.sync() | ||
|
||
# TODO: assert that activate_y and deactivate_y are not fused. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've confirmed this with the dumped dot graph. But task fusion is currently not recorded in the stats yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks!
taichi/taichi/lang_util.cpp
Lines 156 to 158 in ceea597
Before this PR,
test_block_async()
would actually fail. Here's the SFG. Note that all GC tasks are floating (as expected):With this PR, SFG:
Highlighting the
allocator
state:Related issue = #742
[Click here for the format server]