[CUDA] Make cuDNN optional at runtime

Merged
TI
4mo ago
+2180-101

Summary

Make cuDNN an optional runtime dependency for the CUDA Execution Provider and CUDA Plugin EP. The build still uses cuDNN headers, but provider binaries no longer directly depend on cuDNN shared libraries; cuDNN is loaded lazily when enabled and available, while no-cuDNN runs use native CUDA paths where available and report NOT_IMPLEMENTED for kernels that still require cuDNN.

This also adds CI to validate no-cuDNN runtime environments.

Key Changes

AreaChanges
CUDA EP runtime loadingAdded a dynamic cuDNN loader and cuDNN symbol trampolines so CUDA provider binaries can avoid a direct cuDNN dependency.
Provider optionsAdded enable_cudnn; removed cudnn_path from CUDA EP and CUDA Plugin EP provider configuration.
CUDA Plugin EPWired optional cuDNN behavior through plugin EP config, kernel adapters, stream handles, and plugin utilities.
Python preload behaviorUpdated Python CUDA preload handling so cuDNN remains an optional dependency instead of an unconditional import/runtime requirement.
TestsAdded/updated provider option coverage and CUDA Plugin EP no-cuDNN mode using ORT_TEST_CUDA_PLUGIN_NO_CUDNN=1.
CIAdded Linux and Windows CUDA no-cuDNN workflows that build with cuDNN headers, exclude cuDNN from the runtime path, verify no direct cuDNN dependency, and run targeted tests.
DocumentationAdded docs/CUDA_cuDNN_Optional_Design.md and updated CUDA Plugin EP docs for no-cuDNN behavior and validation.

Testing

Validated locally on Linux CUDA 13:

  • Rebuilt CUDA EP / CUDA Plugin EP with cuDNN headers available at build time.
  • Verified provider binaries have no direct cuDNN dependency:
    • readelf -d ... | grep NEEDED | grep -i cudnn || echo "no cudnn DT_NEEDED"
    • ldd ... | grep -i cudnn || echo "no cudnn in ldd"
  • Ran CUDA Plugin EP no-cuDNN validation:
    • bash .env/cuda_130_plugin_no_cudnn.sh --test_plugin
    • Result: Ran 87 tests, OK (skipped=17)

Additional CI coverage is included for Linux and Windows no-cuDNN CUDA validation.