aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/src/impl/memory.rs
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-07-04 15:40:08 +0200
committerAndrzej Janik <[email protected]>2021-07-04 15:40:08 +0200
commitecc33f7b105373264807d09f6bdcadb93e59f1f0 (patch)
treebf7e0fc6f443062ca7bb61507d0db815614267ae /zluda/src/impl/memory.rs
parentd76ffd691cdb495c24c81fda82bd2b3c99d51531 (diff)
downloadZLUDA-ecc33f7b105373264807d09f6bdcadb93e59f1f0.tar.gz
ZLUDA-ecc33f7b105373264807d09f6bdcadb93e59f1f0.zip
Make everything async
Diffstat (limited to 'zluda/src/impl/memory.rs')
-rw-r--r--zluda/src/impl/memory.rs28
1 files changed, 11 insertions, 17 deletions
diff --git a/zluda/src/impl/memory.rs b/zluda/src/impl/memory.rs
index 81b4f31..56821d1 100644
--- a/zluda/src/impl/memory.rs
+++ b/zluda/src/impl/memory.rs
@@ -13,7 +13,7 @@ pub fn alloc_v2(dptr: *mut *mut c_void, bytesize: usize) -> Result<(), CUresult>
pub fn copy_v2(dst: *mut c_void, src: *const c_void, bytesize: usize) -> Result<(), CUresult> {
GlobalState::lock_enqueue(stream::CU_STREAM_LEGACY, |cmd_list, signal, wait| {
unsafe { cmd_list.append_memory_copy_raw(dst, src, bytesize, Some(signal), wait)? };
- Ok::<_, l0::sys::ze_result_t>(())
+ Ok(())
})
}
@@ -26,41 +26,35 @@ pub fn free_v2(ptr: *mut c_void) -> Result<(), CUresult> {
}
pub(crate) fn set_d32_v2(dst: *mut c_void, mut ui: u32, n: usize) -> Result<(), CUresult> {
- GlobalState::lock_stream(stream::CU_STREAM_LEGACY, |stream| {
- let cmd_list = stream.command_list()?;
+ GlobalState::lock_enqueue(stream::CU_STREAM_LEGACY, |cmd_list, signal, wait| {
unsafe {
cmd_list.append_memory_fill_raw(
dst,
&mut ui as *mut _ as *mut _,
mem::size_of::<u32>(),
mem::size_of::<u32>() * n,
- None,
- &mut [],
+ Some(signal),
+ wait,
)
}?;
- cmd_list.close()?;
- stream.queue.execute_and_synchronize(cmd_list)?;
- Ok::<_, CUresult>(())
- })?
+ Ok(())
+ })
}
pub(crate) fn set_d8_v2(dst: *mut c_void, mut uc: u8, n: usize) -> Result<(), CUresult> {
- GlobalState::lock_stream(stream::CU_STREAM_LEGACY, |stream| {
- let cmd_list = stream.command_list()?;
+ GlobalState::lock_enqueue(stream::CU_STREAM_LEGACY, |cmd_list, signal, wait| {
unsafe {
cmd_list.append_memory_fill_raw(
dst,
&mut uc as *mut _ as *mut _,
mem::size_of::<u8>(),
mem::size_of::<u8>() * n,
- None,
- &mut [],
+ Some(signal),
+ wait,
)
}?;
- cmd_list.close()?;
- stream.queue.execute_and_synchronize(cmd_list)?;
- Ok::<_, CUresult>(())
- })?
+ Ok(())
+ })
}
#[cfg(test)]