Skip to content

Conversation

@mateuszpn
Copy link
Contributor

Use counter-based events in level-zero v2 adapter

@mateuszpn mateuszpn requested a review from a team as a code owner December 1, 2025 13:44
@mateuszpn mateuszpn marked this pull request as draft December 1, 2025 13:44
@mateuszpn mateuszpn changed the title Use counter-based events [SYCL][L0 v2] Use counter-based events Dec 1, 2025
@mateuszpn mateuszpn marked this pull request as ready for review December 1, 2025 14:32
@kswiecicki
Copy link
Contributor

SYCL Pre Commit on Windows fails with event handle leak checking error, it seems that the zexCounterBasedEventCreate2 is not correctly tracked on Windows.

Copy link
Contributor

@KFilipek KFilipek left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Mateusz P. Nowak <[email protected]>
Signed-off-by: Mateusz P. Nowak <[email protected]>
(platform->ZeDriver, "zexCounterBasedEventCreate2",
(void **)&this->eventCreateFunc));
if (result != ZE_RESULT_SUCCESS) {
throw ur_result_t(ze2urResult(result));
Copy link
Contributor

@kswiecicki kswiecicki Dec 4, 2025

Choose a reason for hiding this comment

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

I'm pretty sure that ZE2UR_CALL_THROWS does what you are doing here, it also prints an error message when UR_ENABLE_ASSERTIONS is enabled in cmake.

// If counter-based events are not supported, fall back to normal events
// Remove the counter flag as the normal provider doesn't support it
event_flags_t normalFlags = flags & ~EVENT_FLAGS_COUNTER;
return std::make_unique<provider_normal>(context, queueType, normalFlags);
Copy link
Contributor

Choose a reason for hiding this comment

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

provider_normal still supports the counter events, it just uses the old API to do that. provider_counter throwing an exception would mean that the zexCounterBasedEventCreate2 function is unavailable, not that counter-based events aren't supported.
provider_normal should be used when EVENT_FLAGS_COUNTER is not set or provider_counter has thrown an error because zexCounterBasedEventCreate2 is unavailable.

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.

3 participants