Skip to content

Add OrtModel input support for Compile API#27332

Merged
adrastogi merged 8 commits intomainfrom
adrastogi/edit-compile-support
Feb 25, 2026
Merged

Add OrtModel input support for Compile API#27332
adrastogi merged 8 commits intomainfrom
adrastogi/edit-compile-support

Conversation

@adrastogi
Copy link
Copy Markdown
Contributor

@adrastogi adrastogi commented Feb 12, 2026

Description

This change adds a feature to the Compile API, allowing an in-memory OrtModel created via the Model Editor API to be compiled directly without first serializing to a file or buffer.

Motivation and Context

The Model Editor API and Compile API are both public C APIs in the ONNX Runtime, but until now there was no way to pass a programmatically constructed model directly to compilation. This change attempts to closes that gap (see #26750) and ensures the new code path behaves identically to the established file and buffer paths.

@adrastogi adrastogi marked this pull request as ready for review February 13, 2026 00:22
Comment thread onnxruntime/core/session/model_compilation_options.cc Outdated
Comment thread onnxruntime/core/session/model_compilation_options.cc Outdated
Comment thread onnxruntime/core/session/model_compilation_options.cc Outdated
Comment thread onnxruntime/core/session/utils.cc
Comment thread onnxruntime/test/shared_lib/test_model_builder_api.cc Outdated
Comment thread onnxruntime/test/shared_lib/test_model_builder_api.cc Outdated
Comment thread onnxruntime/test/shared_lib/test_model_builder_api.cc Outdated
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can commit the suggested changes from lintrunner.

Comment thread onnxruntime/test/shared_lib/test_model_builder_api.cc Outdated
@skottmckay
Copy link
Copy Markdown
Contributor

Is the branch sync'd with the latest main? Wondering if a diff with that is causing the RN CI failure.

@adrastogi adrastogi force-pushed the adrastogi/edit-compile-support branch from 0fd3bed to 9c127c9 Compare February 25, 2026 06:53
@adrastogi adrastogi enabled auto-merge (squash) February 25, 2026 15:26
@adrastogi
Copy link
Copy Markdown
Contributor Author

adrastogi commented Feb 25, 2026

Is the branch sync'd with the latest main? Wondering if a diff with that is causing the RN CI failure.

Thanks, that seems to have fixed it. Could you help me get this merged? Seems like I cannot do this directly (not sure if there was a policy change here).

[edit] Oh, looks like a required task was cancelled. Trying to rerun now...

@adrastogi adrastogi merged commit 500ab5f into main Feb 25, 2026
92 of 93 checks passed
@adrastogi adrastogi deleted the adrastogi/edit-compile-support branch February 25, 2026 16:19
adrastogi added a commit that referenced this pull request Apr 15, 2026
### Description
This change adds a feature to the Compile API, allowing an in-memory
OrtModel created via the Model Editor API to be compiled directly
without first serializing to a file or buffer.

### 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. -->
The Model Editor API and Compile API are both public C APIs in the ONNX
Runtime, but until now there was no way to pass a programmatically
constructed model directly to compilation. This change attempts to
closes that gap (see #26750) and ensures the new code path behaves
identically to the established file and buffer paths.

---------

Co-authored-by: Aditya Rastogi <adityar@ntdev.microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
adrastogi added a commit that referenced this pull request Apr 16, 2026
### Description
This change adds a feature to the Compile API, allowing an in-memory
OrtModel created via the Model Editor API to be compiled directly
without first serializing to a file or buffer.

### 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. -->
The Model Editor API and Compile API are both public C APIs in the ONNX
Runtime, but until now there was no way to pass a programmatically
constructed model directly to compilation. This change attempts to
closes that gap (see #26750) and ensures the new code path behaves
identically to the established file and buffer paths.

---------

Co-authored-by: Aditya Rastogi <adityar@ntdev.microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
adrastogi added a commit that referenced this pull request Apr 17, 2026
This cherry-picks the following commits for the release:

- #27332 Add OrtModel input support for Compile API
- #27815 Fix overflow in DmlGraphFusionHelper::ProcessInputData
- #27823 Fix new-delete mismatch in DML EP's QuantizeLinear operator

Also took an isolated change to `base_tester.cc` from
[here](https://github.com/microsoft/onnxruntime/pull/27547/changes#diff-3550c7a1e5e9ae090180942b353ffba5f4652265efd7515d05242084fbcf0343)
to avoid a unit test failure.

---------

Co-authored-by: Aditya Rastogi <adityar@ntdev.microsoft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants