Add Rust EPContext data callbacks (#32310)
### Description
<!-- Describe your changes. -->
Adds Rust bindings for the stable EPContext data read callback APIs in
#32265.
- Provides transactional registration/clearing, Arc-backed callback
ownership, explicit callback errors, and an unwind-contained
allocator-safe trampoline.
- Uses API 31 callback/state-only native registration and retrieval.
`max_data_size` stays in Rust callback state and is enforced before
native output allocation; allocations inside the callback remain
application-owned policy.
- Preserves the newer fix from `97d3907fdc`: the environment lock is
released before native session creation, so callbacks can reenter
environment APIs without deadlocking.
- Merges #32265 at `e0cc266cdefef4e27104b14e4091a9d61f75a214`, including
its main-branch update, retained-NHWC READ-support validation, and
provider-specific callback preflight before capability-time I/O.
- Fixes the resulting Rust `E0004` build failure from the newly merged
FLOAT6 enum variants by adding both to the existing unsupported-output
dispatch. Extends unsupported-type conversion tests for both variants;
this does **not** add FLOAT6 tensor support.
- The stable callback signatures remain unchanged; preflight remains
core-owned.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
This independent binding PR remains stacked on #32265. Rust applications
retain bounded, application-managed EPContext reads and safe callback
ownership while following the stable transport ABI. Rust currently has
no model-compilation/write-callback surface.
The latest core checks provider-specific callback requirements before
capability discovery, including AOT, NHWC, and ORT-format paths, rather
than relying solely on checks immediately before `Compile()`. Its
main-branch merge also requires the explicit FLOAT6 compatibility cases
so regenerated Rust bindings compile.
Retarget to `main` after #32265 lands.
### Testing
Revalidated on Windows with Rust 1.99.0, libclang 18, regenerated
bindings from current source headers, and the runtime freshly built from
`e0cc266cde`.
- `cargo fmt --manifest-path .\rust\Cargo.toml --all -- --check` —
passed, with existing warnings for nightly-only rustfmt settings.
- With `ORT_RUST_STRATEGY=system`, `ORT_RUST_LIB_LOCATION` pointing to
the fresh import-library prefix, and `RUST_ONNXRUNTIME_LIBRARY_PATH`
pointing to the freshly rebuilt DLL: `cargo test --manifest-path
rust\Cargo.toml -j 4 -p onnxruntime --lib -- --test-threads=1` — 33
passed, 0 failed/ignored.
- This includes the environment-lock regression,
registration/replacement/clearing, ownership, concurrency, size
boundaries, allocator failures, panic/error handling, and both new
unsupported FLOAT6 conversion cases.
- `git diff --check e0cc266cdefef4e27104b14e4091a9d61f75a214 HEAD` —
passed for the binding PR delta.
Non-Windows, 32-bit execution, and hardware-provider-specific
callback/preflight paths were not run. Existing compiler warnings
outside this compatibility fix remain unchanged.
---------
Co-authored-by: Gopalakrishnan Nallasamy <gopalakrishnan.nallasamy@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>