diff --git a/camera_hub/Cargo.lock b/camera_hub/Cargo.lock index d5b1b74..2563f38 100644 --- a/camera_hub/Cargo.lock +++ b/camera_hub/Cargo.lock @@ -149,7 +149,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -160,7 +160,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -704,17 +704,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid", - "pem-rfc7468 0.7.0", - "zeroize", -] - -[[package]] -name = "der" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fd89660b2dc699704064e59e9dba0147b903e85319429e131620d022be411b" -dependencies = [ - "pem-rfc7468 1.0.0", + "pem-rfc7468", "zeroize", ] @@ -803,7 +793,7 @@ version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "der 0.7.10", + "der", "digest", "elliptic-curve", "rfc6979", @@ -855,7 +845,7 @@ dependencies = [ "generic-array", "group", "hkdf", - "pem-rfc7468 0.7.0", + "pem-rfc7468", "pkcs8", "rand_core 0.6.4", "sec1", @@ -928,7 +918,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -976,12 +966,6 @@ dependencies = [ "thiserror 2.0.18", ] -[[package]] -name = "fastrand" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" - [[package]] name = "fax" version = "0.2.6" @@ -1072,21 +1056,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.2" @@ -1902,7 +1871,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2335,9 +2304,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.16" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" dependencies = [ "bitflags", "libc", @@ -2575,23 +2544,6 @@ dependencies = [ "getrandom 0.2.17", ] -[[package]] -name = "native-tls" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "ndarray" version = "0.16.1" @@ -2878,50 +2830,12 @@ dependencies = [ "tls_codec", ] -[[package]] -name = "openssl" -version = "0.10.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951c002c75e16ea2c65b8c7e4d3d51d5530d8dfa7d060b4776828c88cfb18ecf" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "openssl-probe" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" -[[package]] -name = "openssl-sys" -version = "0.9.112" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d55af3b3e226502be1526dfdba67ab0e9c96fc293004e79576b2b9edb0dbdb" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "order-stat" version = "0.1.3" @@ -2943,8 +2857,6 @@ dependencies = [ [[package]] name = "ort-sys" version = "2.0.0-rc.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2aba9f5c7c479925205799216e7e5d07cc1d4fa76ea8058c60a9a30f6a4e890" dependencies = [ "flate2", "pkg-config", @@ -3020,15 +2932,6 @@ dependencies = [ "base64ct", ] -[[package]] -name = "pem-rfc7468" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.3.2" @@ -3076,7 +2979,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.10", + "der", "spki", ] @@ -3525,9 +3428,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f450ad9c3b1da563fb6948a8e0fb0fb9269711c9c73d9ea1de5058c79c8d643a" +checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16" dependencies = [ "bitflags", ] @@ -3714,7 +3617,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3724,7 +3627,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" dependencies = [ "aws-lc-rs", + "log", "once_cell", + "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -3771,7 +3676,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3858,7 +3763,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", - "der 0.7.10", + "der", "generic-array", "pkcs8", "subtle", @@ -4146,7 +4051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -4187,7 +4092,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der 0.7.10", + "der", ] [[package]] @@ -4282,19 +4187,6 @@ dependencies = [ "xattr", ] -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.2", - "once_cell", - "rustix", - "windows-sys 0.61.2", -] - [[package]] name = "thiserror" version = "1.0.69" @@ -4621,15 +4513,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0" dependencies = [ "base64", - "der 0.8.0", "log", - "native-tls", "percent-encoding", + "rustls", "rustls-pki-types", + "rustls-platform-verifier", "socks", "ureq-proto", "utf8-zero", - "webpki-root-certs", + "webpki-roots", ] [[package]] @@ -4696,12 +4588,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -4869,6 +4755,15 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "webpki-roots" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.12" @@ -4907,7 +4802,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] diff --git a/camera_hub/Cargo.toml b/camera_hub/Cargo.toml index d6cf5cc..05681b3 100644 --- a/camera_hub/Cargo.toml +++ b/camera_hub/Cargo.toml @@ -46,3 +46,6 @@ linfa-clustering = { version = "0.8.1", optional = true } # Raspberry Specific Dependencies secluso-motion-ai = { path = "../motion_ai/pipeline", optional = true, default-features = false } + +[patch.crates-io] +ort-sys = { path = "../third_party/ort-sys-2.0.0-rc.10" } diff --git a/motion_ai/cli/Cargo.toml b/motion_ai/cli/Cargo.toml index ff3f32e..3ce0f7d 100644 --- a/motion_ai/cli/Cargo.toml +++ b/motion_ai/cli/Cargo.toml @@ -13,3 +13,6 @@ ffmpeg-next = { version = "7.1.0", default-features = false, optional = true } video-rs= { version = "0.10.5", features = ["ndarray"], optional = true } secluso-motion-ai = { path = "../pipeline" } anyhow = "1.0.102" + +[patch.crates-io] +ort-sys = { path = "../../third_party/ort-sys-2.0.0-rc.10" } diff --git a/motion_ai/pipeline/Cargo.toml b/motion_ai/pipeline/Cargo.toml index cc3c08c..2455bf9 100644 --- a/motion_ai/pipeline/Cargo.toml +++ b/motion_ai/pipeline/Cargo.toml @@ -38,3 +38,6 @@ video-rs= { version = "0.10.5", features = ["ndarray"], optional = true } crossbeam-channel = "0.5.15" flume = "0.11.1" include_dir="0.7.4" + +[patch.crates-io] +ort-sys = { path = "../../third_party/ort-sys-2.0.0-rc.10" } diff --git a/server/Cargo.lock b/server/Cargo.lock index 9a03fb0..3ea5946 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -8,7 +8,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ - "crypto-common 0.1.6", + "crypto-common", "generic-array", ] @@ -19,18 +19,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", - "cipher 0.4.4", - "cpufeatures", -] - -[[package]] -name = "aes" -version = "0.9.0-rc.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04097e08a47d9ad181c2e1f4a5fabc9ae06ce8839a333ba9a949bcb0d31fd2a3" -dependencies = [ - "cipher 0.5.1", - "cpubits", + "cipher", "cpufeatures", ] @@ -41,23 +30,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead", - "aes 0.8.4", - "cipher 0.4.4", + "aes", + "cipher", "ctr", "ghash", "subtle", ] -[[package]] -name = "aes-keywrap" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b6f24a1f796bc46415a1d0d18dc0a8203ccba088acf5def3291c4f61225522" -dependencies = [ - "aes 0.9.0-rc.4", - "byteorder", -] - [[package]] name = "aho-corasick" version = "1.1.4" @@ -82,30 +61,6 @@ version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - [[package]] name = "async-stream" version = "0.3.6" @@ -125,7 +80,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -136,7 +91,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -194,18 +149,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -224,29 +167,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" -[[package]] -name = "binstring" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0669d5a35b64fdb5ab7fb19cae13148b6b5cbdf4b8247faf54ece47f699c8cef" - [[package]] name = "bitflags" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" -[[package]] -name = "blake2b_simd" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79834656f71332577234b50bfc009996f7449e0c056884e6a02492ded0ca2f3" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -268,27 +194,12 @@ version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" -[[package]] -name = "castaway" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" -dependencies = [ - "rustversion", -] - [[package]] name = "cc" version = "1.2.59" @@ -338,18 +249,8 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "crypto-common 0.1.6", - "inout 0.1.4", -] - -[[package]] -name = "cipher" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34d8227fe1ba289043aeb13792056ff80fd6de1a9f49137a5f499de8e8c78ea" -dependencies = [ - "crypto-common 0.2.1", - "inout 0.2.2", + "crypto-common", + "inout", ] [[package]] @@ -361,17 +262,6 @@ dependencies = [ "cc", ] -[[package]] -name = "coarsetime" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e58eb270476aa4fc7843849f8a35063e8743b4dbcdf6dd0f8ea0886980c204c2" -dependencies = [ - "libc", - "wasix", - "wasm-bindgen", -] - [[package]] name = "combine" version = "4.6.7" @@ -382,33 +272,12 @@ dependencies = [ "memchr", ] -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "const-oid" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b" - [[package]] name = "const-oid" version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "constant_time_eq" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" - [[package]] name = "cookie" version = "0.18.1" @@ -446,12 +315,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "cpubits" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef0c543070d296ea414df2dd7625d1b24866ce206709d8a4a424f28377f5861" - [[package]] name = "cpufeatures" version = "0.2.17" @@ -490,59 +353,13 @@ dependencies = [ "typenum", ] -[[package]] -name = "crypto-common" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" -dependencies = [ - "hybrid-array", -] - -[[package]] -name = "ct-codecs" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b10589d1a5e400d61f9f38f12f884cfd080ff345de8f17efda36fe0e4a02aa8" - [[package]] name = "ctr" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.4.4", -] - -[[package]] -name = "curl" -version = "0.4.49" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79fc3b6dd0b87ba36e565715bf9a2ced221311db47bd18011676f24a6066edbc" -dependencies = [ - "curl-sys", - "libc", - "openssl-probe 0.1.6", - "openssl-sys", - "schannel", - "socket2 0.6.3", - "windows-sys 0.59.0", -] - -[[package]] -name = "curl-sys" -version = "0.4.87+curl-8.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a460380f0ef783703dcbe909107f39c162adeac050d73c850055118b5b6327" -dependencies = [ - "cc", - "libc", - "libnghttp2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", - "windows-sys 0.59.0", + "cipher", ] [[package]] @@ -569,7 +386,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -586,39 +403,17 @@ dependencies = [ "parking_lot_core", ] -[[package]] -name = "der" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" -dependencies = [ - "const-oid 0.6.2", - "der_derive", -] - [[package]] name = "der" version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ - "const-oid 0.9.6", + "const-oid", "pem-rfc7468", "zeroize", ] -[[package]] -name = "der_derive" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8aed3b3c608dc56cf36c45fe979d04eda51242e6703d8d0bb03426ef7c41db6a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure 0.12.6", -] - [[package]] name = "deranged" version = "0.5.8" @@ -658,7 +453,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -668,8 +463,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", - "const-oid 0.9.6", - "crypto-common 0.1.6", + "const-oid", + "crypto-common", "subtle", ] @@ -681,7 +476,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -696,7 +491,7 @@ version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "der 0.7.10", + "der", "digest", "elliptic-curve", "rfc6979", @@ -705,21 +500,13 @@ dependencies = [ ] [[package]] -name = "ece" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ea1d2f2cc974957a4e2575d8e5bb494549bab66338d6320c2789abcfff5746" +name = "ece-native" +version = "0.4.0" +source = "git+https://github.com/leotaku/web-push-native.git?rev=88a80f1136257366fe15fddf019e2fc9b61e7517#88a80f1136257366fe15fddf019e2fc9b61e7517" dependencies = [ - "base64 0.21.7", - "byteorder", - "hex", + "aes-gcm", "hkdf", - "lazy_static", - "once_cell", - "openssl", - "serde", "sha2", - "thiserror 1.0.69", ] [[package]] @@ -732,16 +519,6 @@ dependencies = [ "signature", ] -[[package]] -name = "ed25519-compact" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ce99a9e19c84beb4cc35ece85374335ccc398240712114c85038319ed709bd" -dependencies = [ - "ct-codecs", - "getrandom 0.3.4", -] - [[package]] name = "ed25519-dalek" version = "2.2.0" @@ -808,27 +585,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "event-listener" -version = "5.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener", - "pin-project-lite", -] - [[package]] name = "fastrand" version = "2.4.0" @@ -883,21 +639,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.2" @@ -949,19 +690,6 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" -[[package]] -name = "futures-lite" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - [[package]] name = "futures-sink" version = "0.3.32" @@ -1152,12 +880,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - [[package]] name = "hkdf" version = "0.12.4" @@ -1176,30 +898,6 @@ dependencies = [ "digest", ] -[[package]] -name = "hmac-sha1-compact" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b3ba31f6dc772cc8221ce81dbbbd64fa1e668255a6737d95eeace59b5a8823" - -[[package]] -name = "hmac-sha256" -version = "1.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec9d92d097f4749b64e8cc33d924d9f40a2d4eb91402b458014b781f5733d60f" -dependencies = [ - "digest", -] - -[[package]] -name = "hmac-sha512" -version = "1.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "019ece39bbefc17f13f677a690328cb978dbf6790e141a3c24e66372cb38588b" -dependencies = [ - "digest", -] - [[package]] name = "http" version = "0.2.12" @@ -1267,15 +965,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "hybrid-array" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214" -dependencies = [ - "typenum", -] - [[package]] name = "hyper" version = "0.14.32" @@ -1343,7 +1032,7 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-channel", "futures-util", @@ -1522,15 +1211,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "inout" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4250ce6452e92010fdf7268ccc5d14faa80bb12fc741938534c58f16804e03c7" -dependencies = [ - "hybrid-array", -] - [[package]] name = "ipnet" version = "2.12.0" @@ -1558,32 +1238,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "isahc" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49980b382c0e59635b99bb2d9ef4c039a90aefa1b821d5d7a8526d4504e14594" -dependencies = [ - "async-channel", - "castaway", - "crossbeam-utils", - "curl", - "curl-sys", - "encoding_rs", - "event-listener", - "futures-lite", - "http 0.2.12", - "log", - "mime", - "polling", - "slab", - "sluice", - "tracing", - "tracing-futures", - "url", - "waker-fn", -] - [[package]] name = "itoa" version = "1.0.18" @@ -1631,7 +1285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" dependencies = [ "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -1662,14 +1316,14 @@ version = "10.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0529410abe238729a60b108898784df8984c87f6054c9c4fcacc47e4803c1ce1" dependencies = [ - "base64 0.22.1", + "base64", "ed25519-dalek", "getrandom 0.2.17", "hmac", "js-sys", "p256", "p384", - "pem 3.0.6", + "pem", "rand 0.8.5", "rsa", "serde", @@ -1679,46 +1333,6 @@ dependencies = [ "simple_asn1", ] -[[package]] -name = "jwt-simple" -version = "0.12.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3991f54af4b009bb6efe01aa5a4fcce9ca52f3de7a104a3f6b6e2ad36c852c48" -dependencies = [ - "anyhow", - "binstring", - "blake2b_simd", - "coarsetime", - "ct-codecs", - "ed25519-compact", - "hmac-sha1-compact", - "hmac-sha256", - "hmac-sha512", - "k256", - "p256", - "p384", - "rand 0.8.5", - "serde", - "serde_json", - "superboring", - "thiserror 2.0.18", - "zeroize", -] - -[[package]] -name = "k256" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2", - "signature", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -1746,28 +1360,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" -[[package]] -name = "libnghttp2-sys" -version = "0.1.13+1.68.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "492e00167f1418c15648144f42bbfc63099806ecee9bf8d09a6353d6b4856b3c" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "libz-sys" -version = "1.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc3a226e576f50782b3305c5ccf458698f92798987f551c6a02efe8276721e22" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -1960,56 +1552,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "openssl" -version = "0.10.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951c002c75e16ea2c65b8c7e4d3d51d5530d8dfa7d060b4776828c88cfb18ecf" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - [[package]] name = "openssl-probe" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" -[[package]] -name = "openssl-sys" -version = "0.9.112" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d55af3b3e226502be1526dfdba67ab0e9c96fc293004e79576b2b9edb0dbdb" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "p256" version = "0.13.2" @@ -2034,12 +1582,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - [[package]] name = "parking_lot" version = "0.12.5" @@ -2083,18 +1625,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.117", -] - -[[package]] -name = "pem" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" -dependencies = [ - "base64 0.13.1", - "once_cell", - "regex", + "syn", ] [[package]] @@ -2103,7 +1634,7 @@ version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" dependencies = [ - "base64 0.22.1", + "base64", "serde_core", ] @@ -2122,26 +1653,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" -[[package]] -name = "pin-project" -version = "1.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "pin-project-lite" version = "0.2.17" @@ -2154,7 +1665,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" dependencies = [ - "der 0.7.10", + "der", "pkcs8", "spki", ] @@ -2165,43 +1676,23 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.10", + "der", "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - [[package]] name = "plist" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" dependencies = [ - "base64 0.22.1", + "base64", "indexmap", "quick-xml", "serde", "time", ] -[[package]] -name = "polling" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" -dependencies = [ - "cfg-if", - "concurrent-queue", - "hermit-abi", - "pin-project-lite", - "rustix", - "windows-sys 0.61.2", -] - [[package]] name = "polyval" version = "0.6.2" @@ -2245,7 +1736,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.117", + "syn", ] [[package]] @@ -2274,7 +1765,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", "version_check", "yansi", ] @@ -2450,19 +1941,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", -] - -[[package]] -name = "regex" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", + "syn", ] [[package]] @@ -2488,7 +1967,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "encoding_rs", "futures-channel", @@ -2599,7 +2078,7 @@ dependencies = [ "proc-macro2", "quote", "rocket_http", - "syn 2.0.117", + "syn", "unicode-xid", "version_check", ] @@ -2637,7 +2116,7 @@ version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" dependencies = [ - "const-oid 0.9.6", + "const-oid", "digest", "num-bigint-dig", "num-integer", @@ -2645,7 +2124,6 @@ dependencies = [ "pkcs1", "pkcs8", "rand_core 0.6.4", - "sha2", "signature", "spki", "subtle", @@ -2700,7 +2178,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" dependencies = [ - "openssl-probe 0.2.1", + "openssl-probe", "rustls-pki-types", "schannel", "security-framework", @@ -2804,24 +2282,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", - "der 0.7.10", + "der", "generic-array", "pkcs8", "subtle", "zeroize", ] -[[package]] -name = "sec1_decode" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6326ddc956378a0739200b2c30892dccaf198992dfd7323274690b9e188af23" -dependencies = [ - "der 0.4.5", - "pem 0.8.3", - "thiserror 1.0.69", -] - [[package]] name = "secluso-client-server-lib" version = "1.0.0" @@ -2837,7 +2304,8 @@ name = "secluso-server" version = "1.0.0" dependencies = [ "anyhow", - "base64 0.22.1", + "base64", + "base64ct", "chrono", "dashmap", "jsonwebtoken", @@ -2851,7 +2319,7 @@ dependencies = [ "serde_json", "subtle", "time", - "web-push", + "web-push-native", ] [[package]] @@ -2918,7 +2386,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3019,17 +2487,6 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" -[[package]] -name = "sluice" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "160b744a45e8261307bcfe03c98e2f8274502207d534c9a64b675c4db1b6bd58" -dependencies = [ - "async-channel", - "futures-core", - "futures-io", -] - [[package]] name = "smallvec" version = "1.15.1" @@ -3069,7 +2526,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der 0.7.10", + "der", ] [[package]] @@ -3102,32 +2559,6 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "superboring" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af44d8b60bc4ffb966f80d1582d579c84f559419e7abafb948d706fc6f95b3d4" -dependencies = [ - "aes-gcm", - "aes-keywrap", - "getrandom 0.2.17", - "hmac-sha256", - "hmac-sha512", - "rand 0.8.5", - "rsa", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.117" @@ -3148,18 +2579,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "synstructure" version = "0.13.2" @@ -3168,7 +2587,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3231,7 +2650,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3242,7 +2661,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3334,7 +2753,7 @@ checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3463,7 +2882,6 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3477,7 +2895,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3490,16 +2908,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "tracing-log" version = "0.2.0" @@ -3578,7 +2986,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "crypto-common 0.1.6", + "crypto-common", "subtle", ] @@ -3612,24 +3020,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "waker-fn" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" - [[package]] name = "walkdir" version = "2.5.0" @@ -3673,15 +3069,6 @@ dependencies = [ "wit-bindgen", ] -[[package]] -name = "wasix" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1757e0d1f8456693c7e5c6c629bdb54884e032aa0bb53c155f6a39f94440d332" -dependencies = [ - "wasi", -] - [[package]] name = "wasm-bindgen" version = "0.2.117" @@ -3724,7 +3111,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.117", + "syn", "wasm-bindgen-shared", ] @@ -3772,25 +3159,16 @@ dependencies = [ ] [[package]] -name = "web-push" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5c305b9ee2993ab68b7744b13ef32231d83600dd879ac8183b4c76ae31d28ac" +name = "web-push-native" +version = "0.4.0" +source = "git+https://github.com/leotaku/web-push-native.git?rev=88a80f1136257366fe15fddf019e2fc9b61e7517#88a80f1136257366fe15fddf019e2fc9b61e7517" dependencies = [ - "async-trait", - "chrono", - "ct-codecs", - "ece", - "futures-lite", - "http 0.2.12", - "isahc", - "jwt-simple", - "log", - "pem 3.0.6", - "sec1_decode", - "serde", - "serde_derive", - "serde_json", + "aes-gcm", + "ece-native", + "hkdf", + "http 1.4.0", + "p256", + "sha2", ] [[package]] @@ -3861,7 +3239,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3872,7 +3250,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -3928,15 +3306,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.60.2" @@ -4237,7 +3606,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn 2.0.117", + "syn", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -4253,7 +3622,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.117", + "syn", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -4329,8 +3698,8 @@ checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", - "synstructure 0.13.2", + "syn", + "synstructure", ] [[package]] @@ -4350,7 +3719,7 @@ checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] @@ -4370,8 +3739,8 @@ checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", - "synstructure 0.13.2", + "syn", + "synstructure", ] [[package]] @@ -4410,7 +3779,7 @@ checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" dependencies = [ "proc-macro2", "quote", - "syn 2.0.117", + "syn", ] [[package]] diff --git a/server/Cargo.toml b/server/Cargo.toml index ba88a59..87bc0bd 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -19,5 +19,6 @@ time = "0.3.47" plist = "1.8.0" anyhow = "1.0.102" secluso-server-backbone = { path = "../server_backbone" } -web-push = "0.11.0" +web-push-native = { git = "https://github.com/leotaku/web-push-native.git", rev = "88a80f1136257366fe15fddf019e2fc9b61e7517", default-features = false } +base64ct = { version = "1.8.3", features = ["alloc", "std"] } once_cell = "1" diff --git a/server/src/notification_target.rs b/server/src/notification_target.rs index edbf847..c079483 100644 --- a/server/src/notification_target.rs +++ b/server/src/notification_target.rs @@ -3,12 +3,11 @@ //! SPDX-License-Identifier: GPL-3.0-or-later use anyhow::{Context, Result}; +use base64ct::{Base64UrlUnpadded, Encoding}; use reqwest::Url; use secluso_server_backbone::types::{IosRelayBinding, NotificationTarget}; -use std::env; -use web_push::{ - ContentEncoding, IsahcWebPushClient, SubscriptionInfo, WebPushClient, WebPushMessageBuilder, -}; +use std::{env, time::Duration}; +use web_push_native::{p256, Auth, WebPushBuilder}; pub const UNIFIEDPUSH_ALLOWED_HOSTS_ENV: &str = "SECLUSO_UNIFIEDPUSH_ALLOWED_HOSTS"; @@ -260,15 +259,46 @@ pub async fn send_notification( payload: &[u8], ) -> Result<()> { let endpoint_url = policy.validate_endpoint_url(endpoint_url)?.to_string(); - let subscription_info = - SubscriptionInfo::new(endpoint_url, pub_key.to_string(), auth.to_string()); - - let mut builder = WebPushMessageBuilder::new(&subscription_info); - builder.set_payload(ContentEncoding::Aes128Gcm, payload); - builder.set_ttl(60); - - let client = IsahcWebPushClient::new()?; - client.send(builder.build()?).await?; + let endpoint = endpoint_url + .parse() + .with_context(|| format!("Invalid UnifiedPush endpoint URI: {endpoint_url}"))?; + let pub_key = Base64UrlUnpadded::decode_vec(pub_key) + .context("UnifiedPush public key is not valid base64url")?; + let ua_public = p256::PublicKey::from_sec1_bytes(&pub_key) + .context("UnifiedPush public key is not a valid P-256 point")?; + let auth = Base64UrlUnpadded::decode_vec(auth) + .context("UnifiedPush auth secret is not valid base64url")?; + let auth: [u8; 16] = auth + .try_into() + .map_err(|_| anyhow::anyhow!("UnifiedPush auth secret must decode to 16 bytes."))?; + let ua_auth: Auth = auth.into(); + + let request = WebPushBuilder::new(endpoint, ua_public, ua_auth) + .with_valid_duration(Duration::from_secs(60)) + .build(payload.to_vec()) + .context("Failed to build UnifiedPush request")?; + + let request_url = request.uri().to_string(); + let method = reqwest::Method::from_bytes(request.method().as_str().as_bytes()) + .context("Failed to convert UnifiedPush HTTP method")?; + let client = reqwest::Client::new(); + let mut request_builder = client.request(method, request_url); + for (name, value) in request.headers() { + request_builder = request_builder.header(name, value); + } + let response = request_builder + .body(request.into_body()) + .send() + .await + .context("UnifiedPush request failed")?; + if !response.status().is_success() { + let status = response.status(); + let body = response + .text() + .await + .unwrap_or_else(|_| "".to_string()); + anyhow::bail!("UnifiedPush endpoint returned {}: {}", status, body); + } Ok(()) } diff --git a/third_party/ort-sys-2.0.0-rc.10/.cargo-ok b/third_party/ort-sys-2.0.0-rc.10/.cargo-ok new file mode 100644 index 0000000..5f8b795 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/.cargo-ok @@ -0,0 +1 @@ +{"v":1} \ No newline at end of file diff --git a/third_party/ort-sys-2.0.0-rc.10/.cargo_vcs_info.json b/third_party/ort-sys-2.0.0-rc.10/.cargo_vcs_info.json new file mode 100644 index 0000000..f86d357 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "daf91046dc814d5aea61d24e0daf571c7df91930" + }, + "path_in_vcs": "ort-sys" +} \ No newline at end of file diff --git a/third_party/ort-sys-2.0.0-rc.10/Cargo.lock b/third_party/ort-sys-2.0.0-rc.10/Cargo.lock new file mode 100644 index 0000000..2b30719 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/Cargo.lock @@ -0,0 +1,759 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" + +[[package]] +name = "bitflags" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "errno" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "filetime" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys", +] + +[[package]] +name = "flate2" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "itoa" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" + +[[package]] +name = "libc" +version = "0.2.169" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", + "redox_syscall", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "log" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" + +[[package]] +name = "miniz_oxide" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" +dependencies = [ + "adler2", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "once_cell" +version = "1.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" + +[[package]] +name = "openssl" +version = "0.10.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e145e1651e858e820e4860f7b9c5e169bc1d8ce1c86043be79fa7b7634821847" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "ort-sys" +version = "2.0.0-rc.10" +dependencies = [ + "flate2", + "glob", + "pkg-config", + "sha2", + "tar", + "ureq", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "proc-macro2" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "redox_syscall" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys", +] + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "socks" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b" +dependencies = [ + "byteorder", + "libc", + "winapi", +] + +[[package]] +name = "syn" +version = "2.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tar" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +dependencies = [ + "fastrand", + "getrandom", + "once_cell", + "rustix 1.0.7", + "windows-sys", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-ident" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" + +[[package]] +name = "ureq" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7a3e9af6113ecd57b8c63d3cd76a385b2e3881365f1f489e54f49801d0c83ea" +dependencies = [ + "base64", + "der", + "log", + "native-tls", + "percent-encoding", + "rustls-pemfile", + "rustls-pki-types", + "socks", + "ureq-proto", + "utf-8", + "webpki-root-certs 0.26.11", +] + +[[package]] +name = "ureq-proto" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fadf18427d33828c311234884b7ba2afb57143e6e7e69fda7ee883b624661e36" +dependencies = [ + "base64", + "http", + "httparse", + "log", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "webpki-root-certs" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75c7f0ef91146ebfb530314f5f1d24528d7f0767efbfd31dce919275413e393e" +dependencies = [ + "webpki-root-certs 1.0.0", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a83f7e1a9f8712695c03eabe9ed3fbca0feff0152f33f12593e5a6303cb1a4" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "xattr" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e105d177a3871454f754b33bb0ee637ecaaac997446375fd3e5d43a2ed00c909" +dependencies = [ + "libc", + "linux-raw-sys 0.4.15", + "rustix 0.38.44", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/third_party/ort-sys-2.0.0-rc.10/Cargo.toml b/third_party/ort-sys-2.0.0-rc.10/Cargo.toml new file mode 100644 index 0000000..2ac0593 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/Cargo.toml @@ -0,0 +1,115 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.81" +name = "ort-sys" +version = "2.0.0-rc.10" +authors = ["pyke.io "] +build = "build.rs" +links = "onnxruntime" +include = [ + "src/", + "dist.txt", + "build.rs", + "LICENSE-APACHE", + "LICENSE-MIT", +] +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Unsafe Rust bindings for ONNX Runtime 1.22 - Optimize and Accelerate Machine Learning Inferencing" +homepage = "https://ort.pyke.io/" +readme = false +keywords = [ + "machine-learning", + "ai", + "ml", + "onnxruntime", + "sys", +] +categories = [ + "algorithms", + "mathematics", + "science", +] +license = "MIT OR Apache-2.0" +repository = "https://github.com/pykeio/ort" + +[features] +acl = [] +armnn = [] +azure = [] +cann = [] +copy-dylibs = [] +coreml = [] +cuda = [] +default = ["std"] +directml = [] +disable-linking = [] +download-binaries = [ + "ureq", + "tar", + "flate2", + "sha2", +] +load-dynamic = [] +migraphx = [] +nnapi = [] +nv = [] +onednn = [] +openvino = [] +qnn = [] +rknpu = [] +rocm = [] +std = [] +tensorrt = [] +training = [] +tvm = [] +vitis = [] +webgpu = ["dep:glob"] +xnnpack = [] + +[lib] +name = "ort_sys" +path = "src/lib.rs" + +[build-dependencies.flate2] +version = "1.0" +optional = true + +[build-dependencies.glob] +version = "0.3.2" +optional = true + +[build-dependencies.pkg-config] +version = "0.3.30" + +[build-dependencies.sha2] +version = "0.10" +optional = true + +[build-dependencies.tar] +version = "0.4" +optional = true + +[build-dependencies.ureq] +version = "3" +features = [ + "rustls", + "platform-verifier", + "socks-proxy", +] +optional = true +default-features = false diff --git a/third_party/ort-sys-2.0.0-rc.10/Cargo.toml.orig b/third_party/ort-sys-2.0.0-rc.10/Cargo.toml.orig new file mode 100644 index 0000000..d9a84e6 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/Cargo.toml.orig @@ -0,0 +1,55 @@ +[package] +name = "ort-sys" +description = "Unsafe Rust bindings for ONNX Runtime 1.22 - Optimize and Accelerate Machine Learning Inferencing" +version = "2.0.0-rc.10" +edition = "2021" +rust-version = "1.81" +links = "onnxruntime" +license = "MIT OR Apache-2.0" +repository = "https://github.com/pykeio/ort" +homepage = "https://ort.pyke.io/" +keywords = [ "machine-learning", "ai", "ml", "onnxruntime", "sys"] +categories = [ "algorithms", "mathematics", "science" ] +authors = [ + "pyke.io " +] +include = [ "src/", "dist.txt", "build.rs", "LICENSE-APACHE", "LICENSE-MIT" ] + +[features] +default = [ "std" ] +std = [] +training = [] +download-binaries = [ "ureq", "tar", "flate2", "sha2" ] +load-dynamic = [] +copy-dylibs = [] + +disable-linking = [] + +cuda = [] +tensorrt = [] +openvino = [] +onednn = [] +directml = [] +nnapi = [] +coreml = [] +xnnpack = [] +rocm = [] +acl = [] +armnn = [] +tvm = [] +migraphx = [] +rknpu = [] +vitis = [] +cann = [] +qnn = [] +webgpu = [ "dep:glob" ] +azure = [] +nv = [] + +[build-dependencies] +ureq = { version = "3", optional = true, default-features = false, features = [ "native-tls", "socks-proxy" ] } +tar = { version = "0.4", optional = true } +flate2 = { version = "1.0", optional = true } +sha2 = { version = "0.10", optional = true } +pkg-config = "0.3.30" +glob = { version = "0.3.2", optional = true } diff --git a/third_party/ort-sys-2.0.0-rc.10/LICENSE-APACHE b/third_party/ort-sys-2.0.0-rc.10/LICENSE-APACHE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/third_party/ort-sys-2.0.0-rc.10/LICENSE-MIT b/third_party/ort-sys-2.0.0-rc.10/LICENSE-MIT new file mode 100644 index 0000000..5aa3e66 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/LICENSE-MIT @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2023-2025 pyke.io +Copyright (c) 2020 Nicolas Bigaouette + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/third_party/ort-sys-2.0.0-rc.10/build.rs b/third_party/ort-sys-2.0.0-rc.10/build.rs new file mode 100644 index 0000000..c90e98b --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/build.rs @@ -0,0 +1,693 @@ +use std::{ + env, + path::{Path, PathBuf}, + process::Command +}; + +#[allow(unused)] +const ONNXRUNTIME_VERSION: &str = "1.22.0"; + +const ORT_ENV_SYSTEM_LIB_LOCATION: &str = "ORT_LIB_LOCATION"; +const ORT_ENV_SYSTEM_LIB_PROFILE: &str = "ORT_LIB_PROFILE"; +const ORT_ENV_PREFER_DYNAMIC_LINK: &str = "ORT_PREFER_DYNAMIC_LINK"; +const ORT_ENV_SKIP_DOWNLOAD: &str = "ORT_SKIP_DOWNLOAD"; +const ORT_ENV_CXX_STDLIB: &str = "ORT_CXX_STDLIB"; +const ENV_CXXSTDLIB: &str = "CXXSTDLIB"; // Used by the `cc` crate - we should mirror if this is set for other C++ crates +#[cfg(feature = "download-binaries")] +const ORT_EXTRACT_DIR: &str = "onnxruntime"; + +#[cfg(feature = "download-binaries")] +const DIST_TABLE: &str = include_str!("dist.txt"); + +#[path = "src/internal/mod.rs"] +#[cfg(feature = "download-binaries")] +mod internal; +#[cfg(feature = "download-binaries")] +use self::internal::dirs::cache_dir; + +#[cfg(feature = "download-binaries")] +fn fetch_file(source_url: &str) -> Vec { + let resp = ureq::Agent::new_with_config( + ureq::config::Config::builder() + .proxy(ureq::Proxy::try_from_env()) + .max_redirects(0) + .https_only(true) + .tls_config( + ureq::tls::TlsConfig::builder() + .provider(ureq::tls::TlsProvider::Rustls) + .root_certs(ureq::tls::RootCerts::PlatformVerifier) + .build() + ) + .user_agent(format!( + "{}/{} (host {}; for {})", + env!("CARGO_PKG_NAME"), + env!("CARGO_PKG_VERSION"), + std::env::var("HOST").unwrap(), + std::env::var("TARGET").unwrap() + )) + .timeout_global(Some(std::time::Duration::from_secs(1800))) + .build() + ) + .get(source_url) + .call() + .unwrap_or_else(|err| panic!("Failed to GET `{source_url}`: {err}")); + + resp.into_body() + .into_with_config() + .limit(1_073_741_824) + .read_to_vec() + .unwrap_or_else(|err| panic!("Failed to download from `{source_url}`: {err}")) +} + +#[cfg(feature = "download-binaries")] +fn find_dist(target: &str, feature_set: &str) -> Option<(&'static str, &'static str)> { + DIST_TABLE + .split('\n') + .filter(|c| !c.is_empty() && !c.starts_with('#')) + .map(|c| c.split('\t').collect::>()) + .find(|c| c[0] == feature_set && c[1] == target) + .map(|c| (c[2], c[3])) +} + +#[cfg(feature = "download-binaries")] +fn hex_str_to_bytes(c: impl AsRef<[u8]>) -> Vec { + fn nibble(c: u8) -> u8 { + match c { + b'A'..=b'F' => c - b'A' + 10, + b'a'..=b'f' => c - b'a' + 10, + b'0'..=b'9' => c - b'0', + _ => panic!() + } + } + + c.as_ref().chunks(2).map(|n| (nibble(n[0]) << 4) | nibble(n[1])).collect() +} + +#[cfg(feature = "download-binaries")] +fn verify_file(buf: &[u8], hash: impl AsRef<[u8]>) -> bool { + ::digest(buf)[..] == hex_str_to_bytes(hash) +} + +#[cfg(feature = "download-binaries")] +fn extract_tgz(buf: &[u8], output: &Path) { + let buf: std::io::BufReader<&[u8]> = std::io::BufReader::new(buf); + let tar = flate2::read::GzDecoder::new(buf); + let mut archive = tar::Archive::new(tar); + archive.unpack(output).expect("Failed to extract .tgz file"); +} + +#[cfg(feature = "copy-dylibs")] +fn copy_libraries(lib_dir: &Path, out_dir: &Path) { + // get the target directory - we need to place the dlls next to the executable so they can be properly loaded by windows + let out_dir = out_dir.ancestors().nth(3).unwrap(); + for out_dir in [out_dir.to_path_buf(), out_dir.join("examples"), out_dir.join("deps")] { + #[cfg(windows)] + let mut copy_fallback = false; + #[cfg(not(windows))] + let copy_fallback = false; + + let lib_files = std::fs::read_dir(lib_dir).unwrap_or_else(|_| panic!("Failed to read contents of `{}` (does it exist?)", lib_dir.display())); + for lib_file in lib_files.filter(|e| { + e.as_ref().ok().is_some_and(|e| { + e.file_type().is_ok_and(|e| !e.is_dir()) && [".dll", ".so", ".dylib"].into_iter().any(|v| e.path().to_string_lossy().contains(v)) + }) + }) { + let lib_file = lib_file.unwrap(); + let lib_path = lib_file.path(); + let lib_name = lib_path.file_name().unwrap(); + let out_path = out_dir.join(lib_name); + if out_path.is_symlink() { + std::fs::remove_file(&out_path).unwrap(); + } + if !out_path.exists() { + #[cfg(windows)] + if std::os::windows::fs::symlink_file(&lib_path, &out_path).is_err() { + copy_fallback = true; + std::fs::copy(&lib_path, &out_path).unwrap(); + } + #[cfg(unix)] + std::os::unix::fs::symlink(&lib_path, &out_path).unwrap(); + } + if !copy_fallback { + println!("cargo:rerun-if-changed={}", out_path.to_str().unwrap()); + } + } + + // If we had to fallback to copying files on Windows, break early to avoid copying to 3 different directories + if copy_fallback { + break; + } + } +} + +fn add_search_dir>(base: P) { + let base = base.as_ref(); + if base.join("Release").is_dir() { + println!("cargo:rustc-link-search=native={}", base.join("Release").display()); + } else if base.join("Debug").is_dir() { + println!("cargo:rustc-link-search=native={}", base.join("Debug").display()); + } else { + println!("cargo:rustc-link-search=native={}", base.display()); + } +} + +fn macos_rtlib_search_dir() -> Option { + let output = Command::new(std::env::var("CC").unwrap_or_else(|_| "clang".to_string())) + .arg("--print-search-dirs") + .output() + .ok()?; + if !output.status.success() { + return None; + } + + let stdout = String::from_utf8_lossy(&output.stdout); + for line in stdout.lines() { + if line.contains("libraries: =") { + let path = line.split('=').nth(1)?; + if !path.is_empty() { + return Some(format!("{path}/lib/darwin")); + } + } + } + + None +} + +fn static_link_prerequisites(using_pyke_libs: bool) { + let target_triple = env::var("TARGET").unwrap(); + + let cpp_link_stdlib = if let Ok(stdlib) = env::var(ORT_ENV_CXX_STDLIB).or_else(|_| env::var(ENV_CXXSTDLIB)) { + if stdlib.is_empty() { None } else { Some(stdlib) } + } else if target_triple.contains("msvc") { + None + } else if target_triple.contains("apple") { + Some("c++".to_string()) + } else if target_triple.contains("android") { + Some("c++_shared".to_string()) + } else { + Some("stdc++".to_string()) + }; + if let Some(cpp_link_stdlib) = cpp_link_stdlib { + println!("cargo:rustc-link-lib={cpp_link_stdlib}"); + } + + if target_triple.contains("apple") { + println!("cargo:rustc-link-lib=framework=Foundation"); + if let Some(dir) = macos_rtlib_search_dir() { + println!("cargo:rustc-link-search={dir}"); + println!("cargo:rustc-link-lib=clang_rt.osx"); + } + } + if target_triple.contains("windows") && using_pyke_libs { + println!("cargo:rustc-link-lib=dxguid"); + println!("cargo:rustc-link-lib=DXCORE"); + println!("cargo:rustc-link-lib=DXGI"); + println!("cargo:rustc-link-lib=D3D12"); + println!("cargo:rustc-link-lib=DirectML"); + } + if cfg!(feature = "webgpu") && !target_triple.contains("wasm32") && using_pyke_libs { + println!("cargo:rustc-link-lib=webgpu_dawn"); + } +} + +fn prefer_dynamic_linking() -> bool { + match env::var(ORT_ENV_PREFER_DYNAMIC_LINK) { + Ok(val) => val == "1" || val.to_lowercase() == "true", + Err(_) => false + } +} + +fn skip_download() -> bool { + match env::var(ORT_ENV_SKIP_DOWNLOAD) { + Ok(val) => val == "1" || val.to_lowercase() == "true", + Err(_) => false + } +} + +fn prepare_libort_dir() -> (PathBuf, bool) { + if let Ok(base_lib_dir) = env::var(ORT_ENV_SYSTEM_LIB_LOCATION) { + let base_lib_dir = PathBuf::from(base_lib_dir); + + let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap().to_lowercase(); + let platform_format_lib = |a: &str| { + if target_os.contains("windows") { format!("{}.lib", a) } else { format!("lib{}.a", a) } + }; + let optional_link_lib = |dir: &Path, lib: &str| { + if dir.exists() && dir.join(platform_format_lib(lib)).exists() { + add_search_dir(dir); + println!("cargo:rustc-link-lib=static={lib}"); + true + } else { + false + } + }; + let vcpkg_target = match env::var("TARGET").as_deref() { + Ok("i686-pc-windows-msvc") => Some("x86-windows"), + Ok("x86_64-pc-windows-msvc") => Some("x64-windows"), + Ok("x86_64-uwp-windows-msvc") => Some("x64-uwp"), + Ok("aarch64-pc-windows-msvc") => Some("arm64-windows"), + Ok("aarch64-uwp-windows-msvc") => Some("arm64-uwp"), + Ok("aarch64-apple-darwin") => Some("arm64-osx"), + Ok("x86_64-apple-darwin") => Some("x64-osx"), + Ok("x86_64-unknown-linux-gnu") => Some("x64-linux"), + Ok("armv7-linux-androideabi") => Some("arm-neon-android"), + Ok("x86_64-linux-android") => Some("x64-android"), + Ok("aarch64-linux-android") => Some("arm64-android"), + _ => None + }; + + let mut profile = env::var(ORT_ENV_SYSTEM_LIB_PROFILE).unwrap_or_default(); + if profile.is_empty() { + for i in ["Release", "RelWithDebInfo", "MinSizeRel", "Debug"] { + if base_lib_dir.join(i).exists() && base_lib_dir.join(i).join(platform_format_lib("onnxruntime_common")).exists() { + profile = String::from(i); + break; + } + } + } + + add_search_dir(&base_lib_dir); + + let mut needs_link = true; + if base_lib_dir.join(platform_format_lib("onnxruntime")).exists() { + println!("cargo:rustc-link-lib=static=onnxruntime"); + needs_link = false; + } else if !prefer_dynamic_linking() { + #[allow(clippy::type_complexity)] + let static_configs: Vec<(PathBuf, PathBuf, PathBuf, Box PathBuf>)> = vec![ + (base_lib_dir.join(&profile), base_lib_dir.join("lib"), base_lib_dir.join("_deps"), Box::new(|p: PathBuf, profile| p.join(profile))), + (base_lib_dir.join(&profile), base_lib_dir.join("lib"), base_lib_dir.join(&profile).join("_deps"), Box::new(|p: PathBuf, _| p)), + (base_lib_dir.clone(), base_lib_dir.join("lib"), base_lib_dir.parent().unwrap().join("_deps"), Box::new(|p: PathBuf, _| p)), + (base_lib_dir.join("onnxruntime"), base_lib_dir.join("onnxruntime").join("lib"), base_lib_dir.join("_deps"), Box::new(|p: PathBuf, _| p)), + ]; + for (lib_dir, extension_lib_dir, external_lib_dir, transform_dep) in static_configs { + if lib_dir.join(platform_format_lib("onnxruntime_common")).exists() && external_lib_dir.exists() { + add_search_dir(&lib_dir); + + for lib in &["common", "flatbuffers", "framework", "graph", "lora", "mlas", "optimizer", "providers", "session", "util"] { + let lib_path = lib_dir.join(platform_format_lib(&format!("onnxruntime_{lib}"))); + // sanity check, just make sure the library exists before we try to link to it + if lib_path.exists() { + println!("cargo:rustc-link-lib=static=onnxruntime_{lib}"); + } else { + panic!("[ort] unable to find ONNX Runtime library: {}", lib_path.display()); + } + } + + if extension_lib_dir.exists() && extension_lib_dir.join(platform_format_lib("ortcustomops")).exists() { + add_search_dir(&extension_lib_dir); + println!("cargo:rustc-link-lib=static=ortcustomops"); + println!("cargo:rustc-link-lib=static=ocos_operators"); + println!("cargo:rustc-link-lib=static=noexcep_operators"); + } + + let (vcpkg_lib_dir, has_vcpkg_link) = { + let vcpkg_base_dir = base_lib_dir.join("vcpkg_installed"); + if let Some(vcpkg_target) = vcpkg_target { + if vcpkg_base_dir.join(vcpkg_target).exists() { + let vcpkg_lib_dir = vcpkg_base_dir.join(vcpkg_target).join("lib"); + add_search_dir(&vcpkg_lib_dir); + (Some(vcpkg_lib_dir), true) + } else { + (None, false) + } + } else { + (None, false) + } + }; + + let protobuf_build = if !has_vcpkg_link { + let protobuf_build = transform_dep(external_lib_dir.join("protobuf-build"), &profile); + add_search_dir(&protobuf_build); + protobuf_build + } else { + vcpkg_lib_dir.clone().unwrap() + }; + for lib in ["protobuf-lited", "protobuf-lite", "protobuf"] { + if target_os.contains("windows") && protobuf_build.join(platform_format_lib(&format!("lib{lib}"))).exists() { + println!("cargo:rustc-link-lib=static=lib{lib}") + } else if protobuf_build.join(platform_format_lib(lib)).exists() { + println!("cargo:rustc-link-lib=static={lib}"); + } + } + + add_search_dir(transform_dep(external_lib_dir.join("onnx-build"), &profile)); + println!("cargo:rustc-link-lib=static=onnx"); + println!("cargo:rustc-link-lib=static=onnx_proto"); + + // some builds of ONNX Runtime, particularly the default no-EP windows build, don't require nsync + if !has_vcpkg_link { + optional_link_lib(&transform_dep(external_lib_dir.join("google_nsync-build"), &profile), "nsync_cpp"); + } else { + optional_link_lib(vcpkg_lib_dir.as_ref().unwrap(), "nsync_cpp"); + } + + add_search_dir(transform_dep(external_lib_dir.join("pytorch_cpuinfo-build"), &profile)); + if !has_vcpkg_link { + // clog isn't built when not building unit tests, or when compiling for android + for potential_clog_path in [ + transform_dep(external_lib_dir.join("pytorch_cpuinfo-build").join("deps").join("clog"), &profile), + transform_dep(external_lib_dir.join("pytorch_clog-build"), &profile) + ] { + if optional_link_lib(&potential_clog_path, "clog") { + break; + } + } + } else { + optional_link_lib(vcpkg_lib_dir.as_ref().unwrap(), "clog"); + } + println!("cargo:rustc-link-lib=static=cpuinfo"); + + if !has_vcpkg_link { + add_search_dir(transform_dep(external_lib_dir.join("re2-build"), &profile)); + } + println!("cargo:rustc-link-lib=static=re2"); + + if has_vcpkg_link && target_os.contains("windows") { + println!("cargo:rustc-link-lib=static=abseil_dll"); + } else { + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("debugging"), &profile)); + println!("cargo:rustc-link-lib=static=absl_examine_stack"); + println!("cargo:rustc-link-lib=static=absl_debugging_internal"); + println!("cargo:rustc-link-lib=static=absl_demangle_internal"); + println!("cargo:rustc-link-lib=static=absl_demangle_rust"); + println!("cargo:rustc-link-lib=static=absl_decode_rust_punycode"); + println!("cargo:rustc-link-lib=static=absl_utf8_for_code_point"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("base"), &profile)); + println!("cargo:rustc-link-lib=static=absl_base"); + println!("cargo:rustc-link-lib=static=absl_spinlock_wait"); + println!("cargo:rustc-link-lib=static=absl_malloc_internal"); + println!("cargo:rustc-link-lib=static=absl_strerror"); + println!("cargo:rustc-link-lib=static=absl_raw_logging_internal"); + println!("cargo:rustc-link-lib=static=absl_throw_delegate"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("hash"), &profile)); + println!("cargo:rustc-link-lib=static=absl_hash"); + println!("cargo:rustc-link-lib=static=absl_city"); + println!("cargo:rustc-link-lib=static=absl_low_level_hash"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("container"), &profile)); + println!("cargo:rustc-link-lib=static=absl_raw_hash_set"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("synchronization"), &profile)); + println!("cargo:rustc-link-lib=static=absl_kernel_timeout_internal"); + println!("cargo:rustc-link-lib=static=absl_graphcycles_internal"); + println!("cargo:rustc-link-lib=static=absl_synchronization"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("time"), &profile)); + println!("cargo:rustc-link-lib=static=absl_time_zone"); + println!("cargo:rustc-link-lib=static=absl_time"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("numeric"), &profile)); + println!("cargo:rustc-link-lib=static=absl_int128"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("strings"), &profile)); + println!("cargo:rustc-link-lib=static=absl_str_format_internal"); + println!("cargo:rustc-link-lib=static=absl_strings"); + println!("cargo:rustc-link-lib=static=absl_string_view"); + println!("cargo:rustc-link-lib=static=absl_strings_internal"); + add_search_dir(transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("debugging"), &profile)); + println!("cargo:rustc-link-lib=static=absl_symbolize"); + println!("cargo:rustc-link-lib=static=absl_stacktrace"); + let abseil_lib_log_dir = if !has_vcpkg_link { + let dir = transform_dep(external_lib_dir.join("abseil_cpp-build").join("absl").join("log"), &profile); + add_search_dir(&dir); + dir + } else { + vcpkg_lib_dir.clone().unwrap() + }; + println!("cargo:rustc-link-lib=static=absl_log_globals"); + println!("cargo:rustc-link-lib=static=absl_log_internal_format"); + println!("cargo:rustc-link-lib=static=absl_log_internal_proto"); + println!("cargo:rustc-link-lib=static=absl_log_internal_globals"); + optional_link_lib(&abseil_lib_log_dir, "absl_log_internal_check_op"); + println!("cargo:rustc-link-lib=static=absl_log_internal_log_sink_set"); + println!("cargo:rustc-link-lib=static=absl_log_sink"); + println!("cargo:rustc-link-lib=static=absl_log_internal_message"); + } + + // link static EPs if present + // not sure if these are the right libs but they're optional links so... + optional_link_lib(&lib_dir, "onnxruntime_providers_acl"); + optional_link_lib(&lib_dir, "onnxruntime_providers_armnn"); + optional_link_lib(&lib_dir, "onnxruntime_providers_azure"); + if optional_link_lib(&lib_dir, "onnxruntime_providers_coreml") { + println!("cargo:rustc-link-lib=framework=CoreML"); + println!("cargo:rustc-link-lib=coreml_proto"); + } + if optional_link_lib(&lib_dir, "onnxruntime_providers_dml") { + println!("cargo:rustc-link-lib=dxguid"); + println!("cargo:rustc-link-lib=DXCORE"); + println!("cargo:rustc-link-lib=DXGI"); + println!("cargo:rustc-link-lib=D3D12"); + println!("cargo:rustc-link-lib=DirectML"); + } + optional_link_lib(&lib_dir, "onnxruntime_providers_nnapi"); + optional_link_lib(&lib_dir, "onnxruntime_providers_qnn"); + optional_link_lib(&lib_dir, "onnxruntime_providers_rknpu"); + optional_link_lib(&lib_dir, "onnxruntime_providers_tvm"); + #[cfg(feature = "webgpu")] + if optional_link_lib(&lib_dir, "onnxruntime_providers_webgpu") { + let dawn_build_dir = transform_dep(external_lib_dir.join("dawn-build/src/dawn"), &profile); + add_search_dir(&dawn_build_dir); + println!("cargo:rustc-link-lib=static=dawn_proc"); + + let dawn_native_build_dir = transform_dep(external_lib_dir.join("dawn-build/src/dawn/native"), &profile); + add_search_dir(&dawn_native_build_dir); + println!("cargo:rustc-link-lib=static=dawn_native"); + + let dawn_platform_build_dir = transform_dep(external_lib_dir.join("dawn-build/src/dawn/platform"), &profile); + add_search_dir(&dawn_platform_build_dir); + println!("cargo:rustc-link-lib=static=dawn_platform"); + + let dawn_common_build_dir = transform_dep(external_lib_dir.join("dawn-build/src/dawn/common"), &profile); + add_search_dir(&dawn_common_build_dir); + println!("cargo:rustc-link-lib=static=dawn_common"); + + let tint_build_dir = transform_dep(external_lib_dir.join("dawn-build/src/tint"), &profile); + add_search_dir(&tint_build_dir); + let pattern = format!("{}/**/lib*.a", tint_build_dir.display()); + for entry in glob::glob(&pattern).unwrap() { + match entry { + Ok(path) => { + if let Some(lib_name) = path.file_name() { + if let Some(lib_name_str) = lib_name.to_str() { + let lib_name = lib_name_str.trim_start_matches("lib").trim_end_matches(".a"); + println!("cargo:rustc-link-lib=static={}", lib_name); + } + } + } + Err(e) => eprintln!("error matching file: {}", e) + } + } + }; + if optional_link_lib(&lib_dir, "onnxruntime_providers_xnnpack") { + let xnnpack_build_dir = transform_dep(external_lib_dir.join("googlexnnpack-build"), &profile); + add_search_dir(&xnnpack_build_dir); + println!("cargo:rustc-link-lib=static=XNNPACK"); + optional_link_lib(&xnnpack_build_dir, "microkernels-prod"); + + add_search_dir(transform_dep(external_lib_dir.join("pthreadpool-build"), &profile)); + println!("cargo:rustc-link-lib=static=pthreadpool"); + } + + if env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "aarch64" { + let kleidi_build_dir = transform_dep(external_lib_dir.join("kleidiai-build"), &profile); + optional_link_lib(&kleidi_build_dir, "kleidiai"); + } + + needs_link = false; + break; + } + } + if needs_link { + // none of the static link patterns matched, we might be trying to dynamic link so copy dylibs if requested + #[cfg(feature = "copy-dylibs")] + { + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); + if base_lib_dir.join("lib").is_dir() { + copy_libraries(&base_lib_dir.join("lib"), &out_dir); + } else if base_lib_dir.join(&profile).is_dir() { + copy_libraries(&base_lib_dir.join(profile), &out_dir); + } + } + } + } + + (base_lib_dir, needs_link) + } else { + #[cfg(feature = "download-binaries")] + { + if env::var("CARGO_NET_OFFLINE").as_deref() == Ok("true") || skip_download() { + return (PathBuf::default(), true); + } + + let target = env::var("TARGET").unwrap().to_string(); + + let mut feature_set = Vec::new(); + if cfg!(feature = "training") { + feature_set.push("train"); + } + if cfg!(feature = "webgpu") { + feature_set.push("wgpu"); + } + if cfg!(any(feature = "cuda", feature = "tensorrt")) { + feature_set.push("cu12"); + } + if cfg!(feature = "rocm") { + feature_set.push("rocm"); + } + + let feature_set = if !feature_set.is_empty() { feature_set.join(",") } else { "none".to_owned() }; + println!("selected feature set: {feature_set}"); + + let mut dist = find_dist(&target, &feature_set); + if dist.is_none() && feature_set != "none" { + println!("full feature set {feature_set} not available, attempting to download with no features instead"); + // i dont like this behavior at all but the only thing i like less than it is rust-analyzer breaking because it + // ***insists*** on enabling --all-features + dist = find_dist(&target, "none"); + } + + if dist.is_none() { + panic!( + "downloaded binaries not available for target {target}{}\nyou may have to compile ONNX Runtime from source", + if feature_set != "none" { format!(" and features `{feature_set}`") } else { String::new() } + ); + } + + let (prebuilt_url, prebuilt_hash) = dist.unwrap(); + + let bin_extract_dir = cache_dir() + .expect("could not determine cache directory") + .join("dfbin") + .join(target) + .join(prebuilt_hash); + + let lib_dir = bin_extract_dir.join(ORT_EXTRACT_DIR); + if !lib_dir.exists() { + let downloaded_file = fetch_file(prebuilt_url); + assert!(verify_file(&downloaded_file, prebuilt_hash), "hash of downloaded ONNX Runtime binary does not match!"); + + let mut temp_extract_dir = bin_extract_dir + .parent() + .unwrap() + .join(format!("tmp.{}_{prebuilt_hash}", self::internal::random_identifier())); + let mut should_rename = true; + if std::fs::create_dir_all(&temp_extract_dir).is_err() { + temp_extract_dir = env::var("OUT_DIR").unwrap().into(); + should_rename = false; + } + extract_tgz(&downloaded_file, &temp_extract_dir); + if should_rename { + match std::fs::rename(&temp_extract_dir, &bin_extract_dir) { + Ok(()) => {} + Err(e) => { + if bin_extract_dir.exists() { + let _ = std::fs::remove_dir_all(temp_extract_dir); + } else { + panic!("failed to extract downloaded binaries: {e}"); + } + } + } + } + } + + static_link_prerequisites(true); + + #[cfg(feature = "copy-dylibs")] + { + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); + copy_libraries(&lib_dir.join("lib"), &out_dir); + } + + (lib_dir, true) + } + #[cfg(not(feature = "download-binaries"))] + { + println!("cargo:rustc-link-lib=add_ort_library_path_or_enable_feature_download-binaries_see_ort_docs"); + (PathBuf::default(), false) + } + } +} + +fn try_setup_with_pkg_config() -> bool { + match pkg_config::Config::new().probe("libonnxruntime") { + Ok(lib) => { + let expected_minor = ONNXRUNTIME_VERSION.split('.').nth(1).unwrap().parse::().unwrap(); + let got_minor = lib.version.split('.').nth(1).unwrap().parse::().unwrap(); + if got_minor < expected_minor { + println!("libonnxruntime provided by pkg-config is out of date, so it will be ignored - expected {}, got {}", ONNXRUNTIME_VERSION, lib.version); + return false; + } + + // Setting the link paths + for path in lib.link_paths { + println!("cargo:rustc-link-search=native={}", path.display()); + } + + // Setting the libraries to link against + for lib in lib.libs { + println!("cargo:rustc-link-lib={}", lib); + } + + println!("Using onnxruntime found by pkg-config."); + true + } + Err(_) => { + println!("onnxruntime not found using pkg-config, falling back to manual setup."); + false + } + } +} + +fn real_main(link: bool) { + println!("cargo:rerun-if-env-changed={}", ORT_ENV_SYSTEM_LIB_LOCATION); + println!("cargo:rerun-if-env-changed={}", ORT_ENV_SYSTEM_LIB_PROFILE); + println!("cargo:rerun-if-env-changed={}", ORT_ENV_PREFER_DYNAMIC_LINK); + println!("cargo:rerun-if-env-changed={}", ORT_ENV_SKIP_DOWNLOAD); + println!("cargo:rerun-if-env-changed={}", ORT_ENV_CXX_STDLIB); + println!("cargo:rerun-if-env-changed={}", ENV_CXXSTDLIB); + + let (install_dir, needs_link) = prepare_libort_dir(); + + let lib_dir = if install_dir.join("lib").exists() { install_dir.join("lib") } else { install_dir }; + + if link { + if needs_link { + let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); + let static_lib_file_name = if target_os.contains("windows") { "onnxruntime.lib" } else { "libonnxruntime.a" }; + + let static_lib_path = lib_dir.join(static_lib_file_name); + if !prefer_dynamic_linking() && static_lib_path.exists() { + println!("cargo:rustc-link-lib=static=onnxruntime"); + } else { + println!("cargo:rustc-link-lib=onnxruntime"); + } + println!("cargo:rustc-link-search=native={}", lib_dir.display()); + } + + static_link_prerequisites(false); + } +} + +fn main() { + if env::var("DOCS_RS").is_ok() || cfg!(feature = "disable-linking") { + // On docs.rs, A) we don't need to link, and B) we don't have network, so we couldn't download anything if we wanted to. + // If `disable-linking` is specified, presumably the application will configure a custom backend, and the crate + // providing said backend will have its own linking logic, so no need to do anything. + return; + } + + if cfg!(feature = "load-dynamic") { + if !try_setup_with_pkg_config() { + // Only execute the real main step if pkg-config fails and if we are using the download + // strategy + if cfg!(feature = "download-binaries") && env::var(ORT_ENV_SYSTEM_LIB_LOCATION).is_err() { + // but we don't need to link to the binaries we download (so all we are doing is + // downloading them and placing them in the output directory) + real_main(false); // but we don't need to link to the binaries we download + } + } + } else { + // If pkg-config setup was successful, we don't need further action + // Otherwise, if we are not using the load-dynamic feature, we need to link to the dylibs. + if !try_setup_with_pkg_config() { + real_main(true); + } + } +} diff --git a/third_party/ort-sys-2.0.0-rc.10/dist.txt b/third_party/ort-sys-2.0.0-rc.10/dist.txt new file mode 100644 index 0000000..d204bcd --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/dist.txt @@ -0,0 +1,19 @@ +train,cu12 x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-pc-windows-msvc+train+cu12.tgz 34C9295D8F4FDA5A053DBEA1A0CBDF7BB3816F766AB558A6CA69F03A0153015B +cu12 x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-pc-windows-msvc+cu12.tgz 743380B97FAC97EDB2CB0DD656C517B99C5FEDD37516DA40F696335A3EDB5E55 +train,cu12 x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-unknown-linux-gnu+train+cu12.tgz 2AEBF5EB93BC15D51490AF54B11F092866B980640B5FA6DF65F43EBEFE994FDA +cu12 x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-unknown-linux-gnu+cu12.tgz 8BBB8416566A668A240B72A56DBBB82F99F430AF86F64D776D7EBF53E144EFC9 +wgpu x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-pc-windows-msvc+wgpu.tgz D435BE3D344A5E8C4426AC2E8A49F726A115A76D8F812967B78912A9153B0149 +train x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-pc-windows-msvc+train.tgz 5365CB19CFB108FE09725EFC3AA22C96303BD3C0F32BE7A36C652AD3FEF26AB9 +train aarch64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/aarch64-pc-windows-msvc+train.tgz 0DF2BDD6AA23BC536780E72A6FD81970F2BC2F1A375B2AC2ECF1B8A83EF96486 +none x86_64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-pc-windows-msvc.tgz 540D19B3379FDA6FB8F7280D8C15EFDE20ED225A67A357A6DAE38C4300FE190D +none aarch64-pc-windows-msvc https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/aarch64-pc-windows-msvc.tgz 9E6EDACC42AF2616C863EA5FB4D74E9F260E9A9530E12C5A91DA33F7E830A0CF +train x86_64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-apple-darwin+train.tgz 76BA116987AFA98BB9689970C2BE1DC863826769BE7F5977A7290C1BD89CA2FF +train aarch64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/aarch64-unknown-linux-gnu+train.tgz EFC624FE76E86BA851B5A3CAE6FB5BBC02FE5564A78954DDC46BEBC30A6CEAB2 +none aarch64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/aarch64-apple-darwin.tgz 00FBFD6F08BAC2A4E28C66723AF900D58D1B4B1C73EFBA6290637CD3019883D5 +none wasm32-unknown-emscripten https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/wasm32-unknown-emscripten.tgz 3507498F71825550AE782033C4B84E8E1854B84C87EC01BBA1847048D5D0A1CB +train aarch64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/aarch64-apple-darwin+train.tgz 9D4D04609EDC1537260C28AB0748FF3E8ECAA29ECEAF3D085F290618A312A6AE +wgpu x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-unknown-linux-gnu+wgpu.tgz D766B62A8419124D242BB02A0AB1D2407B86C39011FEC6214D83D5AC304D5593 +train x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-unknown-linux-gnu+train.tgz 081B3D09E73F5B07CBCE33EEB231F11A74FF198722673CC517BF2C0D624EA280 +none x86_64-apple-darwin https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-apple-darwin.tgz E0538783248BBB77D2E97556134B8CC47CFC35AC3D762067D51EAF8355C0F48E +none aarch64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/aarch64-unknown-linux-gnu.tgz 24E4760207136FC50B854BB5012AB81DE6189039CF6D4FD3F5B8D3DB7E929F1E +none x86_64-unknown-linux-gnu https://cdn.pyke.io/0/pyke:ort-rs/ms@1.22.0/x86_64-unknown-linux-gnu.tgz ED1716DE95974BF47AB0223CA33734A0B5A5D09A181225D0E8ED62D070AEA893 diff --git a/third_party/ort-sys-2.0.0-rc.10/src/internal/dirs.rs b/third_party/ort-sys-2.0.0-rc.10/src/internal/dirs.rs new file mode 100644 index 0000000..462f675 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/src/internal/dirs.rs @@ -0,0 +1,187 @@ +// based on https://github.com/dirs-dev/dirs-sys-rs/blob/main/src/lib.rs + +#![allow(unused)] + +pub const PYKE_ROOT: &str = "ort.pyke.io"; + +#[cfg(all(target_os = "windows", target_arch = "x86"))] +macro_rules! win32_extern { + ($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => ( + #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated")] + extern $abi { + $(#[$doc])? + $(#[link_name=$link_name])? + fn $($function)*; + } + ) +} +#[cfg(all(target_os = "windows", not(target_arch = "x86")))] +macro_rules! win32_extern { + ($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => ( + #[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")] + extern "C" { + $(#[$doc])? + $(#[link_name=$link_name])? + fn $($function)*; + } + ) +} + +#[cfg(target_os = "windows")] +#[allow(non_camel_case_types, clippy::upper_case_acronyms)] +mod windows { + use std::{ + ffi::{OsString, c_void}, + os::windows::prelude::OsStringExt, + path::PathBuf, + ptr, slice + }; + + #[repr(C)] + #[derive(Clone, Copy)] + struct GUID { + data1: u32, + data2: u16, + data3: u16, + data4: [u8; 8] + } + + impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: ((uuid >> 80) & 0xffff) as u16, + data3: ((uuid >> 64) & 0xffff) as u16, + #[allow(clippy::cast_possible_truncation)] + data4: (uuid as u64).to_be_bytes() + } + } + } + + type HRESULT = i32; + type PWSTR = *mut u16; + type PCWSTR = *const u16; + type HANDLE = isize; + type KNOWN_FOLDER_FLAG = i32; + + win32_extern!("SHELL32.DLL" "system" fn SHGetKnownFolderPath(rfid: *const GUID, dwflags: KNOWN_FOLDER_FLAG, htoken: HANDLE, ppszpath: *mut PWSTR) -> HRESULT); + win32_extern!("KERNEL32.DLL" "system" fn lstrlenW(lpstring: PCWSTR) -> i32); + win32_extern!("OLE32.DLL" "system" fn CoTaskMemFree(pv: *const ::core::ffi::c_void) -> ()); + + fn known_folder(folder_id: GUID) -> Option { + unsafe { + let mut path_ptr: PWSTR = ptr::null_mut(); + let result = SHGetKnownFolderPath(&folder_id, 0, HANDLE::default(), &mut path_ptr); + if result == 0 { + let len = lstrlenW(path_ptr) as usize; + let path = slice::from_raw_parts(path_ptr, len); + let ostr: OsString = OsStringExt::from_wide(path); + CoTaskMemFree(path_ptr as *const c_void); + Some(PathBuf::from(ostr)) + } else { + CoTaskMemFree(path_ptr as *const c_void); + None + } + } + } + + #[allow(clippy::unusual_byte_groupings)] + const FOLDERID_LOCAL_APP_DATA: GUID = GUID::from_u128(0xf1b32785_6fba_4fcf_9d557b8e7f157091); + + #[must_use] + pub fn known_folder_local_app_data() -> Option { + known_folder(FOLDERID_LOCAL_APP_DATA) + } +} +#[cfg(target_os = "windows")] +#[must_use] +pub fn cache_dir() -> Option { + self::windows::known_folder_local_app_data().map(|h| h.join(PYKE_ROOT)) +} + +#[cfg(unix)] +#[allow(non_camel_case_types)] +mod unix { + use std::{ + env, + ffi::{CStr, OsString, c_char, c_int, c_long}, + mem, + os::unix::prelude::OsStringExt, + path::PathBuf, + ptr + }; + + type uid_t = u32; + type gid_t = u32; + type size_t = usize; + #[repr(C)] + struct passwd { + pub pw_name: *mut c_char, + pub pw_passwd: *mut c_char, + pub pw_uid: uid_t, + pub pw_gid: gid_t, + pub pw_gecos: *mut c_char, + pub pw_dir: *mut c_char, + pub pw_shell: *mut c_char + } + + extern "C" { + fn sysconf(name: c_int) -> c_long; + fn getpwuid_r(uid: uid_t, pwd: *mut passwd, buf: *mut c_char, buflen: size_t, result: *mut *mut passwd) -> c_int; + fn getuid() -> uid_t; + } + + const SC_GETPW_R_SIZE_MAX: c_int = 70; + + #[must_use] + pub fn is_absolute_path(path: OsString) -> Option { + let path = PathBuf::from(path); + if path.is_absolute() { Some(path) } else { None } + } + + #[cfg(not(target_os = "windows"))] + #[must_use] + pub fn home_dir() -> Option { + return env::var_os("HOME") + .and_then(|h| if h.is_empty() { None } else { Some(h) }) + .or_else(|| unsafe { fallback() }) + .map(PathBuf::from); + + #[cfg(any(target_os = "android", target_os = "ios", target_os = "emscripten"))] + unsafe fn fallback() -> Option { + None + } + #[cfg(not(any(target_os = "android", target_os = "ios", target_os = "emscripten")))] + unsafe fn fallback() -> Option { + let amt = match sysconf(SC_GETPW_R_SIZE_MAX) { + n if n < 0 => 512, + n => n as usize + }; + let mut buf = Vec::with_capacity(amt); + let mut passwd: passwd = mem::zeroed(); + let mut result = ptr::null_mut(); + match getpwuid_r(getuid(), &mut passwd, buf.as_mut_ptr(), buf.capacity(), &mut result) { + 0 if !result.is_null() => { + let ptr = passwd.pw_dir as *const _; + let bytes = CStr::from_ptr(ptr).to_bytes(); + if bytes.is_empty() { None } else { Some(OsStringExt::from_vec(bytes.to_vec())) } + } + _ => None + } + } + } +} + +#[cfg(target_os = "linux")] +#[must_use] +pub fn cache_dir() -> Option { + std::env::var_os("XDG_CACHE_HOME") + .and_then(self::unix::is_absolute_path) + .or_else(|| self::unix::home_dir().map(|h| h.join(".cache").join(PYKE_ROOT))) +} + +#[cfg(target_os = "macos")] +#[must_use] +pub fn cache_dir() -> Option { + self::unix::home_dir().map(|h| h.join("Library/Caches").join(PYKE_ROOT)) +} diff --git a/third_party/ort-sys-2.0.0-rc.10/src/internal/mod.rs b/third_party/ort-sys-2.0.0-rc.10/src/internal/mod.rs new file mode 100644 index 0000000..0fc4fe6 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/src/internal/mod.rs @@ -0,0 +1,19 @@ +use std::{ + collections::hash_map::RandomState, + hash::{BuildHasher, Hasher} +}; + +pub mod dirs; + +pub fn random_identifier() -> String { + let mut state = RandomState::new().build_hasher().finish(); + std::iter::repeat_with(move || { + state ^= state << 13; + state ^= state >> 7; + state ^= state << 17; + state + }) + .take(12) + .map(|i| b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[i as usize % 62] as char) + .collect() +} diff --git a/third_party/ort-sys-2.0.0-rc.10/src/lib.rs b/third_party/ort-sys-2.0.0-rc.10/src/lib.rs new file mode 100644 index 0000000..4650962 --- /dev/null +++ b/third_party/ort-sys-2.0.0-rc.10/src/lib.rs @@ -0,0 +1,1599 @@ +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(clippy::type_complexity)] +#![cfg_attr(all(not(test), not(feature = "std")), no_std)] + +extern crate core; + +#[doc(hidden)] +#[cfg(feature = "std")] +pub mod internal; + +pub const ORT_API_VERSION: u32 = 22; + +pub use core::ffi::{c_char, c_int, c_ulong, c_ulonglong, c_ushort, c_void}; + +#[cfg(target_os = "windows")] +pub type ortchar = c_ushort; +#[cfg(not(target_os = "windows"))] +pub type ortchar = c_char; + +#[repr(i32)] +#[doc = " Copied from TensorProto::DataType\n Currently, Ort doesn't support complex64, complex128"] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum ONNXTensorElementDataType { + ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED = 0, + ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT = 1, + ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8 = 2, + ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8 = 3, + ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16 = 4, + ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16 = 5, + ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32 = 6, + ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64 = 7, + ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING = 8, + ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL = 9, + ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16 = 10, + ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE = 11, + ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32 = 12, + ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64 = 13, + ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64 = 14, + ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128 = 15, + ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16 = 16, + ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FN = 17, + ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FNUZ = 18, + ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2 = 19, + ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2FNUZ = 20, + ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT4 = 21, + ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4 = 22 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum ONNXType { + ONNX_TYPE_UNKNOWN = 0, + ONNX_TYPE_TENSOR = 1, + ONNX_TYPE_SEQUENCE = 2, + ONNX_TYPE_MAP = 3, + ONNX_TYPE_OPAQUE = 4, + ONNX_TYPE_SPARSETENSOR = 5, + ONNX_TYPE_OPTIONAL = 6 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtSparseFormat { + ORT_SPARSE_UNDEFINED = 0, + ORT_SPARSE_COO = 1, + ORT_SPARSE_CSRC = 2, + ORT_SPARSE_BLOCK_SPARSE = 4 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtSparseIndicesFormat { + ORT_SPARSE_COO_INDICES = 0, + ORT_SPARSE_CSR_INNER_INDICES = 1, + ORT_SPARSE_CSR_OUTER_INDICES = 2, + ORT_SPARSE_BLOCK_SPARSE_INDICES = 3 +} +#[repr(i32)] +#[doc = " \\brief Logging severity levels\n\n In typical API usage, specifying a logging severity level specifies the minimum severity of log messages to show."] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtLoggingLevel { + #[doc = "< Verbose informational messages (least severe)."] + ORT_LOGGING_LEVEL_VERBOSE = 0, + #[doc = "< Informational messages."] + ORT_LOGGING_LEVEL_INFO = 1, + #[doc = "< Warning messages."] + ORT_LOGGING_LEVEL_WARNING = 2, + #[doc = "< Error messages."] + ORT_LOGGING_LEVEL_ERROR = 3, + #[doc = "< Fatal error messages (most severe)."] + ORT_LOGGING_LEVEL_FATAL = 4 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtErrorCode { + ORT_OK = 0, + ORT_FAIL = 1, + ORT_INVALID_ARGUMENT = 2, + ORT_NO_SUCHFILE = 3, + ORT_NO_MODEL = 4, + ORT_ENGINE_ERROR = 5, + ORT_RUNTIME_EXCEPTION = 6, + ORT_INVALID_PROTOBUF = 7, + ORT_MODEL_LOADED = 8, + ORT_NOT_IMPLEMENTED = 9, + ORT_INVALID_GRAPH = 10, + ORT_EP_FAIL = 11 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtOpAttrType { + ORT_OP_ATTR_UNDEFINED = 0, + ORT_OP_ATTR_INT = 1, + ORT_OP_ATTR_INTS = 2, + ORT_OP_ATTR_FLOAT = 3, + ORT_OP_ATTR_FLOATS = 4, + ORT_OP_ATTR_STRING = 5, + ORT_OP_ATTR_STRINGS = 6 +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtEnv { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtStatus { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtMemoryInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtIoBinding { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtSession { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtValue { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtRunOptions { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtTypeInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtTensorTypeAndShapeInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtMapTypeInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtSequenceTypeInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtOptionalTypeInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtSessionOptions { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCustomOpDomain { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtModelMetadata { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtThreadPoolParams { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtThreadingOptions { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtArenaCfg { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtPrepackedWeightsContainer { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtTensorRTProviderOptionsV2 { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtNvTensorRtRtxProviderOptions { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCUDAProviderOptionsV2 { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCANNProviderOptions { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtDnnlProviderOptions { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtOp { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtOpAttr { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtLogger { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtShapeInferContext { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtLoraAdapter { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtValueInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtNode { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtGraph { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtModel { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtModelCompilationOptions { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtHardwareDevice { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtEpDevice { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtKeyValuePairs { + _unused: [u8; 0] +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone)] +#[must_use = "statuses must be freed with `OrtApi::ReleaseStatus` if they are not null"] +pub struct OrtStatusPtr(pub *mut OrtStatus); +impl Default for OrtStatusPtr { + fn default() -> Self { + OrtStatusPtr(core::ptr::null_mut()) + } +} +#[doc = " \\brief Memory allocation interface\n\n Structure of function pointers that defines a memory allocator. This can be created and filled in by the user for custom allocators.\n\n When an allocator is passed to any function, be sure that the allocator object is not destroyed until the last allocated object using it is freed."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtAllocator { + #[doc = "< Must be initialized to ORT_API_VERSION"] + pub version: u32, + #[doc = "< Returns a pointer to an allocated block of `size` bytes"] + pub Alloc: Option *mut core::ffi::c_void>, + #[doc = "< Free a block of memory previously allocated with OrtAllocator::Alloc"] + pub Free: Option, + #[doc = "< Return a pointer to an ::OrtMemoryInfo that describes this allocator"] + pub Info: Option *const OrtMemoryInfo>, + pub Reserve: Option *mut core::ffi::c_void> +} +pub type OrtLoggingFunction = unsafe extern "system" fn( + param: *mut core::ffi::c_void, + severity: OrtLoggingLevel, + category: *const core::ffi::c_char, + logid: *const core::ffi::c_char, + code_location: *const core::ffi::c_char, + message: *const core::ffi::c_char +); +#[repr(i32)] +#[doc = " \\brief Graph optimization level\n\n Refer to https://www.onnxruntime.ai/docs/performance/graph-optimizations.html#graph-optimization-levels\n for an in-depth understanding of the Graph Optimization Levels."] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum GraphOptimizationLevel { + ORT_DISABLE_ALL = 0, + ORT_ENABLE_BASIC = 1, + ORT_ENABLE_EXTENDED = 2, + ORT_ENABLE_ALL = 99 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum ExecutionMode { + ORT_SEQUENTIAL = 0, + ORT_PARALLEL = 1 +} +#[repr(i32)] +#[doc = " \\brief Language projection identifiers\n /see OrtApi::SetLanguageProjection"] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtLanguageProjection { + ORT_PROJECTION_C = 0, + ORT_PROJECTION_CPLUSPLUS = 1, + ORT_PROJECTION_CSHARP = 2, + ORT_PROJECTION_PYTHON = 3, + ORT_PROJECTION_JAVA = 4, + ORT_PROJECTION_WINML = 5, + ORT_PROJECTION_NODEJS = 6 +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtKernelInfo { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtKernelContext { + _unused: [u8; 0] +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtAllocatorType { + OrtInvalidAllocator = -1, + OrtDeviceAllocator = 0, + OrtArenaAllocator = 1 +} +impl OrtMemType { + pub const OrtMemTypeCPU: OrtMemType = OrtMemType::OrtMemTypeCPUOutput; +} +#[repr(i32)] +#[doc = " \\brief Memory types for allocated memory, execution provider specific types should be extended in each provider."] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtMemType { + #[doc = "< Any CPU memory used by non-CPU execution provider"] + OrtMemTypeCPUInput = -2, + #[doc = "< CPU accessible memory outputted by non-CPU execution provider, i.e. CUDA_PINNED"] + OrtMemTypeCPUOutput = -1, + #[doc = "< The default allocator for execution provider"] + OrtMemTypeDefault = 0 +} +#[repr(i32)] +#[doc = " \\brief This mimics OrtDevice type constants so they can be returned in the API"] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtMemoryInfoDeviceType { + OrtMemoryInfoDeviceType_CPU = 0, + OrtMemoryInfoDeviceType_GPU = 1, + OrtMemoryInfoDeviceType_FPGA = 2 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtHardwareDeviceType { + OrtHardwareDeviceType_CPU = 0, + OrtHardwareDeviceType_GPU = 1, + OrtHardwareDeviceType_NPU = 2 +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtExecutionProviderDevicePolicy { + OrtExecutionProviderDevicePolicy_DEFAULT = 0, + OrtExecutionProviderDevicePolicy_PREFER_CPU = 1, + OrtExecutionProviderDevicePolicy_PREFER_NPU = 2, + OrtExecutionProviderDevicePolicy_PREFER_GPU = 3, + OrtExecutionProviderDevicePolicy_MAX_PERFORMANCE = 4, + OrtExecutionProviderDevicePolicy_MAX_EFFICIENCY = 5, + OrtExecutionProviderDevicePolicy_MIN_OVERALL_POWER = 6 +} +pub type EpSelectionDelegate = Option< + unsafe extern "system" fn( + ep_devices: *const *const OrtEpDevice, + num_devices: usize, + model_metadata: *const OrtKeyValuePairs, + runtime_metadata: *const OrtKeyValuePairs, + selected: *mut *const OrtEpDevice, + max_selected: usize, + num_selected: *mut usize, + state: *mut c_void + ) -> OrtStatusPtr +>; +#[repr(i32)] +#[doc = " \\brief Algorithm to use for cuDNN Convolution Op"] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtCudnnConvAlgoSearch { + OrtCudnnConvAlgoSearchExhaustive = 0, + OrtCudnnConvAlgoSearchHeuristic = 1, + OrtCudnnConvAlgoSearchDefault = 2 +} +#[doc = " \\brief CUDA Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_CUDA"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCUDAProviderOptions { + #[doc = " \\brief CUDA device Id\n Defaults to 0."] + pub device_id: core::ffi::c_int, + #[doc = " \\brief CUDA Convolution algorithm search configuration.\n See enum OrtCudnnConvAlgoSearch for more details.\n Defaults to OrtCudnnConvAlgoSearchExhaustive."] + pub cudnn_conv_algo_search: OrtCudnnConvAlgoSearch, + #[doc = " \\brief CUDA memory limit (To use all possible memory pass in maximum usize)\n Defaults to SIZE_MAX.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"] + pub gpu_mem_limit: usize, + #[doc = " \\brief Strategy used to grow the memory arena\n 0 = kNextPowerOfTwo
\n 1 = kSameAsRequested
\n Defaults to 0.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"] + pub arena_extend_strategy: core::ffi::c_int, + #[doc = " \\brief Flag indicating if copying needs to take place on the same stream as the compute stream in the CUDA EP\n 0 = Use separate streams for copying and compute.\n 1 = Use the same stream for copying and compute.\n Defaults to 1.\n WARNING: Setting this to 0 may result in data races for some models.\n Please see issue #4829 for more details."] + pub do_copy_in_default_stream: core::ffi::c_int, + #[doc = " \\brief Flag indicating if there is a user provided compute stream\n Defaults to 0."] + pub has_user_compute_stream: core::ffi::c_int, + #[doc = " \\brief User provided compute stream.\n If provided, please set `has_user_compute_stream` to 1."] + pub user_compute_stream: *mut core::ffi::c_void, + #[doc = " \\brief CUDA memory arena configuration parameters"] + pub default_memory_arena_cfg: *mut OrtArenaCfg, + #[doc = " \\brief Enable TunableOp for using.\n Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_CUDA_TUNABLE_OP_ENABLE."] + pub tunable_op_enable: core::ffi::c_int, + #[doc = " \\brief Enable TunableOp for tuning.\n Set it to 1/0 to enable/disable TunableOp tuning. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_CUDA_TUNABLE_OP_TUNING_ENABLE."] + pub tunable_op_tuning_enable: core::ffi::c_int, + #[doc = " \\brief Max tuning duration time limit for each instance of TunableOp.\n Defaults to 0 to disable the limit."] + pub tunable_op_max_tuning_duration_ms: core::ffi::c_int +} +#[doc = " \\brief ROCM Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_ROCM"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtROCMProviderOptions { + #[doc = " \\brief ROCM device Id\n Defaults to 0."] + pub device_id: core::ffi::c_int, + #[doc = " \\brief ROCM MIOpen Convolution algorithm exaustive search option.\n Defaults to 0 (false)."] + pub miopen_conv_exhaustive_search: core::ffi::c_int, + #[doc = " \\brief ROCM memory limit (To use all possible memory pass in maximum usize)\n Defaults to SIZE_MAX.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"] + pub gpu_mem_limit: usize, + #[doc = " \\brief Strategy used to grow the memory arena\n 0 = kNextPowerOfTwo
\n 1 = kSameAsRequested
\n Defaults to 0.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"] + pub arena_extend_strategy: core::ffi::c_int, + #[doc = " \\brief Flag indicating if copying needs to take place on the same stream as the compute stream in the ROCM EP\n 0 = Use separate streams for copying and compute.\n 1 = Use the same stream for copying and compute.\n Defaults to 1.\n WARNING: Setting this to 0 may result in data races for some models.\n Please see issue #4829 for more details."] + pub do_copy_in_default_stream: core::ffi::c_int, + #[doc = " \\brief Flag indicating if there is a user provided compute stream\n Defaults to 0."] + pub has_user_compute_stream: core::ffi::c_int, + #[doc = " \\brief User provided compute stream.\n If provided, please set `has_user_compute_stream` to 1."] + pub user_compute_stream: *mut core::ffi::c_void, + #[doc = " \\brief ROCM memory arena configuration parameters"] + pub default_memory_arena_cfg: *mut OrtArenaCfg, + pub enable_hip_graph: core::ffi::c_int, + #[doc = " \\brief Enable TunableOp for using.\n Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_ROCM_TUNABLE_OP_ENABLE."] + pub tunable_op_enable: core::ffi::c_int, + #[doc = " \\brief Enable TunableOp for tuning.\n Set it to 1/0 to enable/disable TunableOp tuning. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_ROCM_TUNABLE_OP_TUNING_ENABLE."] + pub tunable_op_tuning_enable: core::ffi::c_int, + #[doc = " \\brief Max tuning duration time limit for each instance of TunableOp.\n Defaults to 0 to disable the limit."] + pub tunable_op_max_tuning_duration_ms: core::ffi::c_int +} +#[doc = " \\brief TensorRT Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_TensorRT"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtTensorRTProviderOptions { + #[doc = "< CUDA device id (0 = default device)"] + pub device_id: core::ffi::c_int, + pub has_user_compute_stream: core::ffi::c_int, + pub user_compute_stream: *mut core::ffi::c_void, + pub trt_max_partition_iterations: core::ffi::c_int, + pub trt_min_subgraph_size: core::ffi::c_int, + pub trt_max_workspace_size: usize, + pub trt_fp16_enable: core::ffi::c_int, + pub trt_int8_enable: core::ffi::c_int, + pub trt_int8_calibration_table_name: *const core::ffi::c_char, + pub trt_int8_use_native_calibration_table: core::ffi::c_int, + pub trt_dla_enable: core::ffi::c_int, + pub trt_dla_core: core::ffi::c_int, + pub trt_dump_subgraphs: core::ffi::c_int, + pub trt_engine_cache_enable: core::ffi::c_int, + pub trt_engine_cache_path: *const core::ffi::c_char, + pub trt_engine_decryption_enable: core::ffi::c_int, + pub trt_engine_decryption_lib_path: *const core::ffi::c_char, + pub trt_force_sequential_engine_build: core::ffi::c_int +} +#[doc = " \\brief MIGraphX Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_MIGraphX"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtMIGraphXProviderOptions { + pub device_id: core::ffi::c_int, + pub migraphx_fp16_enable: core::ffi::c_int, + pub migraphx_int8_enable: core::ffi::c_int, + pub migraphx_use_native_calibration_table: core::ffi::c_int, + pub migraphx_int8_calibration_table_name: *const core::ffi::c_char, + pub migraphx_save_compiled_model: core::ffi::c_int, + pub migraphx_save_model_path: *const core::ffi::c_char, + pub migraphx_load_compiled_model: core::ffi::c_int, + pub migraphx_load_model_path: *const core::ffi::c_char, + pub migraphx_exhaustive_tune: bool +} +#[doc = " \\brief OpenVINO Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_OpenVINO"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtOpenVINOProviderOptions { + #[doc = " \\brief Device type string\n\n Valid settings are one of: \"CPU_FP32\", \"CPU_FP16\", \"GPU_FP32\", \"GPU_FP16\""] + pub device_type: *const core::ffi::c_char, + #[doc = "< 0 = disabled, nonzero = enabled"] + pub enable_npu_fast_compile: core::ffi::c_uchar, + pub device_id: *const core::ffi::c_char, + #[doc = "< 0 = Use default number of threads"] + pub num_of_threads: usize, + pub cache_dir: *const core::ffi::c_char, + pub context: *mut core::ffi::c_void, + #[doc = "< 0 = disabled, nonzero = enabled"] + pub enable_opencl_throttling: core::ffi::c_uchar, + #[doc = "< 0 = disabled, nonzero = enabled"] + pub enable_dynamic_shapes: core::ffi::c_uchar +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtTrainingSession { + _unused: [u8; 0] +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCheckpointState { + _unused: [u8; 0] +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtPropertyType { + OrtIntProperty = 0, + OrtFloatProperty = 1, + OrtStringProperty = 2 +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtTrainingApi { + pub LoadCheckpoint: unsafe extern "system" fn(checkpoint_path: *const ortchar, checkpoint_state: *mut *mut OrtCheckpointState) -> OrtStatusPtr, + pub SaveCheckpoint: + unsafe extern "system" fn(checkpoint_state: *mut OrtCheckpointState, checkpoint_path: *const ortchar, include_optimizer_state: bool) -> OrtStatusPtr, + pub CreateTrainingSession: unsafe extern "system" fn( + env: *const OrtEnv, + options: *const OrtSessionOptions, + checkpoint_state: *mut OrtCheckpointState, + train_model_path: *const ortchar, + eval_model_path: *const ortchar, + optimizer_model_path: *const ortchar, + out: *mut *mut OrtTrainingSession + ) -> OrtStatusPtr, + pub CreateTrainingSessionFromBuffer: unsafe extern "system" fn( + env: *const OrtEnv, + options: *const OrtSessionOptions, + checkpoint_state: *mut OrtCheckpointState, + train_model_data: *const (), + train_data_length: usize, + eval_model_data: *const (), + eval_data_length: usize, + optimizer_model_data: *const (), + optimizer_data_length: usize, + out: *mut *mut OrtTrainingSession + ) -> OrtStatusPtr, + pub TrainingSessionGetTrainingModelOutputCount: unsafe extern "system" fn(sess: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr, + pub TrainingSessionGetEvalModelOutputCount: unsafe extern "system" fn(sess: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr, + pub TrainingSessionGetTrainingModelOutputName: + unsafe extern "system" fn(sess: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr, + pub TrainingSessionGetEvalModelOutputName: + unsafe extern "system" fn(sess: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr, + pub LazyResetGrad: unsafe extern "system" fn(session: *mut OrtTrainingSession) -> OrtStatusPtr, + pub TrainStep: unsafe extern "system" fn( + session: *mut OrtTrainingSession, + run_options: *const OrtRunOptions, + inputs_len: usize, + inputs: *const *const OrtValue, + outputs_len: usize, + outputs: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub EvalStep: unsafe extern "system" fn( + session: *mut OrtTrainingSession, + run_options: *const OrtRunOptions, + inputs_len: usize, + inputs: *const *const OrtValue, + outputs_len: usize, + outputs: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub SetLearningRate: unsafe extern "system" fn(session: *mut OrtTrainingSession, learning_rate: f32) -> OrtStatusPtr, + pub GetLearningRate: unsafe extern "system" fn(session: *mut OrtTrainingSession, learning_rate: *mut f32) -> OrtStatusPtr, + pub OptimizerStep: unsafe extern "system" fn(session: *mut OrtTrainingSession, run_options: *const OrtRunOptions) -> OrtStatusPtr, + pub RegisterLinearLRScheduler: + unsafe extern "system" fn(session: *mut OrtTrainingSession, warmup_step_count: i64, total_step_count: i64, initial_lr: f32) -> OrtStatusPtr, + pub SchedulerStep: unsafe extern "system" fn(session: *mut OrtTrainingSession) -> OrtStatusPtr, + pub GetParametersSize: unsafe extern "system" fn(session: *mut OrtTrainingSession, out: *mut usize, trainable_only: bool) -> OrtStatusPtr, + pub CopyParametersToBuffer: + unsafe extern "system" fn(session: *mut OrtTrainingSession, parameters_buffer: *mut OrtValue, trainable_only: bool) -> OrtStatusPtr, + pub CopyBufferToParameters: + unsafe extern "system" fn(session: *mut OrtTrainingSession, parameters_buffer: *mut OrtValue, trainable_only: bool) -> OrtStatusPtr, + pub ReleaseTrainingSession: unsafe extern "system" fn(input: *mut OrtTrainingSession), + pub ReleaseCheckpointState: unsafe extern "system" fn(input: *mut OrtCheckpointState), + pub ExportModelForInferencing: unsafe extern "system" fn( + session: *mut OrtTrainingSession, + inference_model_path: *const ortchar, + graph_outputs_len: usize, + graph_output_names: *const *const c_char + ) -> OrtStatusPtr, + pub SetSeed: unsafe extern "system" fn(seed: i64) -> OrtStatusPtr, + pub TrainingSessionGetTrainingModelInputCount: unsafe extern "system" fn(session: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr, + pub TrainingSessionGetEvalModelInputCount: unsafe extern "system" fn(session: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr, + pub TrainingSessionGetTrainingModelInputName: + unsafe extern "system" fn(session: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr, + pub TrainingSessionGetEvalModelInputName: + unsafe extern "system" fn(session: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr, + pub AddProperty: unsafe extern "system" fn( + checkpoint_state: *mut OrtCheckpointState, + property_name: *const c_char, + property_type: OrtPropertyType, + property_value: *const () + ) -> OrtStatusPtr, + pub GetProperty: unsafe extern "system" fn( + checkpoint_state: *mut OrtCheckpointState, + property_name: *const c_char, + allocator: *mut OrtAllocator, + property_type: *mut OrtPropertyType, + property_value: *mut *const () + ) -> OrtStatusPtr, + pub LoadCheckpointFromBuffer: + unsafe extern "system" fn(checkpoint_buffer: *const (), num_bytes: usize, checkpoint_state: *mut *mut OrtCheckpointState) -> OrtStatusPtr, + pub GetParameterTypeAndShape: unsafe extern "system" fn( + checkpoint_state: *const OrtCheckpointState, + parameter_name: *const c_char, + parameter_type_and_shape: *mut *mut OrtTensorTypeAndShapeInfo + ) -> OrtStatusPtr, + pub UpdateParameter: + unsafe extern "system" fn(checkpoint_state: *mut OrtCheckpointState, parameter_name: *const c_char, parameter: *mut OrtValue) -> OrtStatusPtr, + pub GetParameter: unsafe extern "system" fn( + checkpoint_state: *const OrtCheckpointState, + parameter_name: *const c_char, + allocator: *mut OrtAllocator, + parameter: *mut *mut OrtValue + ) -> OrtStatusPtr +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtModelEditorApi { + pub CreateTensorTypeInfo: unsafe extern "system" fn(tensor_info: *const OrtTensorTypeAndShapeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub CreateSparseTensorTypeInfo: unsafe extern "system" fn(tensor_info: *const OrtTensorTypeAndShapeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub CreateMapTypeInfo: unsafe extern "system" fn( + map_key_type: ONNXTensorElementDataType, + map_value_type: *const OrtTypeInfo, + type_info: *mut *mut OrtTypeInfo + ) -> OrtStatusPtr, + pub CreateSequenceTypeInfo: unsafe extern "system" fn(sequence_type: *const OrtTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub CreateOptionalTypeInfo: unsafe extern "system" fn(contained_type: *const OrtTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub CreateValueInfo: unsafe extern "system" fn(name: *const c_char, type_info: *const OrtTypeInfo, value_info: *mut *mut OrtValueInfo) -> OrtStatusPtr, + pub CreateNode: unsafe extern "system" fn( + operator_name: *const c_char, + domain_name: *const c_char, + node_name: *const c_char, + input_names: *const *const c_char, + input_names_len: usize, + output_names: *const *const c_char, + output_names_len: usize, + attributes: *mut *mut OrtOpAttr, + attribs_len: usize, + node: *mut *mut OrtNode + ) -> OrtStatusPtr, + pub CreateGraph: unsafe extern "system" fn(graph: *mut *mut OrtGraph) -> OrtStatusPtr, + pub SetGraphInputs: unsafe extern "system" fn(graph: *mut OrtGraph, inputs: *mut *mut OrtValueInfo, inputs_len: usize) -> OrtStatusPtr, + pub SetGraphOutputs: unsafe extern "system" fn(graph: *mut OrtGraph, outputs: *mut *mut OrtValueInfo, outputs_len: usize) -> OrtStatusPtr, + pub AddInitializerToGraph: + unsafe extern "system" fn(graph: *mut OrtGraph, name: *const c_char, tensor: *mut OrtValue, data_is_external: bool) -> OrtStatusPtr, + pub AddNodeToGraph: unsafe extern "system" fn(graph: *mut OrtGraph, node: *mut OrtNode) -> OrtStatusPtr, + pub CreateModel: unsafe extern "system" fn( + domain_names: *const *const c_char, + opset_versions: *const i32, + opset_entries_len: usize, + model: *mut *mut OrtModel + ) -> OrtStatusPtr, + pub AddGraphToModel: unsafe extern "system" fn(model: *mut OrtModel, graph: *mut OrtGraph) -> OrtStatusPtr, + pub CreateSessionFromModel: + unsafe extern "system" fn(env: *const OrtEnv, model: *const OrtModel, options: *const OrtSessionOptions, out: *mut *mut OrtSession) -> OrtStatusPtr, + pub CreateModelEditorSession: + unsafe extern "system" fn(env: *const OrtEnv, model_path: *const ortchar, options: *const OrtSessionOptions, out: *mut *mut OrtSession) -> OrtStatusPtr, + pub CreateModelEditorSessionFromArray: unsafe extern "system" fn( + env: *const OrtEnv, + model_data: *const c_void, + model_data_length: usize, + options: *const OrtSessionOptions, + out: *mut *mut OrtSession + ) -> OrtStatusPtr, + pub SessionGetOpsetForDomain: unsafe extern "system" fn(session: *const OrtSession, domain: *const c_char, opset: *mut i32) -> OrtStatusPtr, + pub ApplyModelToModelEditorSession: unsafe extern "system" fn(session: *mut OrtSession, model: *mut OrtModel) -> OrtStatusPtr, + pub FinalizeModelEditorSession: unsafe extern "system" fn( + session: *mut OrtSession, + options: *const OrtSessionOptions, + prepacked_weights_container: *const OrtPrepackedWeightsContainer + ) -> OrtStatusPtr +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCompileApi { + pub ReleaseModelCompilationOptions: unsafe extern "system" fn(input: *mut OrtModelCompilationOptions), + pub CreateModelCompilationOptionsFromSessionOptions: + unsafe extern "system" fn(env: *const OrtEnv, session_options: *const OrtSessionOptions, out: *mut *mut OrtModelCompilationOptions) -> OrtStatusPtr, + pub ModelCompilationOptions_SetInputModelPath: + unsafe extern "system" fn(model_compile_options: *mut OrtModelCompilationOptions, input_model_path: *const ortchar) -> OrtStatusPtr, + pub ModelCompilationOptions_SetInputModelFromBuffer: unsafe extern "system" fn( + model_compile_options: *mut OrtModelCompilationOptions, + input_model_data: *const c_void, + input_model_data_size: usize + ) -> OrtStatusPtr, + pub ModelCompilationOptions_SetOutputModelPath: + unsafe extern "system" fn(model_compile_options: *mut OrtModelCompilationOptions, output_model_path: *const ortchar) -> OrtStatusPtr, + pub ModelCompilationOptions_SetOutputModelExternalInitializersFile: unsafe extern "system" fn( + model_compile_options: *mut OrtModelCompilationOptions, + external_initializers_file_path: *const ortchar, + external_initializers_size_threshold: usize + ) -> OrtStatusPtr, + pub ModelCompilationOptions_SetOutputModelBuffer: unsafe extern "system" fn( + model_compile_options: *mut OrtModelCompilationOptions, + allocator: *mut OrtAllocator, + output_model_buffer_ptr: *mut *mut c_void, + output_model_buffer_size_ptr: *mut usize + ) -> OrtStatusPtr, + pub ModelCompilationOptions_SetEpContextEmbedMode: + unsafe extern "system" fn(model_compile_options: *mut OrtModelCompilationOptions, embed_ep_context_in_model: bool) -> OrtStatusPtr, + pub CompileModel: unsafe extern "system" fn(env: *const OrtEnv, model_options: *const OrtModelCompilationOptions) -> OrtStatusPtr +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtEpApi { + _unused: [u8; 0] +} +#[doc = " \\brief The helper interface to get the right version of OrtApi\n\n Get a pointer to this structure through ::OrtGetApiBase"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtApiBase { + #[doc = " \\brief Get a pointer to the requested version of the ::OrtApi\n\n \\param[in] version Must be ::ORT_API_VERSION\n \\return The ::OrtApi for the version requested, nullptr will be returned if this version is unsupported, for example when using a runtime\n older than the version created with this header file.\n\n One can call GetVersionString() to get the version of the Onnxruntime library for logging\n and error reporting purposes."] + pub GetApi: unsafe extern "system" fn(version: u32) -> *const OrtApi, + #[doc = " \\brief Returns a null terminated string of the version of the Onnxruntime library (eg: \"1.8.1\")\n\n \\return UTF-8 encoded version string. Do not deallocate the returned buffer."] + pub GetVersionString: unsafe extern "system" fn() -> *const core::ffi::c_char +} +extern "system" { + #[doc = " \\brief The Onnxruntime library's entry point to access the C API\n\n Call this to get the a pointer to an ::OrtApiBase"] + pub fn OrtGetApiBase() -> *const OrtApiBase; +} +#[doc = " \\brief Thread work loop function\n\n Onnxruntime will provide the working loop on custom thread creation\n Argument is an onnxruntime built-in type which will be provided when thread pool calls OrtCustomCreateThreadFn"] +pub type OrtThreadWorkerFn = unsafe extern "system" fn(ort_worker_fn_param: *mut core::ffi::c_void); +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCustomHandleType { + pub __place_holder: core::ffi::c_char +} +pub type OrtCustomThreadHandle = *const OrtCustomHandleType; +#[doc = " \\brief Ort custom thread creation function\n\n The function should return a thread handle to be used in onnxruntime thread pools\n Onnxruntime will throw exception on return value of nullptr or 0, indicating that the function failed to create a thread"] +pub type OrtCustomCreateThreadFn = Option< + unsafe extern "system" fn( + ort_custom_thread_creation_options: *mut core::ffi::c_void, + ort_thread_worker_fn: OrtThreadWorkerFn, + ort_worker_fn_param: *mut core::ffi::c_void + ) -> OrtCustomThreadHandle +>; +#[doc = " \\brief Custom thread join function\n\n Onnxruntime thread pool destructor will call the function to join a custom thread.\n Argument ort_custom_thread_handle is the value returned by OrtCustomCreateThreadFn"] +pub type OrtCustomJoinThreadFn = Option; +#[doc = " \\brief Callback function for RunAsync\n\n \\param[in] user_data User specific data that passed back to the callback\n \\param[out] outputs On succeed, outputs host inference results, on error, the value will be nullptr\n \\param[out] num_outputs Number of outputs, on error, the value will be zero\n \\param[out] status On error, status will provide details"] +pub type RunAsyncCallbackFn = + Option; +#[doc = " \\brief The C API\n\n All C API functions are defined inside this structure as pointers to functions.\n Call OrtApiBase::GetApi to get a pointer to it\n\n \\nosubgrouping"] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtApi { + #[doc = " \\brief Create an OrtStatus from a null terminated string\n\n \\param[in] code\n \\param[in] msg A null-terminated string. Its contents will be copied.\n \\return A new OrtStatus object, must be destroyed with OrtApi::ReleaseStatus"] + pub CreateStatus: unsafe extern "system" fn(code: OrtErrorCode, msg: *const core::ffi::c_char) -> OrtStatusPtr, + #[doc = " \\brief Get OrtErrorCode from OrtStatus\n\n \\param[in] status\n \\return OrtErrorCode that \\p status was created with"] + pub GetErrorCode: unsafe extern "system" fn(status: *const OrtStatus) -> OrtErrorCode, + #[doc = " \\brief Get error string from OrtStatus\n\n \\param[in] status\n \\return The error message inside the `status`. Do not free the returned value."] + pub GetErrorMessage: unsafe extern "system" fn(status: *const OrtStatus) -> *const core::ffi::c_char, + pub CreateEnv: unsafe extern "system" fn(log_severity_level: OrtLoggingLevel, logid: *const core::ffi::c_char, out: *mut *mut OrtEnv) -> OrtStatusPtr, + pub CreateEnvWithCustomLogger: unsafe extern "system" fn( + logging_function: OrtLoggingFunction, + logger_param: *mut core::ffi::c_void, + log_severity_level: OrtLoggingLevel, + logid: *const core::ffi::c_char, + out: *mut *mut OrtEnv + ) -> OrtStatusPtr, + pub EnableTelemetryEvents: unsafe extern "system" fn(env: *const OrtEnv) -> OrtStatusPtr, + pub DisableTelemetryEvents: unsafe extern "system" fn(env: *const OrtEnv) -> OrtStatusPtr, + pub CreateSession: + unsafe extern "system" fn(env: *const OrtEnv, model_path: *const ortchar, options: *const OrtSessionOptions, out: *mut *mut OrtSession) -> OrtStatusPtr, + pub CreateSessionFromArray: unsafe extern "system" fn( + env: *const OrtEnv, + model_data: *const core::ffi::c_void, + model_data_length: usize, + options: *const OrtSessionOptions, + out: *mut *mut OrtSession + ) -> OrtStatusPtr, + pub Run: unsafe extern "system" fn( + session: *mut OrtSession, + run_options: *const OrtRunOptions, + input_names: *const *const core::ffi::c_char, + inputs: *const *const OrtValue, + input_len: usize, + output_names: *const *const core::ffi::c_char, + output_names_len: usize, + outputs: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub CreateSessionOptions: unsafe extern "system" fn(options: *mut *mut OrtSessionOptions) -> OrtStatusPtr, + pub SetOptimizedModelFilePath: unsafe extern "system" fn(options: *mut OrtSessionOptions, optimized_model_filepath: *const ortchar) -> OrtStatusPtr, + pub CloneSessionOptions: unsafe extern "system" fn(in_options: *const OrtSessionOptions, out_options: *mut *mut OrtSessionOptions) -> OrtStatusPtr, + pub SetSessionExecutionMode: unsafe extern "system" fn(options: *mut OrtSessionOptions, execution_mode: ExecutionMode) -> OrtStatusPtr, + pub EnableProfiling: unsafe extern "system" fn(options: *mut OrtSessionOptions, profile_file_prefix: *const ortchar) -> OrtStatusPtr, + pub DisableProfiling: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr, + pub EnableMemPattern: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr, + pub DisableMemPattern: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr, + pub EnableCpuMemArena: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr, + pub DisableCpuMemArena: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr, + pub SetSessionLogId: unsafe extern "system" fn(options: *mut OrtSessionOptions, logid: *const core::ffi::c_char) -> OrtStatusPtr, + pub SetSessionLogVerbosityLevel: unsafe extern "system" fn(options: *mut OrtSessionOptions, session_log_verbosity_level: core::ffi::c_int) -> OrtStatusPtr, + pub SetSessionLogSeverityLevel: unsafe extern "system" fn(options: *mut OrtSessionOptions, session_log_severity_level: core::ffi::c_int) -> OrtStatusPtr, + pub SetSessionGraphOptimizationLevel: + unsafe extern "system" fn(options: *mut OrtSessionOptions, graph_optimization_level: GraphOptimizationLevel) -> OrtStatusPtr, + pub SetIntraOpNumThreads: unsafe extern "system" fn(options: *mut OrtSessionOptions, intra_op_num_threads: core::ffi::c_int) -> OrtStatusPtr, + pub SetInterOpNumThreads: unsafe extern "system" fn(options: *mut OrtSessionOptions, inter_op_num_threads: core::ffi::c_int) -> OrtStatusPtr, + pub CreateCustomOpDomain: unsafe extern "system" fn(domain: *const core::ffi::c_char, out: *mut *mut OrtCustomOpDomain) -> OrtStatusPtr, + pub CustomOpDomain_Add: unsafe extern "system" fn(custom_op_domain: *mut OrtCustomOpDomain, op: *const OrtCustomOp) -> OrtStatusPtr, + pub AddCustomOpDomain: unsafe extern "system" fn(options: *mut OrtSessionOptions, custom_op_domain: *mut OrtCustomOpDomain) -> OrtStatusPtr, + pub RegisterCustomOpsLibrary: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + library_path: *const core::ffi::c_char, + library_handle: *mut *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub SessionGetInputCount: unsafe extern "system" fn(session: *const OrtSession, out: *mut usize) -> OrtStatusPtr, + pub SessionGetOutputCount: unsafe extern "system" fn(session: *const OrtSession, out: *mut usize) -> OrtStatusPtr, + pub SessionGetOverridableInitializerCount: unsafe extern "system" fn(session: *const OrtSession, out: *mut usize) -> OrtStatusPtr, + pub SessionGetInputTypeInfo: unsafe extern "system" fn(session: *const OrtSession, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub SessionGetOutputTypeInfo: unsafe extern "system" fn(session: *const OrtSession, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub SessionGetOverridableInitializerTypeInfo: + unsafe extern "system" fn(session: *const OrtSession, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub SessionGetInputName: + unsafe extern "system" fn(session: *const OrtSession, index: usize, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub SessionGetOutputName: + unsafe extern "system" fn(session: *const OrtSession, index: usize, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub SessionGetOverridableInitializerName: + unsafe extern "system" fn(session: *const OrtSession, index: usize, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub CreateRunOptions: unsafe extern "system" fn(out: *mut *mut OrtRunOptions) -> OrtStatusPtr, + pub RunOptionsSetRunLogVerbosityLevel: unsafe extern "system" fn(options: *mut OrtRunOptions, log_verbosity_level: core::ffi::c_int) -> OrtStatusPtr, + pub RunOptionsSetRunLogSeverityLevel: unsafe extern "system" fn(options: *mut OrtRunOptions, log_severity_level: core::ffi::c_int) -> OrtStatusPtr, + pub RunOptionsSetRunTag: unsafe extern "system" fn(options: *mut OrtRunOptions, run_tag: *const core::ffi::c_char) -> OrtStatusPtr, + pub RunOptionsGetRunLogVerbosityLevel: unsafe extern "system" fn(options: *const OrtRunOptions, log_verbosity_level: *mut core::ffi::c_int) -> OrtStatusPtr, + pub RunOptionsGetRunLogSeverityLevel: unsafe extern "system" fn(options: *const OrtRunOptions, log_severity_level: *mut core::ffi::c_int) -> OrtStatusPtr, + pub RunOptionsGetRunTag: unsafe extern "system" fn(options: *const OrtRunOptions, run_tag: *mut *const core::ffi::c_char) -> OrtStatusPtr, + pub RunOptionsSetTerminate: unsafe extern "system" fn(options: *mut OrtRunOptions) -> OrtStatusPtr, + pub RunOptionsUnsetTerminate: unsafe extern "system" fn(options: *mut OrtRunOptions) -> OrtStatusPtr, + pub CreateTensorAsOrtValue: unsafe extern "system" fn( + allocator: *mut OrtAllocator, + shape: *const i64, + shape_len: usize, + type_: ONNXTensorElementDataType, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub CreateTensorWithDataAsOrtValue: unsafe extern "system" fn( + info: *const OrtMemoryInfo, + p_data: *mut core::ffi::c_void, + p_data_len: usize, + shape: *const i64, + shape_len: usize, + type_: ONNXTensorElementDataType, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub IsTensor: unsafe extern "system" fn(value: *const OrtValue, out: *mut core::ffi::c_int) -> OrtStatusPtr, + pub GetTensorMutableData: unsafe extern "system" fn(value: *mut OrtValue, out: *mut *mut core::ffi::c_void) -> OrtStatusPtr, + pub FillStringTensor: unsafe extern "system" fn(value: *mut OrtValue, s: *const *const core::ffi::c_char, s_len: usize) -> OrtStatusPtr, + pub GetStringTensorDataLength: unsafe extern "system" fn(value: *const OrtValue, len: *mut usize) -> OrtStatusPtr, + pub GetStringTensorContent: + unsafe extern "system" fn(value: *const OrtValue, s: *mut core::ffi::c_void, s_len: usize, offsets: *mut usize, offsets_len: usize) -> OrtStatusPtr, + pub CastTypeInfoToTensorInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtTensorTypeAndShapeInfo) -> OrtStatusPtr, + pub GetOnnxTypeFromTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut ONNXType) -> OrtStatusPtr, + pub CreateTensorTypeAndShapeInfo: unsafe extern "system" fn(out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr, + pub SetTensorElementType: unsafe extern "system" fn(info: *mut OrtTensorTypeAndShapeInfo, type_: ONNXTensorElementDataType) -> OrtStatusPtr, + pub SetDimensions: unsafe extern "system" fn(info: *mut OrtTensorTypeAndShapeInfo, dim_values: *const i64, dim_count: usize) -> OrtStatusPtr, + pub GetTensorElementType: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, out: *mut ONNXTensorElementDataType) -> OrtStatusPtr, + pub GetDimensionsCount: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, out: *mut usize) -> OrtStatusPtr, + pub GetDimensions: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, dim_values: *mut i64, dim_values_length: usize) -> OrtStatusPtr, + pub GetSymbolicDimensions: + unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, dim_params: *mut *const core::ffi::c_char, dim_params_length: usize) -> OrtStatusPtr, + pub GetTensorShapeElementCount: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, out: *mut usize) -> OrtStatusPtr, + pub GetTensorTypeAndShape: unsafe extern "system" fn(value: *const OrtValue, out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr, + pub GetTypeInfo: unsafe extern "system" fn(value: *const OrtValue, out: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub GetValueType: unsafe extern "system" fn(value: *const OrtValue, out: *mut ONNXType) -> OrtStatusPtr, + pub CreateMemoryInfo: unsafe extern "system" fn( + name: *const core::ffi::c_char, + type_: OrtAllocatorType, + id: core::ffi::c_int, + mem_type: OrtMemType, + out: *mut *mut OrtMemoryInfo + ) -> OrtStatusPtr, + pub CreateCpuMemoryInfo: unsafe extern "system" fn(type_: OrtAllocatorType, mem_type: OrtMemType, out: *mut *mut OrtMemoryInfo) -> OrtStatusPtr, + pub CompareMemoryInfo: unsafe extern "system" fn(info1: *const OrtMemoryInfo, info2: *const OrtMemoryInfo, out: *mut core::ffi::c_int) -> OrtStatusPtr, + pub MemoryInfoGetName: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut *const core::ffi::c_char) -> OrtStatusPtr, + pub MemoryInfoGetId: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut core::ffi::c_int) -> OrtStatusPtr, + pub MemoryInfoGetMemType: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut OrtMemType) -> OrtStatusPtr, + pub MemoryInfoGetType: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut OrtAllocatorType) -> OrtStatusPtr, + pub AllocatorAlloc: unsafe extern "system" fn(ort_allocator: *mut OrtAllocator, size: usize, out: *mut *mut core::ffi::c_void) -> OrtStatusPtr, + pub AllocatorFree: unsafe extern "system" fn(ort_allocator: *mut OrtAllocator, p: *mut core::ffi::c_void) -> OrtStatusPtr, + pub AllocatorGetInfo: unsafe extern "system" fn(ort_allocator: *const OrtAllocator, out: *mut *const OrtMemoryInfo) -> OrtStatusPtr, + pub GetAllocatorWithDefaultOptions: unsafe extern "system" fn(out: *mut *mut OrtAllocator) -> OrtStatusPtr, + pub AddFreeDimensionOverride: + unsafe extern "system" fn(options: *mut OrtSessionOptions, dim_denotation: *const core::ffi::c_char, dim_value: i64) -> OrtStatusPtr, + pub GetValue: + unsafe extern "system" fn(value: *const OrtValue, index: core::ffi::c_int, allocator: *mut OrtAllocator, out: *mut *mut OrtValue) -> OrtStatusPtr, + pub GetValueCount: unsafe extern "system" fn(value: *const OrtValue, out: *mut usize) -> OrtStatusPtr, + pub CreateValue: unsafe extern "system" fn(in_: *const *const OrtValue, num_values: usize, value_type: ONNXType, out: *mut *mut OrtValue) -> OrtStatusPtr, + pub CreateOpaqueValue: unsafe extern "system" fn( + domain_name: *const core::ffi::c_char, + type_name: *const core::ffi::c_char, + data_container: *const core::ffi::c_void, + data_container_size: usize, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub GetOpaqueValue: unsafe extern "system" fn( + domain_name: *const core::ffi::c_char, + type_name: *const core::ffi::c_char, + in_: *const OrtValue, + data_container: *mut core::ffi::c_void, + data_container_size: usize + ) -> OrtStatusPtr, + pub KernelInfoGetAttribute_float: unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut f32) -> OrtStatusPtr, + pub KernelInfoGetAttribute_int64: unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut i64) -> OrtStatusPtr, + pub KernelInfoGetAttribute_string: + unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr, + pub KernelContext_GetInputCount: unsafe extern "system" fn(context: *const OrtKernelContext, out: *mut usize) -> OrtStatusPtr, + pub KernelContext_GetOutputCount: unsafe extern "system" fn(context: *const OrtKernelContext, out: *mut usize) -> OrtStatusPtr, + pub KernelContext_GetInput: unsafe extern "system" fn(context: *const OrtKernelContext, index: usize, out: *mut *const OrtValue) -> OrtStatusPtr, + pub KernelContext_GetOutput: unsafe extern "system" fn( + context: *mut OrtKernelContext, + index: usize, + dim_values: *const i64, + dim_count: usize, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub ReleaseEnv: unsafe extern "system" fn(input: *mut OrtEnv), + pub ReleaseStatus: unsafe extern "system" fn(input: *mut OrtStatus), + pub ReleaseMemoryInfo: unsafe extern "system" fn(input: *mut OrtMemoryInfo), + pub ReleaseSession: unsafe extern "system" fn(input: *mut OrtSession), + pub ReleaseValue: unsafe extern "system" fn(input: *mut OrtValue), + pub ReleaseRunOptions: unsafe extern "system" fn(input: *mut OrtRunOptions), + pub ReleaseTypeInfo: unsafe extern "system" fn(input: *mut OrtTypeInfo), + pub ReleaseTensorTypeAndShapeInfo: unsafe extern "system" fn(input: *mut OrtTensorTypeAndShapeInfo), + pub ReleaseSessionOptions: unsafe extern "system" fn(input: *mut OrtSessionOptions), + pub ReleaseCustomOpDomain: unsafe extern "system" fn(input: *mut OrtCustomOpDomain), + pub GetDenotationFromTypeInfo: + unsafe extern "system" fn(type_info: *const OrtTypeInfo, denotation: *mut *const core::ffi::c_char, len: *mut usize) -> OrtStatusPtr, + pub CastTypeInfoToMapTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtMapTypeInfo) -> OrtStatusPtr, + pub CastTypeInfoToSequenceTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtSequenceTypeInfo) -> OrtStatusPtr, + pub GetMapKeyType: unsafe extern "system" fn(map_type_info: *const OrtMapTypeInfo, out: *mut ONNXTensorElementDataType) -> OrtStatusPtr, + pub GetMapValueType: unsafe extern "system" fn(map_type_info: *const OrtMapTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub GetSequenceElementType: unsafe extern "system" fn(sequence_type_info: *const OrtSequenceTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub ReleaseMapTypeInfo: unsafe extern "system" fn(input: *mut OrtMapTypeInfo), + pub ReleaseSequenceTypeInfo: unsafe extern "system" fn(input: *mut OrtSequenceTypeInfo), + pub SessionEndProfiling: + unsafe extern "system" fn(session: *mut OrtSession, allocator: *mut OrtAllocator, out: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub SessionGetModelMetadata: unsafe extern "system" fn(session: *const OrtSession, out: *mut *mut OrtModelMetadata) -> OrtStatusPtr, + pub ModelMetadataGetProducerName: + unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub ModelMetadataGetGraphName: + unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub ModelMetadataGetDomain: + unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub ModelMetadataGetDescription: + unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub ModelMetadataLookupCustomMetadataMap: unsafe extern "system" fn( + model_metadata: *const OrtModelMetadata, + allocator: *mut OrtAllocator, + key: *const core::ffi::c_char, + value: *mut *mut core::ffi::c_char + ) -> OrtStatusPtr, + pub ModelMetadataGetVersion: unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, value: *mut i64) -> OrtStatusPtr, + pub ReleaseModelMetadata: unsafe extern "system" fn(input: *mut OrtModelMetadata), + pub CreateEnvWithGlobalThreadPools: unsafe extern "system" fn( + log_severity_level: OrtLoggingLevel, + logid: *const core::ffi::c_char, + tp_options: *const OrtThreadingOptions, + out: *mut *mut OrtEnv + ) -> OrtStatusPtr, + pub DisablePerSessionThreads: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr, + pub CreateThreadingOptions: unsafe extern "system" fn(out: *mut *mut OrtThreadingOptions) -> OrtStatusPtr, + pub ReleaseThreadingOptions: unsafe extern "system" fn(input: *mut OrtThreadingOptions), + pub ModelMetadataGetCustomMetadataMapKeys: unsafe extern "system" fn( + model_metadata: *const OrtModelMetadata, + allocator: *mut OrtAllocator, + keys: *mut *mut *mut core::ffi::c_char, + num_keys: *mut i64 + ) -> OrtStatusPtr, + pub AddFreeDimensionOverrideByName: + unsafe extern "system" fn(options: *mut OrtSessionOptions, dim_name: *const core::ffi::c_char, dim_value: i64) -> OrtStatusPtr, + pub GetAvailableProviders: unsafe extern "system" fn(out_ptr: *mut *mut *mut core::ffi::c_char, provider_length: *mut core::ffi::c_int) -> OrtStatusPtr, + pub ReleaseAvailableProviders: unsafe extern "system" fn(ptr: *mut *mut core::ffi::c_char, providers_length: core::ffi::c_int) -> OrtStatusPtr, + pub GetStringTensorElementLength: unsafe extern "system" fn(value: *const OrtValue, index: usize, out: *mut usize) -> OrtStatusPtr, + pub GetStringTensorElement: unsafe extern "system" fn(value: *const OrtValue, s_len: usize, index: usize, s: *mut core::ffi::c_void) -> OrtStatusPtr, + pub FillStringTensorElement: unsafe extern "system" fn(value: *mut OrtValue, s: *const core::ffi::c_char, index: usize) -> OrtStatusPtr, + pub AddSessionConfigEntry: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + config_key: *const core::ffi::c_char, + config_value: *const core::ffi::c_char + ) -> OrtStatusPtr, + pub CreateAllocator: unsafe extern "system" fn(session: *const OrtSession, mem_info: *const OrtMemoryInfo, out: *mut *mut OrtAllocator) -> OrtStatusPtr, + pub ReleaseAllocator: unsafe extern "system" fn(input: *mut OrtAllocator), + pub RunWithBinding: + unsafe extern "system" fn(session: *mut OrtSession, run_options: *const OrtRunOptions, binding_ptr: *const OrtIoBinding) -> OrtStatusPtr, + pub CreateIoBinding: unsafe extern "system" fn(session: *mut OrtSession, out: *mut *mut OrtIoBinding) -> OrtStatusPtr, + pub ReleaseIoBinding: unsafe extern "system" fn(input: *mut OrtIoBinding), + pub BindInput: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding, name: *const core::ffi::c_char, val_ptr: *const OrtValue) -> OrtStatusPtr, + pub BindOutput: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding, name: *const core::ffi::c_char, val_ptr: *const OrtValue) -> OrtStatusPtr, + pub BindOutputToDevice: + unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding, name: *const core::ffi::c_char, mem_info_ptr: *const OrtMemoryInfo) -> OrtStatusPtr, + pub GetBoundOutputNames: unsafe extern "system" fn( + binding_ptr: *const OrtIoBinding, + allocator: *mut OrtAllocator, + buffer: *mut *mut core::ffi::c_char, + lengths: *mut *mut usize, + count: *mut usize + ) -> OrtStatusPtr, + pub GetBoundOutputValues: unsafe extern "system" fn( + binding_ptr: *const OrtIoBinding, + allocator: *mut OrtAllocator, + output: *mut *mut *mut OrtValue, + output_count: *mut usize + ) -> OrtStatusPtr, + #[doc = " \\brief Clears any previously set Inputs for an ::OrtIoBinding"] + pub ClearBoundInputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding), + #[doc = " \\brief Clears any previously set Outputs for an ::OrtIoBinding"] + pub ClearBoundOutputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding), + pub TensorAt: unsafe extern "system" fn( + value: *mut OrtValue, + location_values: *const i64, + location_values_count: usize, + out: *mut *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub CreateAndRegisterAllocator: unsafe extern "system" fn(env: *mut OrtEnv, mem_info: *const OrtMemoryInfo, arena_cfg: *const OrtArenaCfg) -> OrtStatusPtr, + pub SetLanguageProjection: unsafe extern "system" fn(ort_env: *const OrtEnv, projection: OrtLanguageProjection) -> OrtStatusPtr, + pub SessionGetProfilingStartTimeNs: unsafe extern "system" fn(session: *const OrtSession, out: *mut u64) -> OrtStatusPtr, + pub SetGlobalIntraOpNumThreads: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, intra_op_num_threads: core::ffi::c_int) -> OrtStatusPtr, + pub SetGlobalInterOpNumThreads: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, inter_op_num_threads: core::ffi::c_int) -> OrtStatusPtr, + pub SetGlobalSpinControl: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, allow_spinning: core::ffi::c_int) -> OrtStatusPtr, + pub AddInitializer: unsafe extern "system" fn(options: *mut OrtSessionOptions, name: *const core::ffi::c_char, val: *const OrtValue) -> OrtStatusPtr, + pub CreateEnvWithCustomLoggerAndGlobalThreadPools: unsafe extern "system" fn( + logging_function: OrtLoggingFunction, + logger_param: *mut core::ffi::c_void, + log_severity_level: OrtLoggingLevel, + logid: *const core::ffi::c_char, + tp_options: *const OrtThreadingOptions, + out: *mut *mut OrtEnv + ) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_CUDA: + unsafe extern "system" fn(options: *mut OrtSessionOptions, cuda_options: *const OrtCUDAProviderOptions) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_ROCM: + unsafe extern "system" fn(options: *mut OrtSessionOptions, rocm_options: *const OrtROCMProviderOptions) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_OpenVINO: + unsafe extern "system" fn(options: *mut OrtSessionOptions, provider_options: *const OrtOpenVINOProviderOptions) -> OrtStatusPtr, + pub SetGlobalDenormalAsZero: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions) -> OrtStatusPtr, + pub CreateArenaCfg: unsafe extern "system" fn( + max_mem: usize, + arena_extend_strategy: core::ffi::c_int, + initial_chunk_size_bytes: core::ffi::c_int, + max_dead_bytes_per_chunk: core::ffi::c_int, + out: *mut *mut OrtArenaCfg + ) -> OrtStatusPtr, + pub ReleaseArenaCfg: unsafe extern "system" fn(input: *mut OrtArenaCfg), + pub ModelMetadataGetGraphDescription: + unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_TensorRT: + unsafe extern "system" fn(options: *mut OrtSessionOptions, tensorrt_options: *const OrtTensorRTProviderOptions) -> OrtStatusPtr, + pub SetCurrentGpuDeviceId: unsafe extern "system" fn(device_id: core::ffi::c_int) -> OrtStatusPtr, + pub GetCurrentGpuDeviceId: unsafe extern "system" fn(device_id: *mut core::ffi::c_int) -> OrtStatusPtr, + pub KernelInfoGetAttributeArray_float: + unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut f32, size: *mut usize) -> OrtStatusPtr, + pub KernelInfoGetAttributeArray_int64: + unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut i64, size: *mut usize) -> OrtStatusPtr, + pub CreateArenaCfgV2: unsafe extern "system" fn( + arena_config_keys: *const *const core::ffi::c_char, + arena_config_values: *const usize, + num_keys: usize, + out: *mut *mut OrtArenaCfg + ) -> OrtStatusPtr, + pub AddRunConfigEntry: + unsafe extern "system" fn(options: *mut OrtRunOptions, config_key: *const core::ffi::c_char, config_value: *const core::ffi::c_char) -> OrtStatusPtr, + pub CreatePrepackedWeightsContainer: unsafe extern "system" fn(out: *mut *mut OrtPrepackedWeightsContainer) -> OrtStatusPtr, + pub ReleasePrepackedWeightsContainer: unsafe extern "system" fn(input: *mut OrtPrepackedWeightsContainer), + pub CreateSessionWithPrepackedWeightsContainer: unsafe extern "system" fn( + env: *const OrtEnv, + model_path: *const ortchar, + options: *const OrtSessionOptions, + prepacked_weights_container: *mut OrtPrepackedWeightsContainer, + out: *mut *mut OrtSession + ) -> OrtStatusPtr, + pub CreateSessionFromArrayWithPrepackedWeightsContainer: unsafe extern "system" fn( + env: *const OrtEnv, + model_data: *const core::ffi::c_void, + model_data_length: usize, + options: *const OrtSessionOptions, + prepacked_weights_container: *mut OrtPrepackedWeightsContainer, + out: *mut *mut OrtSession + ) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_TensorRT_V2: + unsafe extern "system" fn(options: *mut OrtSessionOptions, tensorrt_options: *const OrtTensorRTProviderOptionsV2) -> OrtStatusPtr, + pub CreateTensorRTProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtTensorRTProviderOptionsV2) -> OrtStatusPtr, + pub UpdateTensorRTProviderOptions: unsafe extern "system" fn( + tensorrt_options: *mut OrtTensorRTProviderOptionsV2, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub GetTensorRTProviderOptionsAsString: unsafe extern "system" fn( + tensorrt_options: *const OrtTensorRTProviderOptionsV2, + allocator: *mut OrtAllocator, + ptr: *mut *mut core::ffi::c_char + ) -> OrtStatusPtr, + #[doc = " \\brief Release an ::OrtTensorRTProviderOptionsV2\n\n \\note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does"] + pub ReleaseTensorRTProviderOptions: unsafe extern "system" fn(input: *mut OrtTensorRTProviderOptionsV2), + pub EnableOrtCustomOps: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr, + pub RegisterAllocator: unsafe extern "system" fn(env: *mut OrtEnv, allocator: *mut OrtAllocator) -> OrtStatusPtr, + pub UnregisterAllocator: unsafe extern "system" fn(env: *mut OrtEnv, mem_info: *const OrtMemoryInfo) -> OrtStatusPtr, + pub IsSparseTensor: unsafe extern "system" fn(value: *const OrtValue, out: *mut core::ffi::c_int) -> OrtStatusPtr, + pub CreateSparseTensorAsOrtValue: unsafe extern "system" fn( + allocator: *mut OrtAllocator, + dense_shape: *const i64, + dense_shape_len: usize, + type_: ONNXTensorElementDataType, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub FillSparseTensorCoo: unsafe extern "system" fn( + ort_value: *mut OrtValue, + data_mem_info: *const OrtMemoryInfo, + values_shape: *const i64, + values_shape_len: usize, + values: *const core::ffi::c_void, + indices_data: *const i64, + indices_num: usize + ) -> OrtStatusPtr, + pub FillSparseTensorCsr: unsafe extern "system" fn( + ort_value: *mut OrtValue, + data_mem_info: *const OrtMemoryInfo, + values_shape: *const i64, + values_shape_len: usize, + values: *const core::ffi::c_void, + inner_indices_data: *const i64, + inner_indices_num: usize, + outer_indices_data: *const i64, + outer_indices_num: usize + ) -> OrtStatusPtr, + pub FillSparseTensorBlockSparse: unsafe extern "system" fn( + ort_value: *mut OrtValue, + data_mem_info: *const OrtMemoryInfo, + values_shape: *const i64, + values_shape_len: usize, + values: *const core::ffi::c_void, + indices_shape_data: *const i64, + indices_shape_len: usize, + indices_data: *const i32 + ) -> OrtStatusPtr, + pub CreateSparseTensorWithValuesAsOrtValue: unsafe extern "system" fn( + info: *const OrtMemoryInfo, + p_data: *mut core::ffi::c_void, + dense_shape: *const i64, + dense_shape_len: usize, + values_shape: *const i64, + values_shape_len: usize, + type_: ONNXTensorElementDataType, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub UseCooIndices: unsafe extern "system" fn(ort_value: *mut OrtValue, indices_data: *mut i64, indices_num: usize) -> OrtStatusPtr, + pub UseCsrIndices: + unsafe extern "system" fn(ort_value: *mut OrtValue, inner_data: *mut i64, inner_num: usize, outer_data: *mut i64, outer_num: usize) -> OrtStatusPtr, + pub UseBlockSparseIndices: + unsafe extern "system" fn(ort_value: *mut OrtValue, indices_shape: *const i64, indices_shape_len: usize, indices_data: *mut i32) -> OrtStatusPtr, + pub GetSparseTensorFormat: unsafe extern "system" fn(ort_value: *const OrtValue, out: *mut OrtSparseFormat) -> OrtStatusPtr, + pub GetSparseTensorValuesTypeAndShape: unsafe extern "system" fn(ort_value: *const OrtValue, out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr, + pub GetSparseTensorValues: unsafe extern "system" fn(ort_value: *const OrtValue, out: *mut *const core::ffi::c_void) -> OrtStatusPtr, + pub GetSparseTensorIndicesTypeShape: + unsafe extern "system" fn(ort_value: *const OrtValue, indices_format: OrtSparseIndicesFormat, out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr, + pub GetSparseTensorIndices: unsafe extern "system" fn( + ort_value: *const OrtValue, + indices_format: OrtSparseIndicesFormat, + num_indices: *mut usize, + indices: *mut *const core::ffi::c_void + ) -> OrtStatusPtr, + pub HasValue: unsafe extern "system" fn(value: *const OrtValue, out: *mut core::ffi::c_int) -> OrtStatusPtr, + pub KernelContext_GetGPUComputeStream: unsafe extern "system" fn(context: *const OrtKernelContext, out: *mut *mut core::ffi::c_void) -> OrtStatusPtr, + pub GetTensorMemoryInfo: unsafe extern "system" fn(value: *const OrtValue, mem_info: *mut *const OrtMemoryInfo) -> OrtStatusPtr, + pub GetExecutionProviderApi: + unsafe extern "system" fn(provider_name: *const core::ffi::c_char, version: u32, provider_api: *mut *const core::ffi::c_void) -> OrtStatusPtr, + pub SessionOptionsSetCustomCreateThreadFn: + unsafe extern "system" fn(options: *mut OrtSessionOptions, ort_custom_create_thread_fn: OrtCustomCreateThreadFn) -> OrtStatusPtr, + pub SessionOptionsSetCustomThreadCreationOptions: + unsafe extern "system" fn(options: *mut OrtSessionOptions, ort_custom_thread_creation_options: *mut core::ffi::c_void) -> OrtStatusPtr, + pub SessionOptionsSetCustomJoinThreadFn: + unsafe extern "system" fn(options: *mut OrtSessionOptions, ort_custom_join_thread_fn: OrtCustomJoinThreadFn) -> OrtStatusPtr, + pub SetGlobalCustomCreateThreadFn: + unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, ort_custom_create_thread_fn: OrtCustomCreateThreadFn) -> OrtStatusPtr, + pub SetGlobalCustomThreadCreationOptions: + unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, ort_custom_thread_creation_options: *mut core::ffi::c_void) -> OrtStatusPtr, + pub SetGlobalCustomJoinThreadFn: + unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, ort_custom_join_thread_fn: OrtCustomJoinThreadFn) -> OrtStatusPtr, + pub SynchronizeBoundInputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding) -> OrtStatusPtr, + pub SynchronizeBoundOutputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_CUDA_V2: + unsafe extern "system" fn(options: *mut OrtSessionOptions, cuda_options: *const OrtCUDAProviderOptionsV2) -> OrtStatusPtr, + pub CreateCUDAProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtCUDAProviderOptionsV2) -> OrtStatusPtr, + pub UpdateCUDAProviderOptions: unsafe extern "system" fn( + cuda_options: *mut OrtCUDAProviderOptionsV2, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub GetCUDAProviderOptionsAsString: unsafe extern "system" fn( + cuda_options: *const OrtCUDAProviderOptionsV2, + allocator: *mut OrtAllocator, + ptr: *mut *mut core::ffi::c_char + ) -> OrtStatusPtr, + #[doc = " \\brief Release an ::OrtCUDAProviderOptionsV2\n\n \\note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does\n\n \\since Version 1.11."] + pub ReleaseCUDAProviderOptions: unsafe extern "system" fn(input: *mut OrtCUDAProviderOptionsV2), + pub SessionOptionsAppendExecutionProvider_MIGraphX: + unsafe extern "system" fn(options: *mut OrtSessionOptions, migraphx_options: *const OrtMIGraphXProviderOptions) -> OrtStatusPtr, + pub AddExternalInitializers: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + initializer_names: *const *const core::ffi::c_char, + initializers: *const *const OrtValue, + initializers_num: usize + ) -> OrtStatusPtr, + pub CreateOpAttr: unsafe extern "system" fn( + name: *const core::ffi::c_char, + data: *const core::ffi::c_void, + len: core::ffi::c_int, + type_: OrtOpAttrType, + op_attr: *mut *mut OrtOpAttr + ) -> OrtStatusPtr, + pub ReleaseOpAttr: unsafe extern "system" fn(input: *mut OrtOpAttr), + pub CreateOp: unsafe extern "system" fn( + info: *const OrtKernelInfo, + op_name: *const core::ffi::c_char, + domain: *const core::ffi::c_char, + version: core::ffi::c_int, + type_constraint_names: *mut *const core::ffi::c_char, + type_constraint_values: *const ONNXTensorElementDataType, + type_constraint_count: core::ffi::c_int, + attr_values: *const *const OrtOpAttr, + attr_count: core::ffi::c_int, + input_count: core::ffi::c_int, + output_count: core::ffi::c_int, + ort_op: *mut *mut OrtOp + ) -> OrtStatusPtr, + pub InvokeOp: unsafe extern "system" fn( + context: *const OrtKernelContext, + ort_op: *const OrtOp, + input_values: *const *const OrtValue, + input_count: core::ffi::c_int, + output_values: *const *mut OrtValue, + output_count: core::ffi::c_int + ) -> OrtStatusPtr, + pub ReleaseOp: unsafe extern "system" fn(input: *mut OrtOp), + pub SessionOptionsAppendExecutionProvider: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + provider_name: *const core::ffi::c_char, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub CopyKernelInfo: unsafe extern "system" fn(info: *const OrtKernelInfo, info_copy: *mut *mut OrtKernelInfo) -> OrtStatusPtr, + pub ReleaseKernelInfo: unsafe extern "system" fn(input: *mut OrtKernelInfo), + #[doc = " \\name Ort Training\n @{\n** \\brief Gets the Training C Api struct\n*\n* Call this function to access the ::OrtTrainingApi structure that holds pointers to functions that enable\n* training with onnxruntime.\n* \\note A NULL pointer will be returned and no error message will be printed if the training api\n* is not supported with this build. A NULL pointer will be returned and an error message will be\n* printed if the provided version is unsupported, for example when using a runtime older than the\n* version created with this header file.\n*\n* \\param[in] version Must be ::ORT_API_VERSION\n* \\return The ::OrtTrainingApi struct for the version requested.\n*\n* \\since Version 1.13\n*/"] + pub GetTrainingApi: unsafe extern "system" fn(version: u32) -> *const OrtTrainingApi, + pub SessionOptionsAppendExecutionProvider_CANN: + unsafe extern "system" fn(options: *mut OrtSessionOptions, cann_options: *const OrtCANNProviderOptions) -> OrtStatusPtr, + pub CreateCANNProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtCANNProviderOptions) -> OrtStatusPtr, + pub UpdateCANNProviderOptions: unsafe extern "system" fn( + cann_options: *mut OrtCANNProviderOptions, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub GetCANNProviderOptionsAsString: + unsafe extern "system" fn(cann_options: *const OrtCANNProviderOptions, allocator: *mut OrtAllocator, ptr: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + #[doc = " \\brief Release an OrtCANNProviderOptions\n\n \\param[in] the pointer of OrtCANNProviderOptions which will been deleted\n\n \\since Version 1.13."] + pub ReleaseCANNProviderOptions: unsafe extern "system" fn(input: *mut OrtCANNProviderOptions), + pub MemoryInfoGetDeviceType: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut OrtMemoryInfoDeviceType), + pub UpdateEnvWithCustomLogLevel: unsafe extern "system" fn(ort_env: *mut OrtEnv, log_severity_level: OrtLoggingLevel) -> OrtStatusPtr, + pub SetGlobalIntraOpThreadAffinity: + unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, affinity_string: *const core::ffi::c_char) -> OrtStatusPtr, + pub RegisterCustomOpsLibrary_V2: unsafe extern "system" fn(options: *mut OrtSessionOptions, library_name: *const ortchar) -> OrtStatusPtr, + pub RegisterCustomOpsUsingFunction: + unsafe extern "system" fn(options: *mut OrtSessionOptions, registration_func_name: *const core::ffi::c_char) -> OrtStatusPtr, + pub KernelInfo_GetInputCount: unsafe extern "system" fn(info: *const OrtKernelInfo, out: *mut usize) -> OrtStatusPtr, + pub KernelInfo_GetOutputCount: unsafe extern "system" fn(info: *const OrtKernelInfo, out: *mut usize) -> OrtStatusPtr, + pub KernelInfo_GetInputName: + unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr, + pub KernelInfo_GetOutputName: + unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr, + pub KernelInfo_GetInputTypeInfo: unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub KernelInfo_GetOutputTypeInfo: unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub KernelInfoGetAttribute_tensor: unsafe extern "system" fn( + info: *const OrtKernelInfo, + name: *const core::ffi::c_char, + allocator: *mut OrtAllocator, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub HasSessionConfigEntry: + unsafe extern "system" fn(options: *const OrtSessionOptions, config_key: *const core::ffi::c_char, out: *mut core::ffi::c_int) -> OrtStatusPtr, + pub GetSessionConfigEntry: unsafe extern "system" fn( + options: *const OrtSessionOptions, + config_key: *const core::ffi::c_char, + config_value: *mut core::ffi::c_char, + size: *mut usize + ) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_Dnnl: + unsafe extern "system" fn(options: *mut OrtSessionOptions, dnnl_options: *const OrtDnnlProviderOptions) -> OrtStatusPtr, + pub CreateDnnlProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtDnnlProviderOptions) -> OrtStatusPtr, + pub UpdateDnnlProviderOptions: unsafe extern "system" fn( + dnnl_options: *mut OrtDnnlProviderOptions, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub GetDnnlProviderOptionsAsString: + unsafe extern "system" fn(dnnl_options: *const OrtDnnlProviderOptions, allocator: *mut OrtAllocator, ptr: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + #[doc = " \\brief Release an ::OrtDnnlProviderOptions\n\n \\since Version 1.15."] + pub ReleaseDnnlProviderOptions: unsafe extern "system" fn(input: *mut OrtDnnlProviderOptions), + pub KernelInfo_GetNodeName: unsafe extern "system" fn(info: *const OrtKernelInfo, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr, + pub KernelInfo_GetLogger: unsafe extern "system" fn(info: *const OrtKernelInfo, logger: *mut *const OrtLogger) -> OrtStatusPtr, + pub KernelContext_GetLogger: unsafe extern "system" fn(context: *const OrtKernelContext, logger: *mut *const OrtLogger) -> OrtStatusPtr, + pub Logger_LogMessage: unsafe extern "system" fn( + logger: *const OrtLogger, + log_severity_level: OrtLoggingLevel, + message: *const core::ffi::c_char, + file_path: *const ortchar, + line_number: core::ffi::c_int, + func_name: *const core::ffi::c_char + ) -> OrtStatusPtr, + pub Logger_GetLoggingSeverityLevel: unsafe extern "system" fn(logger: *const OrtLogger, out: *mut OrtLoggingLevel) -> OrtStatusPtr, + pub KernelInfoGetConstantInput_tensor: + unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, is_constant: *mut core::ffi::c_int, out: *mut *const OrtValue) -> OrtStatusPtr, + pub CastTypeInfoToOptionalTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtOptionalTypeInfo) -> OrtStatusPtr, + pub GetOptionalContainedTypeInfo: unsafe extern "system" fn(optional_type_info: *const OrtOptionalTypeInfo, out: *mut *mut OrtTypeInfo) -> OrtStatusPtr, + pub GetResizedStringTensorElementBuffer: + unsafe extern "system" fn(value: *mut OrtValue, index: usize, length_in_bytes: usize, buffer: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + pub KernelContext_GetAllocator: + unsafe extern "system" fn(context: *const OrtKernelContext, mem_info: *const OrtMemoryInfo, out: *mut *mut OrtAllocator) -> OrtStatusPtr, + #[doc = " \\brief Returns a null terminated string of the build info including git info and cxx flags\n\n \\return UTF-8 encoded version string. Do not deallocate the returned buffer.\n\n \\since Version 1.15."] + pub GetBuildInfoString: unsafe extern "system" fn() -> *const core::ffi::c_char, + pub CreateROCMProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtROCMProviderOptions) -> OrtStatusPtr, + pub UpdateROCMProviderOptions: unsafe extern "system" fn( + rocm_options: *mut OrtROCMProviderOptions, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub GetROCMProviderOptionsAsString: + unsafe extern "system" fn(rocm_options: *const OrtROCMProviderOptions, allocator: *mut OrtAllocator, ptr: *mut *mut core::ffi::c_char) -> OrtStatusPtr, + #[doc = " \\brief Release an ::OrtROCMProviderOptions\n\n \\note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does\n\n \\since Version 1.16."] + pub ReleaseROCMProviderOptions: unsafe extern "system" fn(input: *mut OrtROCMProviderOptions), + pub CreateAndRegisterAllocatorV2: unsafe extern "system" fn( + env: *mut OrtEnv, + provider_type: *const core::ffi::c_char, + mem_info: *const OrtMemoryInfo, + arena_cfg: *const OrtArenaCfg, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub RunAsync: unsafe extern "system" fn( + session: *mut OrtSession, + run_options: *const OrtRunOptions, + input_names: *const *const core::ffi::c_char, + input: *const *const OrtValue, + input_len: usize, + output_names: *const *const core::ffi::c_char, + output_names_len: usize, + output: *mut *mut OrtValue, + run_async_callback: RunAsyncCallbackFn, + user_data: *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub UpdateTensorRTProviderOptionsWithValue: unsafe extern "system" fn( + tensorrt_options: *mut OrtTensorRTProviderOptionsV2, + key: *const core::ffi::c_char, + value: *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub GetTensorRTProviderOptionsByName: unsafe extern "system" fn( + tensorrt_options: *const OrtTensorRTProviderOptionsV2, + key: *const core::ffi::c_char, + ptr: *mut *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub UpdateCUDAProviderOptionsWithValue: + unsafe extern "system" fn(cuda_options: *mut OrtCUDAProviderOptionsV2, key: *const core::ffi::c_char, value: *mut core::ffi::c_void) -> OrtStatusPtr, + pub GetCUDAProviderOptionsByName: unsafe extern "system" fn( + cuda_options: *const OrtCUDAProviderOptionsV2, + key: *const core::ffi::c_char, + ptr: *mut *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub KernelContext_GetResource: unsafe extern "system" fn( + context: *const OrtKernelContext, + resouce_version: core::ffi::c_int, + resource_id: core::ffi::c_int, + resource: *mut *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub SetUserLoggingFunction: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + user_logging_function: OrtLoggingFunction, + user_logging_param: *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub ShapeInferContext_GetInputCount: unsafe extern "system" fn(context: *const OrtShapeInferContext, out: *mut usize) -> OrtStatusPtr, + pub ShapeInferContext_GetInputTypeShape: + unsafe extern "system" fn(context: *const OrtShapeInferContext, index: usize, info: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr, + pub ShapeInferContext_GetAttribute: + unsafe extern "system" fn(context: *const OrtShapeInferContext, attr_name: *const core::ffi::c_char, attr: *mut *const OrtOpAttr) -> OrtStatusPtr, + pub ShapeInferContext_SetOutputTypeShape: + unsafe extern "system" fn(context: *const OrtShapeInferContext, index: usize, info: *const OrtTensorTypeAndShapeInfo) -> OrtStatusPtr, + pub SetSymbolicDimensions: + unsafe extern "system" fn(info: *mut OrtTensorTypeAndShapeInfo, dim_params: *mut *const core::ffi::c_char, dim_params_length: usize) -> OrtStatusPtr, + pub ReadOpAttr: + unsafe extern "system" fn(op_attr: *const OrtOpAttr, type_: OrtOpAttrType, data: *mut core::ffi::c_void, len: usize, out: *mut usize) -> OrtStatusPtr, + pub SetDeterministicCompute: unsafe extern "system" fn(options: *mut OrtSessionOptions, value: bool) -> OrtStatusPtr, + pub KernelContext_ParallelFor: unsafe extern "system" fn( + context: *const OrtKernelContext, + fn_: unsafe extern "system" fn(arg1: *mut core::ffi::c_void, arg2: usize), + total: usize, + num_batch: usize, + usr_data: *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_OpenVINO_V2: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_VitisAI: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + provider_options_keys: *const *const core::ffi::c_char, + provider_options_values: *const *const core::ffi::c_char, + num_keys: usize + ) -> OrtStatusPtr, + pub KernelContext_GetScratchBuffer: unsafe extern "system" fn( + context: *const OrtKernelContext, + mem_info: *const OrtMemoryInfo, + count_or_bytes: usize, + out: *mut *mut core::ffi::c_void + ) -> OrtStatusPtr, + pub KernelInfoGetAllocator: unsafe extern "system" fn(info: *const OrtKernelInfo, mem_type: OrtMemType, out: *mut *mut OrtAllocator) -> OrtStatusPtr, + pub AddExternalInitializersFromMemory: unsafe extern "system" fn( + options: *mut OrtSessionOptions, + external_initializer_file_names: *const *const ortchar, + external_initializer_file_buffer_array: *const *mut core::ffi::c_char, + external_initializer_file_lengths: *const usize, + num_external_initializer_files: usize + ) -> OrtStatusPtr, + pub CreateLoraAdapter: + unsafe extern "system" fn(adapter_file_path: *const ortchar, allocator: *mut OrtAllocator, out: *mut *mut OrtLoraAdapter) -> OrtStatusPtr, + pub CreateLoraAdapterFromArray: unsafe extern "system" fn( + bytes: *const core::ffi::c_void, + num_bytes: usize, + allocator: *mut OrtAllocator, + out: *mut *mut OrtLoraAdapter + ) -> OrtStatusPtr, + pub ReleaseLoraAdapter: unsafe extern "system" fn(input: *mut OrtLoraAdapter), + pub RunOptionsAddActiveLoraAdapter: unsafe extern "system" fn(options: *mut OrtRunOptions, adapter: *const OrtLoraAdapter) -> OrtStatusPtr, + pub SetEpDynamicOptions: unsafe extern "system" fn( + sess: *mut OrtSession, + keys: *const *const core::ffi::c_char, + values: *const *const core::ffi::c_char, + kv_len: usize + ) -> OrtStatusPtr, + pub ReleaseValueInfo: unsafe extern "system" fn(input: *mut OrtValueInfo), + pub ReleaseNode: unsafe extern "system" fn(input: *mut OrtNode), + pub ReleaseGraph: unsafe extern "system" fn(input: *mut OrtGraph), + pub ReleaseModel: unsafe extern "system" fn(input: *mut OrtModel), + pub GetValueInfoName: unsafe extern "system" fn(value_info: *const OrtValueInfo, name: *mut *const c_char) -> OrtStatusPtr, + pub GetValueInfoTypeInfo: unsafe extern "system" fn(value_info: *const OrtValueInfo, type_info: *mut *const OrtTypeInfo) -> OrtStatusPtr, + pub GetModelEditorApi: unsafe extern "system" fn() -> *const OrtModelEditorApi, + pub CreateTensorWithDataAndDeleterAsOrtValue: unsafe extern "system" fn( + deleter: *mut OrtAllocator, + p_data: *mut c_void, + p_data_len: usize, + shape: *const i64, + shape_len: usize, + r#type: ONNXTensorElementDataType, + out: *mut *mut OrtValue + ) -> OrtStatusPtr, + pub SessionOptionsSetLoadCancellationFlag: unsafe extern "system" fn(options: *mut OrtSessionOptions, cancel: bool) -> OrtStatusPtr, + pub GetCompileApi: unsafe extern "system" fn() -> *const OrtCompileApi, + pub CreateKeyValuePairs: unsafe extern "system" fn(out: *mut *mut OrtKeyValuePairs), + pub AddKeyValuePair: unsafe extern "system" fn(kvps: *mut OrtKeyValuePairs, key: *const c_char, value: *const c_char), + pub GetKeyValue: unsafe extern "system" fn(kvps: *const OrtKeyValuePairs, key: *const c_char) -> *const c_char, + pub GetKeyValuePairs: + unsafe extern "system" fn(kvps: *const OrtKeyValuePairs, keys: *mut *const *const c_char, values: *mut *const *const c_char, num_entries: *mut usize), + pub RemoveKeyValuePair: unsafe extern "system" fn(kvps: *mut OrtKeyValuePairs, key: *const c_char), + pub ReleaseKeyValuePairs: unsafe extern "system" fn(input: *mut OrtKeyValuePairs), + pub RegisterExecutionProviderLibrary: unsafe extern "system" fn(env: *mut OrtEnv, registration_name: *const c_char, path: *const ortchar) -> OrtStatusPtr, + pub UnregisterExecutionProviderLibrary: unsafe extern "system" fn(env: *mut OrtEnv, registration_name: *const c_char) -> OrtStatusPtr, + pub GetEpDevices: unsafe extern "system" fn(env: *const OrtEnv, ep_devices: *mut *const *const OrtEpDevice, num_ep_devices: *mut usize) -> OrtStatusPtr, + pub SessionOptionsAppendExecutionProvider_V2: unsafe extern "system" fn( + session_options: *mut OrtSessionOptions, + env: *mut OrtEnv, + ep_devices: *const *const OrtEpDevice, + num_ep_devices: usize, + ep_option_keys: *const *const c_char, + ep_option_vals: *const *const c_char, + num_ep_options: usize + ) -> OrtStatusPtr, + pub SessionOptionsSetEpSelectionPolicy: + unsafe extern "system" fn(session_options: *mut OrtSessionOptions, policy: OrtExecutionProviderDevicePolicy) -> OrtStatusPtr, + pub SessionOptionsSetEpSelectionPolicyDelegate: + unsafe extern "system" fn(session_options: *mut OrtSessionOptions, delegate: EpSelectionDelegate, delegate_state: *mut c_void) -> OrtStatusPtr, + pub HardwareDevice_Type: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> OrtHardwareDeviceType, + pub HardwareDevice_VendorId: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> u32, + pub HardwareDevice_Vendor: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> *const c_char, + pub HardwareDevice_DeviceId: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> u32, + pub HardwareDevice_Metadata: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> *const OrtKeyValuePairs, + pub EpDevice_EpName: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const c_char, + pub EpDevice_EpVendor: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const c_char, + pub EpDevice_EpMetadata: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs, + pub EpDevice_EpOptions: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs, + pub EpDevice_Device: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtHardwareDevice, + pub GetEpApi: unsafe extern "system" fn() -> *const OrtEpApi +} +#[repr(i32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum OrtCustomOpInputOutputCharacteristic { + INPUT_OUTPUT_REQUIRED = 0, + INPUT_OUTPUT_OPTIONAL = 1, + INPUT_OUTPUT_VARIADIC = 2 +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct OrtCustomOp { + pub version: u32, + pub CreateKernel: Option *mut core::ffi::c_void>, + pub GetName: Option *const core::ffi::c_char>, + pub GetExecutionProviderType: Option *const core::ffi::c_char>, + pub GetInputType: Option ONNXTensorElementDataType>, + pub GetInputTypeCount: Option usize>, + pub GetOutputType: Option ONNXTensorElementDataType>, + pub GetOutputTypeCount: Option usize>, + pub KernelCompute: Option, + pub KernelDestroy: Option, + pub GetInputCharacteristic: Option OrtCustomOpInputOutputCharacteristic>, + pub GetOutputCharacteristic: Option OrtCustomOpInputOutputCharacteristic>, + pub GetInputMemoryType: Option OrtMemType>, + pub GetVariadicInputMinArity: Option core::ffi::c_int>, + pub GetVariadicInputHomogeneity: Option core::ffi::c_int>, + pub GetVariadicOutputMinArity: Option core::ffi::c_int>, + pub GetVariadicOutputHomogeneity: Option core::ffi::c_int>, + pub CreateKernelV2: Option< + unsafe extern "system" fn(op: *const OrtCustomOp, api: *const OrtApi, info: *const OrtKernelInfo, kernel: *mut *mut core::ffi::c_void) -> OrtStatusPtr + >, + pub KernelComputeV2: Option OrtStatusPtr>, + pub InferOutputShapeFn: Option OrtStatusPtr>, + pub GetStartVersion: Option core::ffi::c_int>, + pub GetEndVersion: Option core::ffi::c_int>, + pub GetMayInplace: Option usize>, + pub ReleaseMayInplace: Option, + pub GetAliasMap: Option usize>, + pub ReleaseAliasMap: Option +} +extern "system" { + pub fn OrtSessionOptionsAppendExecutionProvider_CUDA(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr; + pub fn OrtSessionOptionsAppendExecutionProvider_ROCM(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr; + pub fn OrtSessionOptionsAppendExecutionProvider_MIGraphX(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr; + pub fn OrtSessionOptionsAppendExecutionProvider_Dnnl(options: *mut OrtSessionOptions, use_arena: core::ffi::c_int) -> OrtStatusPtr; + pub fn OrtSessionOptionsAppendExecutionProvider_Tensorrt(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr; +}