diff options
author | Andrzej Janik <[email protected]> | 2021-01-08 19:43:46 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-08 19:43:46 +0100 |
commit | 5cd9a5fbc4b92c58a1db6f205559e690af30481b (patch) | |
tree | 43a4a85cddd462a43fa250421a8f26c447a33a7a | |
parent | 237a6c113a6c62e36dfa487e074f2b93d854039c (diff) | |
download | ZLUDA-5cd9a5fbc4b92c58a1db6f205559e690af30481b.tar.gz ZLUDA-5cd9a5fbc4b92c58a1db6f205559e690af30481b.zip |
Add empty implementation of cuDeviceGetLuid (#30)
This function is required by recent versions of CUDA runtime on Windows
-rw-r--r-- | zluda/src/cuda.rs | 9 | ||||
-rw-r--r-- | zluda/src/impl/device.rs | 9 |
2 files changed, 17 insertions, 1 deletions
diff --git a/zluda/src/cuda.rs b/zluda/src/cuda.rs index 2dc26f5..dda24af 100644 --- a/zluda/src/cuda.rs +++ b/zluda/src/cuda.rs @@ -2233,6 +2233,15 @@ pub extern "C" fn cuDeviceGetUuid(uuid: *mut CUuuid, dev: CUdevice) -> CUresult } #[cfg_attr(not(test), no_mangle)] +pub extern "C" fn cuDeviceGetLuid( + luid: *mut ::std::os::raw::c_char, + deviceNodeMask: *mut ::std::os::raw::c_uint, + dev: CUdevice, +) -> CUresult { + r#impl::device::get_luid(luid, deviceNodeMask, dev.decuda()).encuda() +} + +#[cfg_attr(not(test), no_mangle)] pub extern "C" fn cuDeviceTotalMem_v2(bytes: *mut usize, dev: CUdevice) -> CUresult { r#impl::device::total_mem_v2(bytes, dev.decuda()).encuda() } diff --git a/zluda/src/impl/device.rs b/zluda/src/impl/device.rs index 8fa24a8..29cac2d 100644 --- a/zluda/src/impl/device.rs +++ b/zluda/src/impl/device.rs @@ -3,7 +3,7 @@ use crate::cuda; use cuda::{CUdevice_attribute, CUuuid_st}; use std::{ cmp, mem, - os::raw::{c_char, c_int}, + os::raw::{c_char, c_int, c_uint}, ptr, sync::atomic::{AtomicU32, Ordering}, }; @@ -350,6 +350,13 @@ pub fn get_uuid(uuid: *mut CUuuid_st, dev_idx: Index) -> Result<(), CUresult> { Ok(()) } +// TODO: add support if Level 0 exposes it +pub fn get_luid(luid: *mut c_char, dev_node_mask: *mut c_uint, _dev_idx: Index) -> Result<(), CUresult> { + unsafe { ptr::write_bytes(luid, 0u8, 8) }; + unsafe { *dev_node_mask = 0 }; + Ok(()) +} + pub fn primary_ctx_get_state( dev_idx: Index, flags: *mut u32, |