Repository navigation
Flush kernel output when synchronizing a stream that polling finds done - #3368
Merged
Merged
Conversation
The driver only flushes the device's printf buffer when synchronizing, not when querying for completion. Since #3315, synchronizing a stream that a query finds done returns without synchronizing, so the output of short kernels only appeared after a later kernel launch or blocking synchronization. Synchronizing the stream anyway would wait for work submitted since, which #3315 avoided, so instead synchronize an event that is never recorded: that flushes the buffer without waiting for any work. Each context keeps one such event, as creating and destroying one on every synchronization doubled its cost. Exception reporting already flushed this way, and now shares the helper.
Synchronizing a stream now flushes kernel output, so the test helper no longer needs to synchronize the whole context. This also makes the tests that capture kernel output exercise the synchronization users call.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3368 +/- ##
==========================================
- Coverage 87.40% 85.23% -2.17%
==========================================
Files 195 194 -1
Lines 20072 19992 -80
==========================================
- Hits 17543 17040 -503
- Misses 2529 2952 +423 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
CUDA.jl BenchmarksDetails
This comment was automatically generated by workflow using github-action-benchmark. |
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.
The driver only flushes the device's
printfbuffer when synchronizing (cu{Ctx,Stream,Event}Synchronize), launching a kernel, loading a module, etc., not when querying for completion. Since #3315,synchronize()returns without synchronizing when a query finds the stream done, so the output of short kernels only appeared after a later launch or blocking synchronization.Synchronizing the stream after polling, as before #3315, would wait for work other tasks submitted in the meantime. Instead, this synchronizes an event that is never recorded, which flushes the buffer without waiting for anything. Each context keeps one such event; creating and destroying one on every call, as in #3363, more than tripled the cost of synchronizing an idle stream. Exception reporting already flushed this way and now shares the helper.
synchronize()on an idle stream, RTX 5080, interleaved in one process:The second commit makes
@grab_outputsynchronize the task's stream instead of the whole context, so that tests capturing kernel output go through the same synchronization as users do. A dedicated test covers the case where polling finds the stream done.Supersedes #3363.