Skip to content

Conversation

@adrastogi
Copy link
Contributor

Description

This change proposes a new helper ORT API for callers that need to extract the model compatibility string from a precompiled model.

Motivation and Context

See #25749 for more background on the model compatibility concept and infrastructure; #25841 provides a related helper API for an application to call to do a validation check using the compatibility info string. However, there is no direct way to get to the model metadata without creating a session (which some callers may prefer to avoid) or by taking a dependency on a separate library to parse the model's protobuf (which again callers may prefer to avoid).

This change proposes a separate helper API which can be used to retrieve the compatibility info string, thereby avoiding session creation or an external dependency. This does incur some amount of redundant work in that the model protobuf will be parsed again during session creation- but for some callers, this tradeoff may be acceptable.

skottmckay
skottmckay previously approved these changes Jan 15, 2026
Copy link
Contributor

@skottmckay skottmckay left a comment

Choose a reason for hiding this comment

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

:shipit:

@adrastogi adrastogi dismissed stale reviews from adrianlizarraga and skottmckay via 9e640cb January 15, 2026 23:06
Copy link
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.

adrastogi and others added 4 commits January 15, 2026 17:33
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…#27032)

### Description

Android CI failed due to `-Werror,-Wunused-result` treating ignored
return values as errors. Fixed 7 instances in `ep_compatibility_test.cc`
where C API functions marked with `warn_unused_result` were called
without checking their `OrtStatus*` returns:

- 6 calls to `GetAllocatorWithDefaultOptions`
- 1 call to `AllocatorFree`

Changed from:
```cpp
api->GetAllocatorWithDefaultOptions(&allocator);
api->AllocatorFree(allocator, compat_info);
```

To:
```cpp
ASSERT_EQ(api->GetAllocatorWithDefaultOptions(&allocator), nullptr);
ASSERT_EQ(api->AllocatorFree(allocator, compat_info), nullptr);
```

### Motivation and Context

The Android build uses Clang with strict warnings. These C API functions
return `OrtStatus*` to indicate success/failure, and ignoring them
violates the `warn_unused_result` attribute. The fix follows the pattern
used in other test files (e.g., `test_inference.cc`) and improves test
robustness by catching API errors.

<!-- START COPILOT CODING AGENT SUFFIX -->



<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> Fix the failing GitHub Actions workflow Android CI Pipeline
> 
> Analyze the workflow logs, identify the root cause of the failure, and
implement a fix.
> 
> Job ID: 60532176150
> 
> Job URL:
https://github.com/microsoft/onnxruntime/actions/runs/21049485371/job/60532176150


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for
you](https://github.com/microsoft/onnxruntime/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: adrastogi <[email protected]>
# Conflicts:
#	include/onnxruntime/core/session/onnxruntime_cxx_api.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants