fix: support Float16/BFloat16/Float8 in TensorArray custom op#28335
Open
Rishi-Dave wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: support Float16/BFloat16/Float8 in TensorArray custom op#28335Rishi-Dave wants to merge 1 commit intomicrosoft:mainfrom
Rishi-Dave wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The TensorArray (Variadic) constructor's switch in onnxruntime_lite_custom_op.h was missing case arms for Float16, BFloat16, and the four Float8 variants, so any custom op accepting const Ort::Custom::TensorArray& with those input types threw "unknown input type" at construction. Add the six missing case arms, mirroring the type-name parity already established in CREATE_TUPLE and PARSE_ARGS within the same header. Fixes microsoft#23373
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
The
Ort::Custom::TensorArray(aliasVariadic) constructor ininclude/onnxruntime/core/session/onnxruntime_lite_custom_op.hwas missingcasearms forFloat16,BFloat16, and the fourFloat8*variants. Any custom op acceptingconst Ort::Custom::TensorArray&with one of those input types fell through to thedefault:arm and threw"unknown input type"at construction.This PR adds the six missing
casearms so the constructor handles every floating-point variant the rest of the file already supports. The new arms mirror the type-name parity already established inCREATE_TUPLE(around lines 619-637) andPARSE_ARGS(around lines 744-762) within the same header — sameOrt::Float16_t/Ort::BFloat16_t/Ort::Float8E4M3FN_t/Ort::Float8E4M3FNUZ_t/Ort::Float8E5M2_t/Ort::Float8E5M2FNUZ_ttemplate arguments.The change is purely additive: 18 lines, header-only, no API/ABI impact, no behavior change for any previously-supported type.
Motivation and Context
Fixes #23373.
Custom ops authored against the Lite Custom Op API and declared with a
const Ort::Custom::TensorArray¶meter currently cannot accept fp16, bf16, or fp8 inputs even thoughCustom::Tensor<Ort::Float16_t>etc. are first-class everywhere else in the API. This blocks half-precision and 8-bit-float variadic custom op authors on CPU EP and any EP that dispatches via the lite API.