Commit 2c4a0c1
authored
Fix plugin EP test failure when host ORT lacks newer data types (#28659)
### Description
Fix the CUDA plugin EP package test pipeline failure where the plugin is
built with the latest code (which includes `float8e8m0` and 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, `GetTensorDataType` fails 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::TypeConstraint`
methods call `GetTensorType` (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
- Add `TryGetTensorType()` — a non-throwing variant of `GetTensorType()`
that returns `nullptr` when the host ORT does not recognize a tensor
element type.
- Add `TryMLDataTypeToOrtDataType()` — a non-throwing variant of
`MLDataTypeToOrtDataType()` that returns `nullptr` instead of
asserting/throwing.
- Update `KernelDefBuilder::TypeConstraint` (both vector and single-type
overloads) to use the `Try` variants and gracefully skip unsupported
types rather than failing.
### Impact
- Plugins built with newer headers can now load into older host ORT
releases without crashing on unknown data types.
- If all types in a constraint list are unsupported, the constraint is
simply not registered (the kernel will not match, which is the correct
fallback behavior).
- No behavioral change when the host supports all types — the code path
is identical to before.1 parent 30b6528 commit 2c4a0c1
2 files changed
Lines changed: 50 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
31 | 49 | | |
32 | 50 | | |
33 | 51 | | |
| |||
37 | 55 | | |
38 | 56 | | |
39 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
40 | 72 | | |
41 | 73 | | |
42 | 74 | | |
| |||
73 | 105 | | |
74 | 106 | | |
75 | 107 | | |
76 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
77 | 117 | | |
78 | | - | |
79 | 118 | | |
80 | 119 | | |
81 | 120 | | |
82 | 121 | | |
83 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
84 | 128 | | |
85 | 129 | | |
86 | 130 | | |
| |||
134 | 178 | | |
135 | 179 | | |
136 | 180 | | |
137 | | - | |
| 181 | + | |
138 | 182 | | |
139 | 183 | | |
140 | 184 | | |
| 185 | + | |
141 | 186 | | |
142 | 187 | | |
143 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
0 commit comments