onnxruntime
09f2e562 - Force fp32 fallback for CPU-assigned fp16 nodes with no matching kernel (#32197)

Commit
18 days ago
Force fp32 fallback for CPU-assigned fp16 nodes with no matching kernel (#32197) ### Description Level2+ fusion transformers assign a fused node the execution provider of the nodes it replaces without checking that a kernel exists for the fused op. For example, an fp16 Add and an fp16 Gelu both have CPU kernels, but fusing them produces a com.microsoft.BiasGelu node that the CPU EP only implements for float, so session initialization fails when its kernel is looked up. Detect these nodes (IsFp16NodeOnCpuWithoutKernel) and route them through the existing isolated-fp16-node fp32 fallback in InsertCastTransformer, regardless of whether they're otherwise "isolated" or produce a graph output, since running them in fp16 isn't an option to begin with. Track which nodes had their CPU assignment already recorded by the partitioner so the partition-assignment callback isn't fired twice. Also fixes two gaps in the isolated-node check: the no-fp16-input bailout wasn't skipped for these no-kernel nodes (unlike its output-side twin), and the kernel-less check only looked at input types, missing nodes whose fp16-ness is only on the output. ### Motivation and Context Proposed fix for this issue: https://github.com/microsoft/onnxruntime/issues/32186 the unit test tried using "Abs" pretending it has a FP16 kernel, but the new check detects a missing kernel. Replacing with "Round" which actually has FP16 generally preserves the original intent of the check. --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Author
Parents
Loading