Skip to content

Add version check for IAlloactor::GetStats #24989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 17, 2025

Conversation

toothache
Copy link
Member

@toothache toothache commented Jun 9, 2025

Description

Add version check for IAlloactor::GetStats and IAllocatorImplWrappingOrtAllocator::GetStats.

Motivation and Context

The ORT API maintains ABI and backward compatibility, allowing applications built with an older version to run with a newer one. However, when a user calls RegisterAllocator with a custom allocator, any new function pointers introduced in the newer version may contain invalid (garbage) values, as the older application is unaware of them.

To address this, this PR adds version checks in OrtAllocatorImplWrappingIAllocator and IAllocatorImplWrappingOrtAllocator to ensure safe and compatible behavior when interfacing with potentially newer ORT structures.

skottmckay
skottmckay previously approved these changes Jun 9, 2025
skottmckay
skottmckay previously approved these changes Jun 9, 2025
Copy link
Member

@yuslepukhin yuslepukhin left a comment

Choose a reason for hiding this comment

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

:shipit:

@tianleiwu
Copy link
Contributor

tianleiwu commented Jun 13, 2025

/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI, Windows ARM64 QNN CI Pipeline, Windows GPU Doc Gen CI Pipeline, Windows x64 QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

1 similar comment
Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@tianleiwu tianleiwu merged commit 7695233 into microsoft:main Jun 17, 2025
83 checks passed
guschmue pushed a commit that referenced this pull request Jun 17, 2025
### Description
<!-- Describe your changes. -->
Add version check for IAlloactor::GetStats and
IAllocatorImplWrappingOrtAllocator::GetStats.


### 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 ORT API maintains ABI and backward compatibility, allowing
applications built with an older version to run with a newer one.
However, when a user calls RegisterAllocator with a custom allocator,
any new function pointers introduced in the newer version may contain
invalid (garbage) values, as the older application is unaware of them.

To address this, this PR adds version checks in
OrtAllocatorImplWrappingIAllocator and
IAllocatorImplWrappingOrtAllocator to ensure safe and compatible
behavior when interfacing with potentially newer ORT structures.
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.

4 participants