Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7e63522
Add Event ffi type
szymon-zadworny Jul 14, 2026
8f0f972
Add C++ event::wait shim
szymon-zadworny Jul 14, 2026
348078e
Make queues in-order
szymon-zadworny Jul 15, 2026
e4f2163
Add Rust Event bindings
szymon-zadworny Jul 15, 2026
6eb51a1
Add Rust memset bindings
szymon-zadworny Jul 15, 2026
2e398f3
Add bytemuck dependency
szymon-zadworny Jul 15, 2026
ab8f02e
Add Clone impl for Queue
szymon-zadworny Jul 15, 2026
9d14ea6
Remove lifetime requirement from USM allocators
szymon-zadworny Jul 15, 2026
e3495e0
Add safe Buffer allocation functions
szymon-zadworny Jul 15, 2026
9d34ff9
Update alloc example
szymon-zadworny Jul 15, 2026
ec49545
Add Clone impl for Event
szymon-zadworny Jul 15, 2026
cd250f3
Add C++ event info binding
szymon-zadworny Jul 16, 2026
006cd21
Add Rust Event info binding
szymon-zadworny Jul 16, 2026
7732f70
Add Rust->C++ waker bindings
szymon-zadworny Jul 16, 2026
7f77eb6
Add IntoFuture impl for Event
szymon-zadworny Jul 16, 2026
c192951
Add await buffer creation support
szymon-zadworny Jul 16, 2026
c1b74b0
Add async usage example
szymon-zadworny Jul 16, 2026
b96a3c9
Add immediate queue binding
szymon-zadworny Jul 16, 2026
cc2658d
Move callback queue lifetime handling to Rust
szymon-zadworny Jul 17, 2026
7bce1a2
Add C++ barrier binding
szymon-zadworny Jul 17, 2026
5fa9474
Add Rust barrier binding
szymon-zadworny Jul 17, 2026
8a5f3f0
Add queue::wait C++ binding
szymon-zadworny Jul 17, 2026
cb62854
Add Rust Queue::wait binding
szymon-zadworny Jul 17, 2026
e1343c9
Add dependent events support for memset
szymon-zadworny Jul 17, 2026
69555a1
Add dependent events support for barrier
szymon-zadworny Jul 17, 2026
5c7f03e
Document new Queue methods
szymon-zadworny Jul 17, 2026
f43bff6
Document new Buffer methods
szymon-zadworny Jul 17, 2026
b90b8b7
Remove unnecessary .release()
szymon-zadworny Jul 20, 2026
c86a718
Add futures dependency
szymon-zadworny Jul 20, 2026
8979fa5
Replace Waker with AtomicWaker
szymon-zadworny Jul 21, 2026
c8d1aea
Make Queue initialization lazy
szymon-zadworny Jul 21, 2026
33128d9
Simplify redundant code
szymon-zadworny Jul 21, 2026
bc60941
Add safety comments
szymon-zadworny Jul 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions oneapi-rs-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "MIT OR Apache-2.0"

[dependencies]
cxx = "1.0.194"
futures = "0.3.33"

[build-dependencies]
cxx-build = "1.0.194"
Expand Down
3 changes: 3 additions & 0 deletions oneapi-rs-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ fn main() {
"src/device-sys.rs",
"src/queue-sys.rs",
"src/usm-sys.rs",
"src/event-sys.rs",
];

let cpp_sources = [
"src/platform.cpp",
"src/device.cpp",
"src/queue.cpp",
"src/usm.cpp",
"src/event.cpp",
];

let cpp_headers = [
Expand All @@ -34,6 +36,7 @@ fn main() {
"include/device.hpp",
"include/queue.hpp",
"include/usm.hpp",
"include/event.hpp",
];

cxx_build::bridges(&rust_sources)
Expand Down
26 changes: 26 additions & 0 deletions oneapi-rs-sys/include/event.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright (C) 2026 Intel Corporation
//
// Under the MIT License or the Apache License v2.0.
// See LICENSE-MIT and LICENSE-APACHE for license information.
// SPDX-License-Identifier: MIT OR Apache-2.0
//

#pragma once

#include "oneapi-rs-sys/include/types.hpp"
#include "oneapi-rs-sys/src/event-sys.rs.h"
#include "rust/cxx.h"

#include <memory>

namespace sycl_shims {
enum class EventCommandStatus : std::uint8_t;
} // namespace sycl_shims

namespace sycl_shims::event {
void wait(std::unique_ptr<Event> &);
void register_callback(std::unique_ptr<Queue> &, Event const &, SharedWaker const *);
EventCommandStatus get_command_execution_status(Event const &);
std::unique_ptr<Event> clone(Event const &);
} // namespace sycl_shims::event
15 changes: 15 additions & 0 deletions oneapi-rs-sys/include/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,22 @@

#include <memory>

namespace sycl_shims {
struct EventPtr;
} // namespace sycl_shims

namespace sycl_shims::queue {
std::unique_ptr<Queue> new_queue();
std::unique_ptr<Queue> new_queue_immediate();
std::unique_ptr<Queue> new_queue_from_device(Device const &);
std::unique_ptr<Queue> clone(Queue const &);
std::unique_ptr<Event> memset(
std::unique_ptr<Queue> &,
std::uint8_t * ptr,
int value,
std::size_t num_bytes,
rust::Vec<EventPtr>
);
std::unique_ptr<Event> barrier(std::unique_ptr<Queue> &, rust::Vec<EventPtr>);
void wait(std::unique_ptr<Queue> &);
} // namespace sycl_shims::queue
1 change: 1 addition & 0 deletions oneapi-rs-sys/include/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ namespace sycl_shims {
using Device = sycl::device;
using Platform = sycl::platform;
using Queue = sycl::queue;
using Event = sycl::event;
}
38 changes: 38 additions & 0 deletions oneapi-rs-sys/src/event-sys.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Copyright (C) 2026 Intel Corporation
//
// Under the MIT License or the Apache License v2.0.
// See LICENSE-MIT and LICENSE-APACHE for license information.
// SPDX-License-Identifier: MIT OR Apache-2.0
//

use crate::types::SharedWaker;

#[cxx::bridge(namespace = "sycl_shims::event")]
pub mod ffi {
#[namespace = "sycl_shims"]
extern "C++" {
include!("oneapi-rs-sys/src/types-sys.rs.h");
type EventCommandStatus = crate::types::ffi::EventCommandStatus;
}

unsafe extern "C++" {
include!("oneapi-rs-sys/include/event.hpp");

#[namespace = "sycl_shims"]
type Event = crate::types::ffi::Event;

#[namespace = "sycl_shims"]
type Queue = crate::types::ffi::Queue;

fn wait(event: &mut UniquePtr<Event>);
unsafe fn register_callback(queue: &mut UniquePtr<Queue>, event: &Event, waker: *const SharedWaker);
fn get_command_execution_status(event: &Event) -> EventCommandStatus;
fn clone(event: &Event) -> UniquePtr<Event>;
}

extern "Rust" {
type SharedWaker;
fn wake(&self);
}
}
41 changes: 41 additions & 0 deletions oneapi-rs-sys/src/event.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Copyright (C) 2026 Intel Corporation
//
// Under the MIT License or the Apache License v2.0.
// See LICENSE-MIT and LICENSE-APACHE for license information.
// SPDX-License-Identifier: MIT OR Apache-2.0
//

#include "oneapi-rs-sys/include/event.hpp"

using sycl::info::event_command_status;

namespace syclintel = sycl::ext::intel;

namespace sycl_shims::event {
void wait(std::unique_ptr<Event> & event) {
event->wait();
}
std::unique_ptr<Event> clone(Event const & event) {
return std::make_unique<Event>(sycl::event(event));
}
EventCommandStatus get_command_execution_status(Event const & event) {
auto status = event.get_info<sycl::info::event::command_execution_status>();
switch (status) {
case event_command_status::submitted:
return EventCommandStatus::Submitted;
case event_command_status::running:
return EventCommandStatus::Running;
case event_command_status::complete:
return EventCommandStatus::Complete;
default:
return EventCommandStatus::Unknown;
}
}
void register_callback(std::unique_ptr<Queue> & queue, Event const & event, SharedWaker const * waker) {
queue->submit([=](sycl::handler& cgh) {
cgh.depends_on(event);
cgh.host_task([=]() { waker->wake(); });
});
}
} // namespace sycl_shims::event
3 changes: 3 additions & 0 deletions oneapi-rs-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ pub mod queue;

#[path = "usm-sys.rs"]
pub mod usm;

#[path = "event-sys.rs"]
pub mod event;
Loading