Add API GetTensorElementTypeAndShapeDataReference#27175
Merged
adrianlizarraga merged 7 commits intomainfrom Jan 28, 2026
Merged
Add API GetTensorElementTypeAndShapeDataReference#27175adrianlizarraga merged 7 commits intomainfrom
adrianlizarraga merged 7 commits intomainfrom
Conversation
fs-eire
reviewed
Jan 28, 2026
adrianlizarraga
commented
Jan 28, 2026
edgchen1
reviewed
Jan 28, 2026
edgchen1
previously approved these changes
Jan 28, 2026
edgchen1
reviewed
Jan 28, 2026
fs-eire
reviewed
Jan 28, 2026
edgchen1
reviewed
Jan 28, 2026
edgchen1
approved these changes
Jan 28, 2026
fs-eire
approved these changes
Jan 28, 2026
tianleiwu
pushed a commit
that referenced
this pull request
Jan 29, 2026
Adds C/C++ API named `GetTensorElementTypeAndShapeDataReference` that returns an OrtValue tensor's shape and type without allocating a new buffer for the shape data. This new API function can be used instead of `OrtApi::GetTypeInfo()` or `OrtApi::GetTensorTypeAndShape` to decrease the number of heap allocations and thus improve inference latency for plugin EPs kernels that frequently retrieve tensor shapes during inference. (e.g., WebGPU plugin EP)
tianleiwu
added a commit
that referenced
this pull request
Jan 29, 2026
| Commit | Commit Title | Author | | :--- | :--- | :--- | | `6861526` | [MLAS] Fix Data Race in MlasLutGemm by Serializing LUT Generation (#27179) | tianleiwu | | `592bcb4` | remove coloredlogs (#27135) | tianleiwu | | `0f153de` | Add API GetTensorElementTypeAndShapeDataReference (#27175) | adrianlizarraga | | `1caa3e6` | [MLAS] Fix Flaky LuT GEMM Tests by Replacing Gather with Shuffle (#27174) | tianleiwu | --------- Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
milpuz01
pushed a commit
to milpuz01/onnxruntime
that referenced
this pull request
Feb 4, 2026
### Description Adds C/C++ API named `GetTensorElementTypeAndShapeDataReference` that returns an OrtValue tensor's shape and type without allocating a new buffer for the shape data. ### Motivation and Context This new API function can be used instead of `OrtApi::GetTypeInfo()` or `OrtApi::GetTensorTypeAndShape` to decrease the number of heap allocations and thus improve inference latency for plugin EPs kernels that frequently retrieve tensor shapes during inference. (e.g., WebGPU plugin EP)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds C/C++ API named
GetTensorElementTypeAndShapeDataReferencethat returns an OrtValue tensor's shape and type without allocating a new buffer for the shape data.Motivation and Context
This new API function can be used instead of
OrtApi::GetTypeInfo()orOrtApi::GetTensorTypeAndShapeto decrease the number of heap allocations and thus improve inference latency for plugin EPs kernels that frequently retrieve tensor shapes during inference. (e.g., WebGPU plugin EP)