microsoft / microsoft/onnxruntime

[Feature Request] Add a real async run method to onnxruntime-node

Open
#19,611 5 comments 3 reactions 1 assignee View on GitHub

@fs-eire is already working on this.

Since Feb 23, 2024.

feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the feature request

There should really be a true async version of `run` in `onnxruntime-node`, running computationally intensive things on the event loop will stop everything else from happening while it is running, e.g. a web server from answering requests.

This can be done by wrapping `RunAsync` behind a [`Napi::Promise`](https://github.com/nodejs/node-addon-api/blob/main/doc/promises.md) and [`Napi::TypedThreadSafeFunction`](https://github.com/nodejs/node-addon-api/blob/main/doc/typed_threadsafe_function.md) to run on the onnxruntime thread pool, or [`Napi::AsyncWorker`](https://github.com/nodejs/node-addon-api/blob/main/doc/async_worker.md) for the Node.js/libuv thread pool.

See https://github.com/microsoft/onnxruntime/pull/19610

### Describe scenario use case

Don't block the event loop while running inference, which is naturally computationally intensive.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.