aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/src/impl/mod.rs
blob: 03a68d82c262f6735f6587b4077e5ed38e0a4bd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use cuda_types::*;
use hip_runtime_sys::*;

#[cfg(debug_assertions)]
pub(crate) fn unimplemented() -> CUresult {
    unimplemented!()
}

#[cfg(not(debug_assertions))]
pub(crate) fn unimplemented() -> CUresult {
    CUresult::ERROR_NOT_SUPPORTED
}

pub(crate) trait FromCuda<T>: Sized {
    fn from_cuda(t: T) -> Result<Self, CUerror>;
}

impl FromCuda<u32> for u32 {
    fn from_cuda(x: u32) -> Result<Self, CUerror> {
        Ok(x)
    }
}

pub(crate) fn init(flags: ::core::ffi::c_uint) -> hipError_t {
    unsafe { hipInit(flags) }
}