First attempt at async host side

This commit is contained in:
Andrzej Janik 2021-07-04 12:54:27 +02:00
commit b460e359ae
7 changed files with 294 additions and 39 deletions

View file

@ -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,