Skip to content

[CPU] Use MayInPlace kernel def hint for FusedConv kernel - #26422

Merged
Hariharan Seshadri (hariharans29) merged 1 commit into
mainfrom
hari/fused_conv_update
Oct 29, 2025
Merged

[CPU] Use MayInPlace kernel def hint for FusedConv kernel#26422
Hariharan Seshadri (hariharans29) merged 1 commit into
mainfrom
hari/fused_conv_update

Conversation

@hariharans29

@hariharans29 Hariharan Seshadri (hariharans29) commented Oct 28, 2025

Copy link
Copy Markdown
Member

Description

Use MayInPlace hint for the FusedConv NCHW CPU kernel that allows for the allocation planner to re-use the optional "sum" input buffer as the kernel's output buffer. It will potentially save this copy if the buffers can be shared (in most cases the buffers can be shared)

Motivation and Context

The kernel already had logic to save the copy but the kernel def was missing the hint to the allocation planner.

Found while investigating improvements to a Conv model's performance on ARM64

@hariharans29 Hariharan Seshadri (hariharans29) changed the title Use MayInPlace hint for FusedConv kernel [CPU] Use MayInPlace kernel def hint for FusedConv kernel Oct 28, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a memory optimization hint to the CPU FusedConv operator by enabling in-place operation between the optional "sum" input (Z) and the output buffer.

  • Adds .MayInplace(3, 0) hint to the FusedConv kernel definition for the CPU execution provider

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hariharans29
Hariharan Seshadri (hariharans29) merged commit d85627a into main Oct 29, 2025
98 checks passed
@hariharans29
Hariharan Seshadri (hariharans29) deleted the hari/fused_conv_update branch October 29, 2025 01:10
Naomi Ovadia (naomiOvad) pushed a commit to naomiOvad/onnxruntime that referenced this pull request Nov 2, 2025
…26422)

### Description
Use MayInPlace hint for the FusedConv NCHW CPU kernel that allows for
the allocation planner to re-use the optional "sum" input buffer as the
kernel's output buffer. It will potentially save [this
copy](https://github.com/microsoft/onnxruntime/blob/06004826cc99dd8b8b92dbf000db3d3525716f22/onnxruntime/core/providers/cpu/nn/conv.cc#L209)
if the buffers can be shared (in most cases the buffers can be shared)



### Motivation and Context
The kernel already had logic to save the copy but the kernel def was
missing the hint to the allocation planner.

Found while investigating improvements to a Conv model's performance on
ARM64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants