{"record":{"id":"b7f7710d6282029c","repo":"vosen/ZLUDA","slug":"rocsparse-dll-could-not-be-found-please-install-h","errorCode":null,"errorMessage":"rocsparse.dll could not be found. Please install HIP SDK: https://zluda.readthedocs.io/latest/hip_sdk.html","messagePattern":"rocsparse\\.dll could not be found\\. Please install HIP SDK: https://zluda\\.readthedocs\\.io/latest/hip_sdk\\.html","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"zluda_sparse/src/impl.rs","lineNumber":50,"sourceCode":"        Err(cusparseError_t::MAPPING_ERROR) => c\"CUSPARSE_STATUS_MAPPING_ERROR\".as_ptr(),\n        Err(cusparseError_t::EXECUTION_FAILED) => c\"CUSPARSE_STATUS_EXECUTION_FAILED\".as_ptr(),\n        Err(cusparseError_t::INTERNAL_ERROR) => c\"CUSPARSE_STATUS_INTERNAL_ERROR\".as_ptr(),\n        Err(cusparseError_t::MATRIX_TYPE_NOT_SUPPORTED) => {\n            c\"CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED\".as_ptr()\n        }\n        Err(cusparseError_t::ZERO_PIVOT) => c\"CUSPARSE_STATUS_ZERO_PIVOT\".as_ptr(),\n        Err(cusparseError_t::NOT_SUPPORTED) => c\"CUSPARSE_STATUS_NOT_SUPPORTED\".as_ptr(),\n        Err(cusparseError_t::INSUFFICIENT_RESOURCES) => {\n            c\"CUSPARSE_STATUS_INSUFFICIENT_RESOURCES\".as_ptr()\n        }\n        Err(_) => c\"CUSPARSE_STATUS_INTERNAL_ERROR\".as_ptr(),\n    }\n}\n\npub(crate) unsafe fn get_error_string(\n    status: cuda_types::cusparse::cusparseStatus_t,\n) -> *const ::core::ffi::c_char {\n    if cfg!(windows) && status.is_err() && status.err() == rocsparse().err().map(Into::into) {\n        return c\"rocsparse.dll could not be found. Please install HIP SDK: https://zluda.readthedocs.io/latest/hip_sdk.html\".as_ptr();\n    }\n    get_error_name(status)\n}\n\npub(crate) unsafe fn get_mat_index_base(descr_a: rocsparse_mat_descr) -> rocsparse_index_base {\n    let rocsparse = unwrap_ok_or!(\n        rocsparse(),\n        _,\n        return rocsparse_index_base::rocsparse_index_base_zero\n    );\n    rocsparse.rocsparse_get_mat_index_base(descr_a)\n}\n\npub(crate) unsafe fn get_mat_type(descr: rocsparse_mat_descr) -> rocsparse_matrix_type {\n    let rocsparse = unwrap_ok_or!(\n        rocsparse(),\n        _,","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/vosen/ZLUDA/blob/9c8b43f242985150f86a7f485218b7b82c3e96ca/zluda_sparse/src/impl.rs#L32-L68","documentation":"ZLUDA's cuSPARSE-compatible layer (zluda_sparse) is backed by AMD's rocSPARSE. On Windows, get_error_string (zluda_sparse/src/impl.rs:50) checks whether the failing cusparseStatus_t equals the error recorded when the rocsparse.dll library failed to load; if so it returns this message instead of the status name. It means rocSPARSE — and therefore the sparse linear-algebra APIs — are unavailable because the AMD HIP SDK that ships rocsparse.dll is not installed or not on the DLL search path.","triggerScenarios":"Any cusparse* API call through ZLUDA on Windows when rocsparse.dll cannot be loaded: HIP SDK missing, MIOpen/rocSPARSE component not installed, or the SDK bin directory absent from PATH.","commonSituations":"Running sparse-solver workloads (e.g. SciPy sparse, cuSPARSE-dependent apps) through ZLUDA on Windows with no HIP SDK; HIP SDK installed after the app started (stale process); PATH pointing at an older ROCm version that lacks rocsparse.dll; deploying an app to a clean machine without bundling or installing the HIP runtime.","solutions":["Install the AMD HIP SDK from https://zluda.readthedocs.io/latest/hip_sdk.html","Add the HIP SDK bin directory (e.g. C:\\Program Files\\AMD\\ROCm\\<version>\\bin) to PATH so rocsparse.dll resolves","Restart the application after installing the SDK — DLLs are resolved at process load, so a running process will not pick them up","Confirm rocsparse.dll exists in the SDK bin directory; reinstall/repair the SDK if the component is missing"],"exampleFix":"// before\n// cusparseCreate -> 'rocsparse.dll could not be found'\n// after (cmd, machine-wide PATH)\nsetx PATH \"%PATH%;C:\\Program Files\\AMD\\ROCm\\6.2\\bin\"\n:: then restart the application so the loader re-resolves DLLs","handlingStrategy":"fallback","validationCode":"// PowerShell pre-flight for rocSPARSE before launching the app\n$dll = Get-ChildItem 'C:\\Program Files\\AMD\\ROCm\\*\\bin\\rocsparse.dll' -ErrorAction SilentlyContinue\nif (-not $dll) { throw 'HIP SDK / rocsparse.dll missing - install from https://zluda.readthedocs.io/latest/hip_sdk.html' }\nif (-not ($env:Path -split ';' | Where-Object { (Split-Path $dll.FullName) -eq $_ })) { throw 'HIP SDK bin directory not on PATH' }","typeGuard":"// Rust-style guard: probe rocsparse.dll loadability before issuing cusparse calls\nfn rocsparse_available() -> bool {\n    // rocsparse() returns Err when the DLL fails to load\n    unsafe { rocsparse() }.is_ok()\n}","tryCatchPattern":"// Guard the first cusparse call and give the actionable message\nmatch cusparseCreate(&mut handle) {\n    cuda_types::cusparse::cusparseStatus_t::SUCCESS => {},\n    status if unsafe { rocsparse() }.is_err() =>\n        eprintln!(\"rocsparse.dll could not be found. Please install HIP SDK: https://zluda.readthedocs.io/latest/hip_sdk.html\"),\n    status => return Err(status),\n}","preventionTips":["Install the HIP SDK (which includes rocSPARSE) on any Windows machine running ZLUDA sparse workloads","Add the ROCm bin directory to PATH and restart the app after install/upgrade","Probe for rocsparse.dll at startup and degrade gracefully (disable sparse paths) with a clear message if absent","Re-verify PATH after ROCm SDK version changes, since installs land in versioned directories"],"tags":["windows","hip-sdk","rocsparse","zluda","missing-dll","sparse"],"backgroundTag":"missing-optional-dependency","analyzedSha":"9c8b43f242985150f86a7f485218b7b82c3e96ca","analyzedAt":"2026-09-06T09:21:08.049Z","contentChangedAt":"2026-09-06T09:21:08.049Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}