Skip to content

flatten conv2d when input_width==kernel_width - #1435

Merged
linkerzhang merged 1 commit into
masterfrom
tracysh/nchwc_conv2d_flatten
Jul 19, 2019
Merged

flatten conv2d when input_width==kernel_width#1435
linkerzhang merged 1 commit into
masterfrom
tracysh/nchwc_conv2d_flatten

Conversation

@tracysh

@tracysh tracysh commented Jul 18, 2019

Copy link
Copy Markdown
Contributor

Description:
This change implements a NCHWc optimization for the case input_width==kernel_width. These operations can be flattened to effectively a 1D convolution using striding to allow the NCHWc kernels to better process data.

Motivation and Context
This change addresses a performance bug seen in some internal non-image models using convolution using the above properties. The NCHW MlasConv detected this pattern and converted the convolution to a simple GEMM call. With this fix, models run with the NCHWc optimizer enabled run at the same speed as with "-o 2".

The existing MLAS unit test already covers the new code path for NCHWc thanks to reusing parts of the NCHW tests.

@tracysh
tracysh requested a review from a team as a code owner July 18, 2019 20:27
Comment thread onnxruntime/core/mlas/lib/snchwc.cpp
@tracysh
tracysh requested a review from linkerzhang July 19, 2019 02:04
@linkerzhang
linkerzhang merged commit 07ecd59 into master Jul 19, 2019
@tracysh
tracysh deleted the tracysh/nchwc_conv2d_flatten branch July 19, 2019 02:12
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.

2 participants