aboutsummaryrefslogtreecommitdiffhomepage
path: root/level_zero/src/ze.rs
diff options
context:
space:
mode:
Diffstat (limited to 'level_zero/src/ze.rs')
-rw-r--r--level_zero/src/ze.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/level_zero/src/ze.rs b/level_zero/src/ze.rs
index 703f2ce..16a98a0 100644
--- a/level_zero/src/ze.rs
+++ b/level_zero/src/ze.rs
@@ -325,6 +325,11 @@ impl<'a> CommandQueue<'a> {
));
Ok(())
}
+
+ pub fn synchronize(&self, timeout_ns: u64) -> Result<()> {
+ check!(sys::zeCommandQueueSynchronize(self.as_ffi(), timeout_ns));
+ Ok(())
+ }
}
impl<'a> Drop for CommandQueue<'a> {
@@ -1097,6 +1102,15 @@ impl<'a> Event<'a> {
Ok(unsafe { Self::from_ffi(result) })
}
+ pub fn is_ready(&self) -> Result<bool> {
+ let status = unsafe { sys::zeEventQueryStatus(self.as_ffi()) };
+ match status {
+ sys::ze_result_t::ZE_RESULT_SUCCESS => Ok(true),
+ sys::ze_result_t::ZE_RESULT_NOT_READY => Ok(false),
+ err => Err(err),
+ }
+ }
+
unsafe fn with_raw_slice<'x, T>(
events: &[&Event<'x>],
f: impl FnOnce(u32, *mut sys::ze_event_handle_t) -> T,