microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.83k stars 2.94k forks source link

Pushing Rust bindings forward #21533

Open Chiichen opened 4 months ago

Chiichen commented 4 months ago

There has been a long discussion about adding Rust bindings to this repository( #11992 #7231), but I've noticed that there has been little progress on the Rust bindings since the initial PR #12606 . Here are some current to-do items that I think we can have some discussion around, and I'd be glad to make some contributions to push the Rust bindings forward.

Chiichen commented 4 months ago

I'm not sure which member of the organization I should communicate with regarding the work on Rust Binding. I just noticed that you participated in previous discussions about Rust Binding, and I wanted to see what your thoughts are on this issue. @snnn @devigned @edgchen1

snnn commented 4 months ago

@pranavsharma / @sophies927, what do you think?

cbourjau commented 4 months ago

Do the binding need to live in this repository? They target the stable C-API, after all, and this project already has a behemoth of a testing infrastructure. Having the bindings live in a different repository may make their development easier.

Chiichen commented 4 months ago

Do the binding need to live in this repository? They target the stable C-API, after all, and this project already has a behemoth of a testing infrastructure. Having the bindings live in a different repository may make their development easier.

devigned commented 3 months ago

This library will not help you do any build work related to onnxruntime itself (these work is usually done by libraries like onnxruntime-sys in traditional rust binding libraries to provide low-level Rust APIs based on C APIs)

@Chiichen does https://github.com/pykeio/ort/tree/main/ort-sys satisfy the build / low level access you are describing?

Chiichen commented 3 months ago

这个库不会帮你做任何与 onnxruntime 本身相关的构建工作(这些工作通常由传统 rust 绑定库中的 onnxruntime-sys 等库来完成,以提供基于 C API 的低级 Rust API)

@Chiichenhttps://github.com/pykeio/ort/tree/main/ort-sys是否满足您描述的构建/低级访问?

No, it doesn't. I hope that when I use onnxruntime-sys, it can directly help me build onnxruntime from source code, and link it into the rust program automatically. You will find that this library(ort-sys) does not contain the source code of onnxruntime at all. Actually, It does not build onnxruntime from source code, but directly links to the built onnxruntime static library by specifying ORT_LIB_LOCATION. This means that for the user of ort, he needs to build onnxruntime separately once, although it provides some pre-built binaries, but for some platforms (i.e Android), you still need to build it yourself. I've filed an issue (https://github.com/pykeio/ort/issues/246) asking if they could add similar functionality, but they clearly marked it as not planned