Skip to content

[SYCL] Cache and reuse events in the Level Zero plugin. #6484

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

Merged
merged 3 commits into from
Aug 2, 2022

Conversation

againull
Copy link
Contributor

@againull againull commented Jul 27, 2022

Avoid creating new pi_event objects. Reset pi_event objects
and put them in the cache instead of removing.

@againull againull requested a review from a team as a code owner July 27, 2022 17:34
@againull againull requested a review from smaslov-intel July 28, 2022 05:24
Comment on lines 5867 to 5869
Event->Context->addZeEventToCache(Event->ZeEvent, Event->ZeEventPool,
Event->isHostVisible(),
Event->isProfilingEnabled());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we maybe cache the PI event instead of re-creating from L0 components?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, thanks, fixed.

againull added 2 commits July 28, 2022 11:20
Avoid creating new Level Zero events. Reset native event
handles and put them in the cache instead of removing.
@againull againull force-pushed the events_reuse_general_case branch from 8935550 to 95d1584 Compare July 28, 2022 18:45
@againull againull requested a review from smaslov-intel July 28, 2022 19:00
@againull againull changed the title [SYCL] Reuse native event handles in the Level Zero plugin. [SYCL] Cache and reuse events in the Level Zero plugin. Jul 28, 2022
@againull
Copy link
Contributor Author

CUDA backend failures are unrelated.

@@ -276,6 +276,8 @@ template <class T> struct ZeCache : private T {
struct ReferenceCounter {
ReferenceCounter(pi_uint32 InitVal) : RefCount{InitVal} {}

void reset(pi_uint32 InitVal) { RefCount = InitVal; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is strange that it takes an arbitrary integer (I think you only call it with "1")
why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, fixed.

Hardcode initial value to 1 because ReferenceCounter is used only for ref
counting pi_objects where initial value is always 1.
@againull againull requested a review from smaslov-intel August 1, 2022 18:14
@againull againull merged commit a41b33c into intel:sycl Aug 2, 2022
@againull againull deleted the events_reuse_general_case branch December 3, 2022 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants