Skip to content

Commit

Permalink
Rewrite nvrtcVersion.
Browse files Browse the repository at this point in the history
  • Loading branch information
lshqqytiger committed Apr 20, 2024
1 parent cf262c6 commit b9e932b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 11 additions & 0 deletions zluda_rtc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ fn unsupported() -> nvrtcResult {
nvrtcResult::NVRTC_ERROR_INTERNAL_ERROR
}

const NVRTC_VERSION_MAJOR: i32 = 11;
const NVRTC_VERSION_MINOR: i32 = 8;
const SUPPORTED_OPTIONS: [&'static str; 1] = ["--std"];

fn to_nvrtc(status: hiprtc_sys::hiprtcResult) -> nvrtcResult {
Expand All @@ -37,6 +39,15 @@ unsafe fn get_error_string(result: nvrtcResult) -> *const ::std::os::raw::c_char
hiprtcGetErrorString(to_hiprtc(result))
}

unsafe fn version(
major: *mut i32,
minor: *mut i32,
) -> nvrtcResult {
*major = NVRTC_VERSION_MAJOR;
*minor = NVRTC_VERSION_MINOR;
nvrtcResult::NVRTC_SUCCESS
}

unsafe fn create_program(
prog: *mut nvrtcProgram,
src: *const std::ffi::c_char,
Expand Down
4 changes: 1 addition & 3 deletions zluda_rtc/src/nvrtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ pub unsafe extern "system" fn nvrtcVersion(
major: *mut ::std::os::raw::c_int,
minor: *mut ::std::os::raw::c_int,
) -> nvrtcResult {
*major = 11;
*minor = 8;
nvrtcResult::NVRTC_SUCCESS
crate::version(major, minor)
}

#[doc = " \\ingroup query\n \\brief nvrtcGetNumSupportedArchs sets the output parameter \\p numArchs\n with the number of architectures supported by NVRTC. This can\n then be used to pass an array to ::nvrtcGetSupportedArchs to\n get the supported architectures.\n\n \\param [out] numArchs number of supported architectures.\n \\return\n - \\link #nvrtcResult NVRTC_SUCCESS \\endlink\n - \\link #nvrtcResult NVRTC_ERROR_INVALID_INPUT \\endlink\n\n see ::nvrtcGetSupportedArchs"]
Expand Down

0 comments on commit b9e932b

Please sign in to comment.