Skip to content

Performance regression in GridSample operator between v1.22.0 and v1.23.0[Performance] #27155

@junghyunpark2001

Description

@junghyunpark2001

Describe the issue

Description

We observed a performance regression in the GridSample operator across all configurations between ONNXRuntime v1.22.0 and v1.23.0. This regression affects all interpolation modes and padding modes, with linear interpolation showing higher regression than nearest neighbor.

Affected Operator

GridSample

  • Opset Version: 21, 22
  • All Modes: linear, nearest (both affected)
  • All Padding Modes: zeros, reflection (both affected)
  • Regression: +7% to +15% kernel slowdown

Test Case Details

Test Case 1: gridsample_22_v2_gridsample_linear_zeros_align_corners_0_float32

Inputs:

  • input_0 tensor (image):

    • Data type: float32
    • Shape: [2, 3, 32, 32]
  • input_1 tensor (grid):

    • Data type: float32
    • Shape: [2, 32, 32, 2]

Attributes:

  • mode: linear
  • padding_mode: zeros
  • align_corners: 0

Performance:

  • v1.22.0: 0.315 ms (kernel time)
  • v1.23.0: 0.348 ms (kernel time)
  • Kernel regression: +10.4% slowdown
  • Total time regression: +8.9% slowdown

Test Case 2: gridsample_22_v2_gridsample_linear_zeros_align_corners_1_float32

Inputs:

  • input_0 tensor (image):

    • Data type: float32
    • Shape: [2, 3, 56, 56]
  • input_1 tensor (grid):

    • Data type: float32
    • Shape: [2, 64, 64, 2]

Attributes:

  • mode: linear
  • padding_mode: zeros
  • align_corners: 1

Performance:

  • v1.22.0: 1.189 ms (kernel time)
  • v1.23.0: 1.369 ms (kernel time)
  • Kernel regression: +15.1% slowdown
  • Total time regression: +13.5% slowdown

Test Case 3: gridsample_gridsample_21_gridsample_nearest_reflection_float32

Inputs:

  • X tensor (image):

    • Data type: float32
    • Shape: [1, 3, 64, 64]
  • grid tensor:

    • Data type: float32
    • Shape: [1, 128, 128, 2]

Attributes:

  • mode: nearest
  • padding_mode: reflection
  • align_corners: 1

Performance:

  • v1.22.0: 5.902 ms (kernel time)
  • v1.23.0: 6.323 ms (kernel time)
  • Kernel regression: +7.1% slowdown
  • Total time regression: +7.4% slowdown

Test Case 4: gridsample_gridsample_21_gridsample_basic_linear_zeros_float32

Performance:

  • v1.22.0: 4.847 ms (kernel time)
  • v1.23.0: 5.383 ms (kernel time)
  • Kernel regression: +11.0% slowdown

Test Case 5: gridsample_22_v3_test_gridsample_2d_linear_zeros_float32

Performance:

  • v1.22.0: 0.315 ms (kernel time)
  • v1.23.0: 0.345 ms (kernel time)
  • Kernel regression: +9.7% slowdown

Test Case 6: gridsample_22_v3_test_gridsample_2d_linear_zeros_float32_batch1

Performance:

  • v1.22.0: 0.359 ms (kernel time)
  • v1.23.0: 0.392 ms (kernel time)
  • Kernel regression: +9.3% slowdown

To reproduce

  1. Download zip file
  2. Run benchmark using the provided script:
    python script_profiling.py gridsample_22_v2_gridsample_linear_zeros_align_corners_1_float32 1.22.0 1.23.0

Archive.zip

Urgency

No response

Platform

Linux

OS Version

Ubuntu 24.04.3 LTS

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.23

ONNX Runtime API

Python

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

Model File

No response

Is this a quantized model?

Yes

Metadata

Metadata

Assignees

No one assigned

    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