pub mod driver;
pub mod hiprtc;
#[cfg(feature = "rocblas")]
pub mod rocblas;
#[cfg(feature = "hipblaslt")]
pub mod hipblaslt;
pub use driver::{DevicePtr, DriverError, HipContext, HipFunction, HipModule, HipSlice, HipStream};
pub use hiprtc::{HiprtcError, Hsaco};
#[cfg(feature = "rocblas")]
pub use rocblas::{
Axpy, AxpyConfig, Copy, CopyConfig, Dot, DotConfig, Gemm, GemmConfig, Gemv, GemvConfig, Nrm2,
Nrm2Config, Operation, RocblasError, RocblasHandle, Scal, ScalConfig, StridedBatchedConfig,
};
#[cfg(feature = "hipblaslt")]
pub use hipblaslt::{
HipBlasLt, HipBlasLtError, MatmulDesc, MatmulHeuristic, MatmulPref, MatrixLayout,
};
#[cfg(feature = "dynamic-loading")]
pub fn get_lib_name_candidates(lib_name: &str) -> Vec<String> {
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
let major = env!("ROCM_MAJOR_VERSION");
let minor = env!("ROCM_MINOR_VERSION");
let rocm_path =
std::env::var("ROCM_PATH").unwrap_or_else(|_| "/opt/rocm".to_string());
let stems = [
format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}"),
format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.{major}"),
format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.0"),
format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.1"),
format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.{major}.{minor}"),
];
let mut out = Vec::with_capacity(stems.len() * 2);
for stem in &stems {
out.push(stem.clone()); out.push(format!("{rocm_path}/lib/{stem}")); }
out
}
#[cfg(feature = "dynamic-loading")]
pub fn panic_no_lib_found(name: &str, tried: &[String]) -> ! {
panic!(
"could not load dynamic library {name}; tried {} candidates: {tried:?}",
tried.len()
);
}