Move OrtModelPackageApi to the experimental C API (#28990)
### Description
Move the existing model package C API off the stable `OrtApi` onto the
experimental name-based lookup mechanism added in #28746. Each model
package function is registered individually in
`include/onnxruntime/core/session/onnxruntime_experimental_c_api.inc`
with the `OrtModelPackageApi_` prefix and the `_SinceV28` version
suffix, following the lifecycle rules in
`docs/design/Experimental_C_API.md`.
Headline changes:
- `OrtApi::GetModelPackageApi`, the `OrtModelPackageApi` struct,
`OrtApis::GetModelPackageApi`, the `OrtModelPackageAPI` namespace,
`onnxruntime/core/session/model_package_api.h`, and the C++ wrappers
(`Ort::GetModelPackageApi`,
`ORT_DEFINE_RELEASE_FROM_API_STRUCT(ModelPackage*)`,
`ModelPackageOptions/Context/ComponentContext`) are removed.
- Opaque handle types (`OrtModelPackageOptions`,
`OrtModelPackageContext`, `OrtModelPackageComponentContext`) move into
`onnxruntime_experimental_c_api.h`.
- All 15 model package functions are registered in
`onnxruntime_experimental_c_api.inc`. Impls move into `namespace
OrtExperimentalApis` with `_SinceV28`-suffixed names in
`model_package_api.cc`; bodies are unchanged.
- `experimental_c_api.cc` gains a forward-decl block (driven by the same
`.inc` X-macro) so the auto-generated registration table can take the
address of every entry, even those defined in `model_package_api.cc`.
- The Python bindings (`PyModelPackageContext` / `PyModelPackageOptions`
/ `PyModelPackageComponentContext` and their `onnxruntime.__init__`
exports) are removed. Per the design doc we start the experimental API
in C/C++ only.
- `onnxruntime/test/autoep/test_model_package.cc` switches to a local
`ModelPackageFns` struct populated through the
`Ort::Experimental::Get_OrtModelPackageApi_*_Fn(api)` typed accessors.
Consumer usage going forward, in C++:
```cpp
#include "onnxruntime_c_api.h"
#include "onnxruntime_experimental_c_api.h"
const OrtApi* ort = OrtGetApiBase()->GetApi(ORT_API_VERSION);
if (auto* fn = Ort::Experimental::Get_OrtModelPackageApi_CreateModelPackageContext_SinceV28_Fn(ort)) {
OrtModelPackageContext* ctx = nullptr;
Ort::ThrowOnError(fn(ORT_TSTR("/path/to/pkg"), &ctx));
// ...
}
```
### Motivation and Context
The model package API was added to the stable `OrtApi` in 1.27 but has
not shipped in a release yet. Now that #28746 has landed the
experimental C API framework, the right home for an iterating preview
surface like model package is behind `OrtApi::GetExperimentalFunction`,
not on the stable struct.
Moving it to experimental:
- frees us to change signatures (each name is uniquely versioned)
without breaking the stable ABI;
- gives consumers a clear "is this specific thing available?" contract
instead of a struct that *looks* stable but isn't;
- lets the surface be promoted to stable cleanly later (move entries to
`OrtApi`, drop the `_SinceV<N>` suffix, remove the experimental
entries).
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>