Skip to content

wasi-nn: add feature to use custom ONNX Runtime #11060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 23, 2025

Conversation

yanwucai
Copy link
Contributor

This change adds a new Cargo feature to allow the users to use a custom build of ONNX Runtime.

This will also help the users who need to remove some crypto-related dependencies imported by the download-binaries feature of ort.

@yanwucai yanwucai requested a review from a team as a code owner June 17, 2025 09:40
@alexcrichton alexcrichton requested a review from abrown June 17, 2025 14:26
onnx = ["dep:ort"]
onnx = ["ort/download-binaries"]
# Use locally built ONNX Runtime.
onnx-local-rt = ["dep:ort"]
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we flipped this around?

  • onnx would just have dep:ort and
  • onnx-download would bring in the ort/download-binaries feature

(I'm no Cargo features expert but it does seem to conform better to the idea that they should be additive).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am open to both options. But this would be a breaking change. If we flipped this around, existing users who are using onnx feature would have to switch to onnx-download feature. Is this OK?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's ok. This is all pretty experimental at this point so having to change features for a new release seems reasonable. We can document it in the release notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I flipped it around.

@@ -2,7 +2,7 @@
//! this crate. The `Box<dyn ...>` types returned by these interfaces allow
//! implementations to maintain backend-specific state between calls.

#[cfg(feature = "onnx")]
#[cfg(any(feature = "onnx", feature = "onnx-local-rt"))]
Copy link
Contributor

Choose a reason for hiding this comment

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

If you flip the features around, then these #cfgs no longer need to check both cases, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, no need to check both cases now.

@abrown abrown added this pull request to the merge queue Jun 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 20, 2025
@abrown
Copy link
Contributor

abrown commented Jun 20, 2025

@yanwucai, it looks like this failure is due to some CI job that now needs the onnx-download feature enabled. Why didn't we see this earlier? Wasmtime only runs a subset of the CI jobs for a PR but runs all the CI jobs in the merge queue, including the wasi-nn jobs that failed here. If you want to run all the CI jobs in this PR to make sure things are working as intended before merge, add the text prtest:full to the body of one of the commit messages.

@yanwucai yanwucai requested a review from a team as a code owner June 23, 2025 05:38
@yanwucai yanwucai requested review from pchickey and removed request for a team June 23, 2025 05:38
@yanwucai
Copy link
Contributor Author

Hi @abrown, the onnx feature is added back to CI in PR #11071 , I updated my branch and updated the feature. The CI jobs have passed now.

@abrown abrown added this pull request to the merge queue Jun 23, 2025
Merged via the queue into bytecodealliance:main with commit 2614e88 Jun 23, 2025
162 checks passed
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