Skip to content

Conversation

pbalcer
Copy link
Contributor

@pbalcer pbalcer commented Jan 17, 2024

L0 adapter makes optimizations based on whether an event has any external references. The adapter keeps track of this based on a reference count. This reference count wasn't being properly set when first creating an event based on a native handle, leading to code incorrectly assuming that the event was internal and had no external references, which ultimately led to segfaults.

This patch sets the refcount to 1 when first creating an event, solving the problem. It also adds a missing null-check to make user native handle events even work.

L0 adapter makes optimizations based on whether an event has
any external references. The adapter keeps track of this based
on a reference count. This reference count wasn't being properly
set when first creating an event based on a native handle, leading
to code incorrectly assuming that the event was internal and had
no external references, which ultimately led to segfaults.

This patch sets the refcount to 1 when first creating an event,
solving the problem. It also adds a missing null-check to make
user native handle events even work.
@pbalcer pbalcer requested a review from a team as a code owner January 17, 2024 14:07
@pbalcer
Copy link
Contributor Author

pbalcer commented Jan 17, 2024

intel/llvm#12425

Copy link
Contributor

@nrspruit nrspruit left a comment

Choose a reason for hiding this comment

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

LGTM

@pbalcer pbalcer added level-zero L0 adapter specific issues v0.8.x Include in the v0.8.x release labels Jan 18, 2024
@kbenzie kbenzie mentioned this pull request Jan 18, 2024
8 tasks
@kbenzie kbenzie merged commit 92f44da into oneapi-src:main Jan 19, 2024
@pbalcer pbalcer deleted the fix-native-handle-waits branch January 19, 2024 16:33
kbenzie added a commit to kbenzie/unified-runtime that referenced this pull request Jan 19, 2024
[L0] fix waiting on non-owned native handle events
kbenzie added a commit to kbenzie/unified-runtime that referenced this pull request Jan 22, 2024
[L0] fix waiting on non-owned native handle events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level-zero L0 adapter specific issues v0.8.x Include in the v0.8.x release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants