Repository navigation
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 was never recorded: that flushes the buffer without waiting for any work. Exception reporting already did so, and now shares the helper.
Member
Author
|
Eh, not sure about this. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3363 +/- ##
==========================================
- Coverage 87.31% 85.34% -1.97%
==========================================
Files 195 194 -1
Lines 20066 19984 -82
==========================================
- Hits 17521 17056 -465
- Misses 2545 2928 +383 ☔ 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.
Since #3315,
synchronize()returns without synchronizing when a query finds the stream done. The driver only flushes the device's printf buffer when synchronizing, not when querying, so the output of short kernels only shows up after a later kernel launch or blocking synchronization:This broke cuTile.jl's printing tests, which capture the output of
@cuda ...; synchronize(). CUDA.jl's own tests didn't catch it because@grab_outputsynchronizes the context, which always flushes.Synchronizing the stream after a successful query would flush, but would also wait for work submitted since, which #3315 avoided (684 ms vs. 0.03 ms when another kernel was queued after the query). Instead, synchronize an event that was never recorded, as
check_exceptionsalready did: that flushes without waiting for any work. Events keep synchronizing themselves after a successful query (#3346), which also flushes.The event isn't cached, because CUDA 11 drivers can't detect a destroyed context whose handle is reused. On an RTX 5080,
synchronize()of an idle stream goes from 0.07 to 0.29 µs, and a launch followed bysynchronize()from 4.97 to 5.27 µs. A cached event would save 0.1 µs of that.Not covered:
synchronize(::CuArray)still doesn't flush when the array's last use is known to have completed (in v6.4.1 it synchronized the stream).