You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix native library loader silently failing when CUDA DLLs are missing
Change all 'ok = TryLoadNativeLibraryByName(...)' calls to 'ok &= ...' so that
failures accumulate instead of being overwritten by subsequent successful loads.
Initialize 'ok = true' before the loading chain.
Previously, each load call overwrote the result of the previous one, so if an
early CUDA dependency (e.g. cudnn_adv64_9) failed to load but LibTorchSharp
succeeded, 'ok' would be true. This caused:
- nativeBackendCudaLoaded set to true despite missing dependencies
- The fallback loading path was skipped
- The diagnostic trace (StringBuilder) was discarded
- Subsequent load attempts were skipped entirely
- CUDA operations failed later with cryptic errors
Now any single load failure keeps 'ok' as false, ensuring the fallback path is
attempted and the full diagnostic trace is preserved in error messages.
Fixes#1545
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments