Skip to content

Optimizer opset versions out of sync with kernel registrations #27262

@titaiwangms

Description

@titaiwangms

It's been found that the optimizer opset versions are out of sync with the cpu kernel registrations. We usually register cpu kernel to the latest onnx opset version. However, the optimization patterns need to specify the target version, and if it's not updated, the newly registered opset version op won't be able to apply the optimization.

Illustrative example:
The Convolution operator already has a kernel registered for opset-22 but this is not reflected in the optimizer suite. Example: The ConvActivation fusion claims support only till Conv-11.

The cpu_execution_providers has the latest information of opset version:
https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/providers/cpu/cpu_execution_provider.cc

The optimizer folder has many patterns targeting on specific opset version:
https://github.com/microsoft/onnxruntime/tree/main/onnxruntime/core/optimizer

Example of Conv-22:
Con is now on 22 -

class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 22, Conv);

However, it's optimization pattern is still on Conv-11:

registry.RegisterSelectorAndAction(name, {{"Conv", {1, 11}}, {msInternalNHWCDomainConv, {1, 11}}, {msDomainConv, {1}}},

A PR to address this kind of problem:
#11960

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions