Skip to content

feat: allow to set custom OrtEnvironment and test with onnxruntime-ep-nv-tensorrt-rtx - #33

Open
theHamsta wants to merge 6 commits into
rustnn:mainfrom
theHamsta:set-ortenv
Open

theHamsta wants to merge 6 commits into
rustnn:mainfrom
theHamsta:set-ortenv

Conversation

@theHamsta

Copy link
Copy Markdown
Contributor

feat: allow to register EP libraries and test with onnxruntime-ep-nv-tensorrt-rtx

Depends on rustnn/rustnn#373

Probably we should drop the last commit that is setting the ORT log level using tracing for testing and add the functionality to control ORT log level and destination into RustNN. It might be enough to just replace pretty_env_logger here with tracing_subscriber as ort seems to be using tracing

mtavenrath pushed a commit to rustnn/rustnn that referenced this pull request Nov 8, 2026
## Summary

- [ ] Describe the user-visible and code-level changes.

The OrtEnvironment has to stay a singleton instead of a context option
because having only one environment per process is a limitation of the
`ort` crate
https://github.com/pykeio/ort/blob/6ed2423cc08ca21d0b07f467b6e4387ef1bee2ce/src/environment.rs#L515-L517
(and probably also safer to have only one from a onnxruntime
perspective).

This feature allows registering additional EPs (also in pywebnn
rustnn/pywebnn#33) or to let the user define the
path to the onnxruntime library, ort log level and ort log destination.

We could consider in another PR to bind ORT log level with our Rust log
level and implement an ort logger that uses log. I believe `ort` using
tracing for logging to simply using tracing_subscriber could get us
logging.

## Validation

- [ ] `make test`
- [ ] Relevant WPT or integration checks

## Documentation

See `docs/development/documentation-policy.md` for which page belongs to
which change.

- [ ] Updated the rustdoc comments and docs pages that describe the
changed behavior (or no documented behavior changed)
- [ ] If backend converter/executor operator support changed, ran `make
docs-backend-ops` and committed
`docs/development/backend-operator-support.md`
- [ ] `make docs-api` and `make ci-docs` pass if rustdoc or docs pages
changed
@theHamsta
theHamsta marked this pull request as ready for review November 9, 2026 11:13
@theHamsta theHamsta changed the title Draft: allow to set custom OrtEnvironment and test with onnxruntime-ep-nv-tensorrt-rtx feat: allow to set custom OrtEnvironment and test with onnxruntime-ep-nv-tensorrt-rtx Nov 9, 2026
@theHamsta

Copy link
Copy Markdown
Contributor Author

CI pass requires #31

@theHamsta

theHamsta commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Yes, when switching out pretty_env_logger with tracing_subscriber we don't need a dedicated OrtLogger implementation anymore.

It is still necessary to set the log level on the OrtEnvironment or when we want to print the log_level to stdout without RUST_LOG.

It is a bit more tidied up when ORT integrates with RUST_LOG, but it might also be unexpected if the user doesn't see anything when they are setting the log level. Maybe give a warning single stdout warning if they are setting the log without RUST_LOG or just go back to plain stdout log as before?

@theHamsta
theHamsta force-pushed the set-ortenv branch 2 times, most recently from 5bf6791 to 086b6f2 Compare November 9, 2026 14:56
This gives us automatic ORT logs without an dedicated OrtLogger
implementation.

This branch has not been deployed

No deployments
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.

1 participant