-
Notifications
You must be signed in to change notification settings - Fork 277
NEW: Make event timing error messages more specific and actionable #559
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
Changes from 1 commit
8782dfa
e7f0f85
d66580e
2cf2dc8
99218bb
4314886
add0ba1
9f530b6
18ecca6
638990d
9904f3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,3 +80,63 @@ def test_is_done(init_cuda): | |
| # Without a sync, the captured work might not have yet completed | ||
| # Therefore this check should never raise an exception | ||
| assert event.is_done in (True, False) | ||
|
|
||
|
|
||
| def test_error_timing_disabled(): | ||
|
leofang marked this conversation as resolved.
|
||
| device = Device() | ||
| device.set_current() | ||
| enabled = EventOptions(enable_timing=True) | ||
| disabled = EventOptions(enable_timing=False) | ||
| stream = device.create_stream() | ||
|
|
||
| event1 = stream.record(options=enabled) | ||
| event2 = stream.record(options=disabled) | ||
| stream.sync() | ||
| with pytest.raises(RuntimeError, match="^Both Events must be created with timing enabled"): | ||
| event2 - event1 | ||
|
|
||
| event1 = stream.record(options=disabled) | ||
| event2 = stream.record(options=disabled) | ||
| stream.sync() | ||
| with pytest.raises(RuntimeError, match="^Both Events must be created with timing enabled"): | ||
| event2 - event1 | ||
|
|
||
| event1 = stream.record(options=enabled) | ||
| event2 = stream.record(options=enabled) | ||
| stream.sync() | ||
| event2 - event1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd delete this last block, because that's already covered more comprehensively under the existing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you maybe forget to push the commits?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. I'm still working on addressing feedback and would prefer to push the commits all at once instead of triggering the CI multiple times.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our CI is manual trigger only, so don't worry about excessive pushes 🙂 |
||
|
|
||
|
|
||
| def test_error_timing_recorded(): | ||
| device = Device() | ||
| device.set_current() | ||
| enabled = EventOptions(enable_timing=True) | ||
| stream = device.create_stream() | ||
|
|
||
| event1 = stream.record(options=enabled) | ||
| event2 = device.create_event(options=enabled) | ||
| event3 = device.create_event(options=enabled) | ||
|
|
||
| stream.sync() | ||
| with pytest.raises(RuntimeError, match="^Both Events must be recorded"): | ||
| event2 - event1 | ||
| with pytest.raises(RuntimeError, match="^Both Events must be recorded"): | ||
| event1 - event2 | ||
| with pytest.raises(RuntimeError, match="^Both Events must be recorded"): | ||
| event3 - event2 | ||
|
|
||
|
|
||
| def test_error_timing_incomplete(): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, this is an amazingly sophisticated unit test setup. |
||
| device = Device() | ||
| device.set_current() | ||
| enabled = EventOptions(enable_timing=True) | ||
| stream = device.create_stream() | ||
|
|
||
| event1 = stream.record(options=enabled) | ||
| event2 = device.create_event(options=enabled) | ||
| stream.wait(event2) | ||
| event3 = stream.record(options=enabled) | ||
|
|
||
| # event3 will never complete because the stream is waiting on event2 which is never recorded | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't there be no work recorded in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is interesting, I would think that because
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Took a quick look at the actual implementation, and Keith was right here. It's a no-op and
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So what's the solution for testing this case? Launching a kernel that takes a long time to complete or never returns? I believe cuda.core now has all the necessary parts to compile and launch such a kernel from this test?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @carterbox It is nerve wrecking to leave the kernel spinning and not clean it up after the event test is completed. I pushed commit add0ba1 to allow a signal passed from host to the busy kernel. |
||
| with pytest.raises(RuntimeError, match="^One or both events have not completed."): | ||
| event3 - event1 | ||
|
carterbox marked this conversation as resolved.
|
||
Uh oh!
There was an error while loading. Please reload this page.