Add 8bit memset

This commit is contained in:
Andrzej Janik
2020-11-22 18:42:34 +01:00
parent 6e39c4a90c
commit 2e8e55738c
2 changed files with 12 additions and 1 deletions

View File

@ -2914,7 +2914,7 @@ pub extern "C" fn cuMemsetD8_v2(
uc: ::std::os::raw::c_uchar, uc: ::std::os::raw::c_uchar,
N: usize, N: usize,
) -> CUresult { ) -> CUresult {
r#impl::unimplemented() r#impl::memory::set_d8_v2(dstDevice.decuda(), uc, N).encuda()
} }
#[cfg_attr(not(test), no_mangle)] #[cfg_attr(not(test), no_mangle)]

View File

@ -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)] #[cfg(test)]
mod test { mod test {
use super::super::test::CudaDriverFns; use super::super::test::CudaDriverFns;