Skip to content

Add synchronous and asynchronous events#6

Open
szymon-zadworny wants to merge 27 commits into
oneapi-src:mainfrom
szymon-zadworny:event
Open

Add synchronous and asynchronous events#6
szymon-zadworny wants to merge 27 commits into
oneapi-src:mainfrom
szymon-zadworny:event

Conversation

@szymon-zadworny

@szymon-zadworny szymon-zadworny commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This PR adds:

  • The Event class bindings
  • Synchronization methods:
    • through synchronous .wait() for Queues and Events
    • through asynchronous Futures and .await for Events
    • through barriers (which return an Event) for Queues
  • memset bindings
  • event dependencies
  • examples showcasing synchronous and asynchronous waiting

This PR also finalizes the Buffer safety model - safe Buffers are initialized by default and need to be waited/awaited. You can still create uninitialized Buffers through unsafe uninit methods.

Synchronous waiting:

fn main() {
    let mut queue = Queue::new();
    let mut buffer = queue.alloc_shared::<u32>(10).wait();
}

Asynchronous waiting:

#[tokio::main]
async fn main() {
    let mut queue = Queue::new();
    let mut buffer = queue.alloc_shared::<u32>(10).await;
}

Note: tokio was used as a dev dependency for the async.rs example but the actual Futures are executor-agnostic.

This PR requires the following SYCL extensions for the asynchronous execution implementation:

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.

1 participant