Skip to content

Commit 5fb435f

Browse files
Document new Queue methods
1 parent 406cc32 commit 5fb435f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

oneapi-rs/src/queue.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ impl Queue {
5959
unsafe { Buffer::new(allocator, len) }
6060
}
6161

62+
/// Sets memory allocated with USM allocations.
63+
/// Safety: the caller must make sure the underlying memory isn't being aliased somewhere else.
6264
pub unsafe fn memset<T, A: UsmAlloc>(&mut self, buffer: &mut Buffer<T, A>, value: i32) -> Event {
6365
unsafe { self.memset_with_deps(buffer, value, &[]) }
6466
}
6567

68+
/// Sets memory allocated with USM allocations after all specified events finish.
69+
/// Safety: the caller must make sure the underlying memory isn't being aliased somewhere else.
6670
pub unsafe fn memset_with_deps<T, A: UsmAlloc>(
6771
&mut self,
6872
buffer: &mut Buffer<T, A>,
@@ -78,10 +82,12 @@ impl Queue {
7882
unsafe { ffi::memset(&mut self.0, ptr, value, num_bytes, dep_events) }.into()
7983
}
8084

85+
/// Submits a barrier to the queue.
8186
pub fn barrier(&mut self) -> Event {
8287
self.barrier_with_deps(&[])
8388
}
8489

90+
/// Submits a barrier to the queue after all specified events finish.
8591
pub fn barrier_with_deps(&mut self, dep_events: &[&Event]) -> Event {
8692
let dep_events = dep_events
8793
.iter()
@@ -90,6 +96,7 @@ impl Queue {
9096
ffi::barrier(&mut self.0, dep_events).into()
9197
}
9298

99+
/// Performs a blocking wait for the completion of all enqueued tasks in the queue.
93100
pub fn wait(&mut self) {
94101
ffi::wait(&mut self.0);
95102
}

0 commit comments

Comments
 (0)