mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-02 14:57:43 +03:00
Implement cublasCreate_v2
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1816,6 +1816,7 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"cuda_macros",
|
||||
"cuda_types",
|
||||
"rocblas-sys",
|
||||
"zluda_common",
|
||||
]
|
||||
|
||||
|
@ -11,6 +11,7 @@ name = "cublas"
|
||||
cuda_macros = { path = "../cuda_macros" }
|
||||
cuda_types = { path = "../cuda_types" }
|
||||
zluda_common = { path = "../zluda_common" }
|
||||
rocblas-sys = { path = "../ext/rocblas-sys" }
|
||||
|
||||
[package.metadata.zluda]
|
||||
linux_symlinks = [
|
||||
|
@ -1,4 +1,34 @@
|
||||
use std::mem;
|
||||
|
||||
use cuda_types::cublas::*;
|
||||
use zluda_common::{from_cuda_object, ZludaObject};
|
||||
|
||||
use rocblas_sys::*;
|
||||
|
||||
pub struct Handle {
|
||||
handle: rocblas_handle,
|
||||
}
|
||||
|
||||
impl Handle {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
handle: unsafe { mem::zeroed() },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ZludaObject for Handle {
|
||||
const COOKIE: usize = 0x57c3fdb0fd72b08e;
|
||||
|
||||
type Error = cublasError_t;
|
||||
type CudaHandle = cublasHandle_t;
|
||||
|
||||
fn drop_checked(&mut self) -> cublasStatus_t {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
from_cuda_object!(Handle);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub(crate) fn unimplemented() -> cublasStatus_t {
|
||||
@ -10,6 +40,13 @@ pub(crate) fn unimplemented() -> cublasStatus_t {
|
||||
cublasStatus_t::ERROR_NOT_SUPPORTED
|
||||
}
|
||||
|
||||
pub(crate) fn create_v2(handle: &mut cublasHandle_t) -> cublasStatus_t {
|
||||
let mut zluda_blas_handle = Handle::new();
|
||||
unsafe { rocblas_create_handle(&mut zluda_blas_handle.handle) }?;
|
||||
*handle = Handle::wrap(zluda_blas_handle);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn get_status_name(_status: cublasStatus_t) -> *const ::core::ffi::c_char {
|
||||
todo!()
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
mod r#impl;
|
||||
|
||||
use cuda_types::cublas::cublasError_t;
|
||||
|
||||
macro_rules! unimplemented {
|
||||
($($abi:literal fn $fn_name:ident( $($arg_id:ident : $arg_type:ty),* ) -> $ret_type:ty;)*) => {
|
||||
$(
|
||||
@ -42,7 +44,7 @@ macro_rules! implemented_and_always_succeeds {
|
||||
|
||||
cuda_macros::cublas_function_declarations!(
|
||||
unimplemented,
|
||||
implemented <= [],
|
||||
implemented <= [cublasCreate_v2],
|
||||
implemented_and_always_succeeds
|
||||
<= [
|
||||
cublasGetStatusName,
|
||||
|
Reference in New Issue
Block a user