-
Notifications
You must be signed in to change notification settings - Fork 14.7k
[Offload] Don't create events for empty queues #152304
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 all commits
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 |
---|---|---|
|
@@ -2591,6 +2591,17 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy { | |
return Event->wait(*Stream); | ||
} | ||
|
||
Expected<bool> hasPendingWorkImpl(AsyncInfoWrapperTy &AsyncInfo) override { | ||
auto Stream = AsyncInfo.getQueueAs<AMDGPUStreamTy *>(); | ||
if (!Stream) | ||
return false; | ||
|
||
auto Query = Stream->query(); | ||
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 has the side effect of performing cleanup required for the device (freeing any temporary memory, releasing signals, clearing the array, etc.) if the queue happens to be empty. I think this is fine and a sensible thing to do. It should have no observable side effects outside of the RTL. |
||
if (Query) | ||
return !*Query; | ||
return Query.takeError(); | ||
} | ||
|
||
/// Synchronize the current thread with the event. | ||
Error syncEventImpl(void *EventPtr) override { | ||
AMDGPUEventTy *Event = reinterpret_cast<AMDGPUEventTy *>(EventPtr); | ||
|
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.
Unrelated, would be nice to have something nicer than
Device->Device->
.