Skip to content

[Performance] Shape operator in a model defined with opset 21 falls back to CPU #26065

Description

@xadupre

Describe the issue

I tried to run an model defined with Opset 21 on CUDA but many node are moved to CPUExecutionProvider.

Image

The reason is onnx defines an new version of Shape in opset 21 but onnxruntime does not and the following condition fails because kernel_start_version != since_ver and kernel_end_version == INT_MAX.

https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/framework/kernel_registry.cc#L126

As a result, many memcpy to/from host are inserted.

To reproduce

Loading a model with defined with opset 21 on CUDA with at least a Shape node.

Urgency

No response

Platform

Windows

OS Version

11

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

main branch

ONNX Runtime API

Python

Architecture

X64

Execution Provider

CUDA

Execution Provider Library Version

CUDA 12.6

Model File

No response

Is this a quantized model?

No

Metadata

Metadata

Assignees

Labels

performanceissues related to performance regressions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions