Conversation
memcpy_prefetch attached the WaitLock to the first Cluster reading the buffer in the order it sees them. That Cluster need not run first: a HaloTouch is only a placeholder, later scheduled beside the stencil that needs the halo, and later passes reorder and fuse Clusters. Under the CUDA backend a reader of the buffer was then launched before the wait and read the previous snapshot, e.g. the mass term of a reflection-FWI adjoint while its halo-reading neighbours waited correctly. Every reader now carries the wait; one on a released lock is free, and Clusters with the same syncs fuse again, which also removes a kernel launch in that case. The prefetch writes the buffer, so data dependences keep it after all readers.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3037 +/- ##
==========================================
- Coverage 83.95% 83.93% -0.02%
==========================================
Files 258 258
Lines 55679 55682 +3
Branches 4769 4770 +1
==========================================
- Hits 46743 46738 -5
- Misses 8123 8128 +5
- Partials 813 816 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Waiting on the reader alone split an interpolation's point loop: the Clusters defining the positions posx/posy, right before the reader in the same IterationSpace, had no sync, landed in a separate nest and left the reader with undeclared scalars. The Clusters that only define scalars right before a reader, with no syncs of their own, now share its wait.
Fusion's toposort only ordered ClusterGroups by data hazards and fences. Two readers of a prefetched buffer carry no hazard between them, so a reader could be scheduled ahead of the Cluster holding the WaitLock on it, and read the previous snapshot: under the CUDA backend the mass term of a reflection-FWI adjoint ran before the wait while its halo readers ran after. The DAG now orders every later reader of a waited-on Function after the wait, and memcpy_prefetch is back to a single WaitLock on the first reader.
|
|
||
| # Functions `cg0` waits on, e.g. a prefetched buffer: reading them | ||
| # is no data hazard, but no reader may be scheduled before the wait | ||
| waited = {s.target for s in flatten(cg0.syncs.values()) |
Contributor
There was a problem hiding this comment.
so what's s.target, and why does it not appear among cg0's equations?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.