Skip to content

Commit

Permalink
Remove zluda_dnn remains.
Browse files Browse the repository at this point in the history
  • Loading branch information
lshqqytiger committed Apr 29, 2024
1 parent 2804604 commit 7538ae6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 494 deletions.
19 changes: 2 additions & 17 deletions miopen-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
use std::env::VarError;
use std::{env, path::PathBuf};

fn main() -> Result<(), VarError> {
fn main() {
println!("cargo:rustc-link-lib=dylib=MIOpen");
if cfg!(windows) {
let env = env::var("CARGO_CFG_TARGET_ENV")?;
if env == "msvc" {
let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
path.push("lib");
println!("cargo:rustc-link-search=native={}", path.display());
} else {
println!("cargo:rustc-link-search=native=C:\\Windows\\System32");
};
} else {
println!("cargo:rustc-link-search=native=/opt/rocm/lib/");
}
Ok(())
println!("cargo:rustc-link-search=native=/opt/rocm/lib/");
}
Binary file removed miopen-sys/lib/MIOpen.lib
Binary file not shown.
27 changes: 0 additions & 27 deletions zluda_dnn/src/cudnn_types_v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,33 +151,6 @@ pub struct cudnnTensorTransformStruct {
_unused: [u8; 0],
}
pub type cudnnTensorTransformDescriptor_t = *mut cudnnTensorTransformStruct;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct cudnnEngineHeurStruct {
pub operation_graph: cudnnOperationGraphDescriptor_t,
}
pub type cudnnEngineHeurDescriptor_t = *mut cudnnEngineHeurStruct;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct cudnnOperationConvolutionForwardStruct {
pub x_desc: cudnnTensorDescriptor_t,
pub y_desc: cudnnTensorDescriptor_t,
pub w_desc: cudnnFilterDescriptor_t,
pub conv_desc: cudnnConvolutionDescriptor_t,
}
pub type cudnnOperationConvolutionForwardDescriptor_t = *mut cudnnOperationConvolutionForwardStruct;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct cudnnOperationGraphStruct {
pub handle: cudnnHandle_t,
pub ops: *const cudnnBackendDescriptorType_t,
}
pub type cudnnOperationGraphDescriptor_t = *mut cudnnOperationGraphStruct;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct cudnnVariantPackStruct {
}
pub type cudnnVariantPackDescriptor_t = *mut cudnnVariantPackStruct;
impl cudnnDataType_t {
pub const CUDNN_DATA_FLOAT: cudnnDataType_t = cudnnDataType_t(0);
}
Expand Down
57 changes: 8 additions & 49 deletions zluda_dnn/src/cudnn_v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::types::*;

#[no_mangle]
pub unsafe extern "system" fn cudnnGetVersion() -> usize {
8700 as usize
unimplemented!()
}

#[no_mangle]
Expand Down Expand Up @@ -65,7 +65,7 @@ pub unsafe extern "system" fn cudnnGetStream(
handle: cudnnHandle_t,
streamId: *mut cudaStream_t,
) -> cudnnStatus_t {
crate::get_stream(handle, streamId)
crate::unsupported()
}

#[no_mangle]
Expand Down Expand Up @@ -2793,18 +2793,7 @@ pub unsafe extern "system" fn cudnnSetConvolution2dDescriptor(
mode: cudnnConvolutionMode_t,
computeType: cudnnDataType_t,
) -> cudnnStatus_t {
let pad_a = [pad_h, pad_w];
let filter_stride_a = [u, v];
let dilation_a = [dilation_h, dilation_w];
crate::set_convolution_nd_descriptor(
convDesc,
2,
pad_a.as_ptr(),
filter_stride_a.as_ptr(),
dilation_a.as_ptr(),
mode,
computeType,
)
crate::unsupported()
}

#[no_mangle]
Expand Down Expand Up @@ -3422,27 +3411,14 @@ pub unsafe extern "system" fn cudnnBackendCreateDescriptor(
descriptorType: cudnnBackendDescriptorType_t,
descriptor: *mut cudnnBackendDescriptor_t,
) -> cudnnStatus_t {
match descriptorType {
cudnnBackendDescriptorType_t::CUDNN_BACKEND_CONVOLUTION_DESCRIPTOR => crate::cudnn_create_convolution_descriptor(descriptor as _),
cudnnBackendDescriptorType_t::CUDNN_BACKEND_ENGINEHEUR_DESCRIPTOR => crate::cudnn_create_engineheur_descriptor(descriptor as _),
cudnnBackendDescriptorType_t::CUDNN_BACKEND_OPERATION_CONVOLUTION_FORWARD_DESCRIPTOR => crate::cudnn_create_operation_convolution_forward_descriptor(descriptor as _),
cudnnBackendDescriptorType_t::CUDNN_BACKEND_OPERATIONGRAPH_DESCRIPTOR => crate::cudnn_create_operationgraph_descriptor(descriptor as _),
cudnnBackendDescriptorType_t::CUDNN_BACKEND_VARIANT_PACK_DESCRIPTOR => cudnnStatus_t::CUDNN_STATUS_SUCCESS,
cudnnBackendDescriptorType_t::CUDNN_BACKEND_TENSOR_DESCRIPTOR => crate::cudnn_create_tensor_descriptor(descriptor as _),
_ => {
println!("[ZLUDA] Unsupported descriptor type: {}", descriptorType.0);
crate::unsupported()
},
}
crate::unsupported()
}

#[no_mangle]
pub unsafe extern "system" fn cudnnBackendDestroyDescriptor(
descriptor: cudnnBackendDescriptor_t,
) -> cudnnStatus_t {
// TODO
// Do not know how to destroy unknown descriptor.
cudnnStatus_t::CUDNN_STATUS_SUCCESS
crate::unsupported()
}

#[no_mangle]
Expand All @@ -3456,7 +3432,7 @@ pub unsafe extern "system" fn cudnnBackendInitialize(
pub unsafe extern "system" fn cudnnBackendFinalize(
descriptor: cudnnBackendDescriptor_t,
) -> cudnnStatus_t {
cudnnStatus_t::CUDNN_STATUS_SUCCESS
crate::unsupported()
}

#[no_mangle]
Expand All @@ -3467,18 +3443,7 @@ pub unsafe extern "system" fn cudnnBackendSetAttribute(
elementCount: i64,
arrayOfElements: *const ::std::os::raw::c_void,
) -> cudnnStatus_t {
match attributeName.0 {
100..=199 => crate::set_convolution_nd_descriptor_by_attribute(descriptor as _, attributeName, elementCount, arrayOfElements),
200..=299 => crate::set_engineheur_descriptor_by_attribute(descriptor as _, attributeName, elementCount, arrayOfElements),
700..=799 => crate::set_operation_convolution_forward_descriptor_by_attribute(descriptor as _, attributeName, elementCount, arrayOfElements as _),
800..=899 => crate::set_operationgraph_descriptor_by_attribute(descriptor as _, attributeName, elementCount, arrayOfElements as _),
900..=999 => crate::set_tensor_nd_decriptor_by_attribute(descriptor as _, attributeName, elementCount, arrayOfElements),
1000..=1099 => cudnnStatus_t::CUDNN_STATUS_SUCCESS,
_ => {
println!("[ZLUDA] Tried to set unsupported attribute: {}", attributeName.0);
crate::unsupported()
},
}
crate::unsupported()
}

#[no_mangle]
Expand All @@ -3490,13 +3455,7 @@ pub unsafe extern "system" fn cudnnBackendGetAttribute(
elementCount: *mut i64,
arrayOfElements: *mut ::std::os::raw::c_void,
) -> cudnnStatus_t {
match attributeName {
cudnnBackendAttributeName_t::CUDNN_ATTR_ENGINEHEUR_RESULTS => crate::get_engineheur_results(descriptor as _, requestedElementCount, elementCount, arrayOfElements),
_ => {
println!("[ZLUDA] Tried to get unsupported attribute: {}", attributeName.0);
crate::unsupported()
},
}
crate::unsupported()
}

#[no_mangle]
Expand Down
Loading

0 comments on commit 7538ae6

Please sign in to comment.