mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-08 17:19:19 +00:00
First attempt at async host side
This commit is contained in:
parent
ad2059872a
commit
b460e359ae
7 changed files with 294 additions and 39 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue