Skip to content

[AI] Fix Windows CUDA/OpenVINO support and prevent CUDA driver mismatch crash on Linux#20799

Merged
TurboGit merged 3 commits intodarktable-org:masterfrom
andriiryzhkov:be_win
Apr 13, 2026
Merged

[AI] Fix Windows CUDA/OpenVINO support and prevent CUDA driver mismatch crash on Linux#20799
TurboGit merged 3 commits intodarktable-org:masterfrom
andriiryzhkov:be_win

Conversation

@andriiryzhkov
Copy link
Copy Markdown
Contributor

Two fixes for AI backend reliability on Windows and Linux:

  • Windows CUDA/OpenVINO support: fix EP probing, library detection, and DLL loading so CUDA and OpenVINO providers work on Windows alongside the bundled DirectML build
  • Linux CUDA driver check: detect driver/runtime version mismatch before enabling CUDA EP to prevent ORT's abort() crash during inference

Windows changes

  • Enable CUDA and OpenVINO provider visibility on Windows (backend_common.c)
  • Add Windows DLL search paths for user-installed ORT libraries (%LOCALAPPDATA%/onnxruntime-cuda/ etc.)
  • Scan for onnxruntime.dll instead of .so files
  • Set SetDllDirectoryW to the custom ORT directory so provider DLLs (CUDA, cuDNN, cublas) are found by LoadLibrary
  • Look up EP symbols in the custom-loaded g_ort_module first, fall back to system onnxruntime.dll – fixes the case where the bundled DirectML build doesn't have CUDA symbols

Linux CUDA driver check

  • New _check_cuda_driver_compat(): loads libcudart.so, calls cudaDriverGetVersion / cudaRuntimeGetVersion, compares versions
  • If driver < runtime, logs a clear message and disables CUDA EP instead of letting ORT abort() mid-inference
  • Result is cached per process – check runs only once
  • Called from _try_provider before any CUDA EP symbol lookup

Comment thread src/ai/backend_onnx.c Outdated
Copy link
Copy Markdown
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit TurboGit merged commit 8b69c56 into darktable-org:master Apr 13, 2026
5 checks passed
@TurboGit TurboGit added this to the 5.6 milestone Apr 13, 2026
@TurboGit TurboGit added bugfix pull request fixing a bug priority: high core features are broken and not usable at all, software crashes labels Apr 13, 2026
@andriiryzhkov andriiryzhkov deleted the be_win branch April 13, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug priority: high core features are broken and not usable at all, software crashes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants