Skip to content
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

[L0] Interrupt-based event implementation #2334

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

winstonzhang-intel
Copy link
Contributor

To expose this functionality in UR, we want two ways of enabling low-power events:

  1. Queue-wide enabling so all events created on the queue are low-powered.
  2. As a property passed to urEnqueueEventsWaitWithBarrier making the resulting event a low-power event. This will require the existing interface to be extended with properties, potentially through a new experimental function.

@github-actions github-actions bot added level-zero L0 adapter specific issues command-buffer Command Buffer feature addition/changes/specification labels Nov 16, 2024
To expose this functionality in UR, we want two ways of enabling low-power events:

Queue-wide enabling so all events created on the queue are low-powered.
As a property passed to urEnqueueEventsWaitWithBarrier making the resulting event a low-power event. This will require the existing interface to be extended with properties, potentially through a new experimental function.

Signed-off-by: Zhang, Winston <[email protected]>
Signed-off-by: Zhang, Winston <[email protected]>
@winstonzhang-intel winstonzhang-intel marked this pull request as ready for review November 22, 2024 02:55
bool InterruptBased =
EnqueueExtProp &&
(EnqueueExtProp->flags & UR_EXP_ENQUEUE_EXT_FLAG_LOW_POWER_EVENTS);
if (InterruptBased) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand the intention here or why we need to cast the function.

ur_queue_handle_t, uint32_t, const ur_event_handle_t *,
ur_event_handle_t *, bool)>(EnqueueEventsWaitWithBarrier)(
Queue, NumEventsInWaitList, EventWaitList, OutEvent,
Queue ? Queue->InterruptBasedEventsEnabled : false);
Copy link
Contributor

@pbalcer pbalcer Nov 27, 2024

Choose a reason for hiding this comment

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

Queue ? Queue->InterruptBasedEventsEnabled : false
I don't believe Queue can be null here. So this should be simply InterruptBased || Queue->InterruptBasedEventsEnabled.

@@ -574,6 +583,9 @@ ur_event_handle_t ur_context_handle_t_::getEventFromContextCache(
if (Event->CounterBasedEventsEnabled != CounterBasedEventEnabled) {
return nullptr;
}
if (Event->InterruptBasedEventsEnabled != InterruptBasedEventEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will not work unless the interrupt based events are somehow first on the Cache container. The same is true of the counter-based events. There needs to be separate pool for interrupt-driven events (or maybe they shouldn't be cached at all?).

HostVisibleInterruptAndCounterBasedRegularCacheType,
HostInvisibleInterruptAndCounterBasedRegularCacheType,
HostVisibleInterruptAndCounterBasedImmediateCacheType,
HostInvisibleInterruptAndCounterBasedImmediateCacheType
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 exactly why I've asked you to do the refactor. This will grow exponentially with new event parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command-buffer Command Buffer feature addition/changes/specification level-zero L0 adapter specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants