aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2020-11-22 18:42:34 +0100
committerAndrzej Janik <[email protected]>2020-11-22 18:42:34 +0100
commit2e8e55738ce8c636da78ba195805ad852e04ff17 (patch)
treeb95c03263c4d8cd7b9d72f0249ff0c78da4035b2
parent6e39c4a90cd54dde7a174b9f5c4c5c62afb6a5ec (diff)
downloadZLUDA-2e8e55738ce8c636da78ba195805ad852e04ff17.tar.gz
ZLUDA-2e8e55738ce8c636da78ba195805ad852e04ff17.zip
Add 8bit memset
-rw-r--r--notcuda/src/cuda.rs2
-rw-r--r--notcuda/src/impl/memory.rs11
2 files changed, 12 insertions, 1 deletions
diff --git a/notcuda/src/cuda.rs b/notcuda/src/cuda.rs
index a957ba0..2dc26f5 100644
--- a/notcuda/src/cuda.rs
+++ b/notcuda/src/cuda.rs
@@ -2914,7 +2914,7 @@ pub extern "C" fn cuMemsetD8_v2(
uc: ::std::os::raw::c_uchar,
N: usize,
) -> CUresult {
- r#impl::unimplemented()
+ r#impl::memory::set_d8_v2(dstDevice.decuda(), uc, N).encuda()
}
#[cfg_attr(not(test), no_mangle)]
diff --git a/notcuda/src/impl/memory.rs b/notcuda/src/impl/memory.rs
index 1e7dcb7..f33a08c 100644
--- a/notcuda/src/impl/memory.rs
+++ b/notcuda/src/impl/memory.rs
@@ -38,6 +38,17 @@ pub(crate) fn set_d32_v2(dst: *mut c_void, ui: u32, n: usize) -> Result<(), CUre
})?
}
+pub(crate) fn set_d8_v2(dst: *mut c_void, uc: u8, n: usize) -> Result<(), CUresult> {
+ GlobalState::lock_stream(stream::CU_STREAM_LEGACY, |stream| {
+ let mut cmd_list = stream.command_list()?;
+ unsafe {
+ cmd_list.append_memory_fill_unsafe(dst, &uc, mem::size_of::<u8>() * n, None, &mut [])
+ }?;
+ stream.queue.execute(cmd_list)?;
+ Ok::<_, CUresult>(())
+ })?
+}
+
#[cfg(test)]
mod test {
use super::super::test::CudaDriverFns;