Skip to content

Extend OrtAllocator API to get Allocator statistics #24785

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 31 commits into from
Jun 4, 2025

Conversation

toothache
Copy link
Member

@toothache toothache commented May 16, 2025

Description

Extend IAllocator to get Allocator statistics:

  • Add OrtAllocator::GetStats and AllocatorGetStats C-API.
  • Add Ort::Allocator::GetStats Cxx API to parse the string and return as map.
  • Add UT.

Motivation and Context

Our system integrates multiple models for inference, each with varying memory demands. Providing a mechanism to retrieve detailed memory statistics would be useful for analyzing memory usage across models and devices more effectively.

@toothache toothache changed the title Extend IAllocator API to get Allocator statistics Extend OrtAllocator API to get Allocator statistics May 16, 2025
@hanbitmyths hanbitmyths requested a review from yuslepukhin May 16, 2025 05:05
@yuslepukhin
Copy link
Member

I will take a look at it on Monday

@toothache toothache marked this pull request as ready for review May 20, 2025 01:47
@tianleiwu
Copy link
Contributor

/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).

@yuslepukhin
Copy link
Member

/azp run Windows ARM64 QNN CI Pipeline,Windows x64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,ONNX Runtime Web CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline

@yuslepukhin
Copy link
Member

/azp run Linux QNN CI Pipeline,onnxruntime-binary-size-checks-ci-pipeline,Big Models,Linux Android Emulator QNN CI Pipeline,Android CI Pipeline,iOS CI Pipeline,ONNX Runtime React Native CI Pipeline,Linux DNNL CI Pipeline,Linux MIGraphX CI Pipeline,Linux ROCm CI Pipeline

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

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:

@toothache
Copy link
Member Author

@yuslepukhin @skottmckay can anyone help complete the PR? Thanks!

@tianleiwu
Copy link
Contributor

/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).

@tianleiwu tianleiwu merged commit c7fdb54 into microsoft:main Jun 4, 2025
97 of 99 checks passed
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.

5 participants