Skip to content

Add QLinearConv for activations=u8, weights=s8#5510

Merged
tracysh merged 5 commits into
masterfrom
tracysh/better_qlinearconv
Oct 20, 2020
Merged

Add QLinearConv for activations=u8, weights=s8#5510
tracysh merged 5 commits into
masterfrom
tracysh/better_qlinearconv

Conversation

@tracysh

@tracysh tracysh commented Oct 16, 2020

Copy link
Copy Markdown
Contributor

Description: Add an implementation of QLinearConv for the case of activations=u8 and weights=s8.

Motivation and Context
This implementation reworks QLinearConv to internally do a NCHW->NHWC transpose, then a threaded im2col+GEMM+requantization, then a transpose back to NCHW. All of this ends up being faster than the u8u8 implementation that only partially threaded the convolution and went through a slower im2col path. This u8s8 version also supports per-channel weight quantization to help improve accuracy.

@tracysh
tracysh requested a review from yufenglee October 16, 2020 07:14
@tracysh
tracysh requested a review from a team as a code owner October 16, 2020 07:14
@tracysh

tracysh commented Oct 16, 2020

Copy link
Copy Markdown
Contributor Author

/azp run orttraining-linux-gpu-ci-pipeline

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

auto X_zero_point_value = *(X_zero_point->template Data<uint8_t>());
auto Y_zero_point_value = *(Y_zero_point->template Data<uint8_t>());

const auto& W_zero_point_shape = W_zero_point->Shape();

@yufenglee yufenglee Oct 19, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

W_zero_point_shape [](start = 14, length = 18)

Looks like scale and zero point can be checked in PrePacking.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but this could be addressed later.

@yufenglee yufenglee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@tracysh
tracysh merged commit 45483dc into master Oct 20, 2020
@tracysh
tracysh deleted the tracysh/better_qlinearconv branch October 20, 2020 15:45
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