Skip to content

Remove hard core ORT dependency from CUDA plugin EP packages#28992

Merged
tianleiwu merged 1 commit into
tlwu/20260605/cuda_plugin_min_ort_versionfrom
tlwu/remove_ort_dependency_for_cuda_plugin
Jun 11, 2026
Merged

Remove hard core ORT dependency from CUDA plugin EP packages#28992
tianleiwu merged 1 commit into
tlwu/20260605/cuda_plugin_min_ort_versionfrom
tlwu/remove_ort_dependency_for_cuda_plugin

Conversation

@tianleiwu

@tianleiwu tianleiwu commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

The CUDA plugin EP packages (onnxruntime-ep-cuda12/onnxruntime-ep-cuda13 wheels and the
Microsoft.ML.OnnxRuntime.EP.Cuda NuGet package) currently declare a hard dependency on the core
onnxruntime package. That is wrong for onnxruntime-gpu users, who would otherwise be forced to pull in
the CPU onnxruntime/Microsoft.ML.OnnxRuntime package. This change drops the hard dependency from both
packages, documents the core-package prerequisite in the READMEs, and installs/pins the core ORT package
explicitly in CI — mirroring what was done for the WebGPU plugin EP in #28384.

The minimum compatible ORT version remains the single source of truth in
plugin-ep-cuda/MIN_ONNXRUNTIME_VERSION; it is now injected into
each package's README at build/pack time, and the native plugin EP validates compatibility at registration
time.

Summary of Changes

Python wheel

File Change
plugin-ep-cuda/python/pyproject.toml.in Removed the dependencies = ["onnxruntime>=..."] block.
plugin-ep-cuda/python/build_wheel.py Import the shared gen_file_from_template helper; render the staged package README with the minimum ORT version; stop injecting the version into pyproject.toml.
plugin-ep-cuda/python/onnxruntime_ep_cuda/README.md Added a Prerequisites section and an explicit pip install "onnxruntime>=@min_onnxruntime_version@" step.

C# NuGet package

File Change
plugin-ep-cuda/csharp/Microsoft.ML.OnnxRuntime.EP.Cuda/Microsoft.ML.OnnxRuntime.EP.Cuda.csproj Removed the OnnxRuntimeMinVersion resolution/validation machinery and the hard Microsoft.ML.OnnxRuntime PackageReference.
plugin-ep-cuda/csharp/Microsoft.ML.OnnxRuntime.EP.Cuda/README.md Added a Prerequisites section and templatized the version requirement.
plugin-ep-cuda/csharp/pack_nuget.py Render the staged README via the shared helper; dropped the -p:OnnxRuntimeMinVersionFile plumbing from dotnet build/pack.

Shared / docs

File Change
plugin-ep-cuda/_packaging_utils.py New shared gen_file_from_template helper (matches the WebGPU plugin's utility).
plugin-ep-cuda/README.md Documented the no-hard-dependency behavior and the C# package.

Tests & CI

File Change
plugin-ep-cuda/csharp/test/CudaEpNuGetTest/CudaEpNuGetTest.csproj Reference the core Microsoft.ML.OnnxRuntime package explicitly via $(OrtCoreTestVersion) (no longer transitively pulled in).
tools/ci_build/github/azure-pipelines/stages/plugin-linux-cuda-test-stage.yml Dropped the now-unnecessary --no-deps install flag and updated the comment.
tools/ci_build/github/azure-pipelines/stages/plugin-win-cuda-test-stage.yml Set OrtCoreTestVersion from MIN_ONNXRUNTIME_VERSION and pass it to dotnet build.

Testing

  • python -m ruff check and lintrunner pass on the changed files.
  • Python scripts compile (python -m py_compile).
  • CI: the Linux/Windows CUDA plugin test stages install the core onnxruntime package explicitly and verify
    the plugin wheel installs without altering the pinned core version; the NuGet test project references the
    core package explicitly and pins it to the minimum supported version.

Motivation and Context

Follow-up to PR #28824 (CUDA plugin EP minimum ORT version / version-gated callbacks), kept separate to keep
that PR focused on the version-gating change. Mirrors the WebGPU plugin EP packaging change in #28384. The
CUDA case is stronger: a hard dependency on the CPU onnxruntime package is incorrect for onnxruntime-gpu
users.

Checklist

  • Tests added/updated (CI test stages and NuGet test project updated)
  • Documentation updated (package and top-level READMEs)
  • No breaking changes (consumers must now install the core ORT package explicitly, documented in READMEs)
  • CI passes

@tianleiwu tianleiwu merged commit 25d37c3 into tlwu/20260605/cuda_plugin_min_ort_version Jun 11, 2026
6 checks passed
@tianleiwu tianleiwu deleted the tlwu/remove_ort_dependency_for_cuda_plugin branch June 11, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants