Fix plugin EP test failure when host ORT lacks newer data types#28659
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make plugin Execution Providers forward-compatible when built against newer ONNX Runtime headers but loaded into an older host ORT that lacks newly added tensor element types (e.g., float8 variants). It does so by introducing non-throwing type-conversion helpers and changing kernel type-constraint registration to skip types the host does not recognize.
Changes:
- Add
TryGetTensorType()as a non-throwing variant ofGetTensorType()that returnsnullptron failure. - Add
TryMLDataTypeToOrtDataType()as a non-throwing variant ofMLDataTypeToOrtDataType()that returnsnullptrwhen conversion isn’t possible. - Update
KernelDefBuilder::TypeConstraintoverloads to use theTry*helpers and omit unsupported types.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sanaa-hamel-microsoft
approved these changes
May 26, 2026
Contributor
|
Mildly irked by the duplication in |
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
Fix the CUDA plugin EP package test pipeline failure where the plugin is built with the latest code (which includes
float8e8m0and other newer data types), but the host ORT 1.26 release does not support these types. When the plugin attempts to register kernel type constraints containing unsupported types,GetTensorDataTypefails and the plugin load crashes.Motivation and Context
The plugin EP architecture allows plugins to be built against a newer version of the ONNX Runtime headers while being loaded into an older host ORT. However, the existing
KernelDefBuilder::TypeConstraintmethods callGetTensorType(which throws on unsupported types), making it impossible for a forward-compatible plugin to register kernels that include newer data types in their type constraint lists.Changes
TryGetTensorType()— a non-throwing variant ofGetTensorType()that returnsnullptrwhen the host ORT does not recognize a tensor element type.TryMLDataTypeToOrtDataType()— a non-throwing variant ofMLDataTypeToOrtDataType()that returnsnullptrinstead of asserting/throwing.KernelDefBuilder::TypeConstraint(both vector and single-type overloads) to use theTryvariants and gracefully skip unsupported types rather than failing.Impact