Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add map_matmul and fc_act_fuse passes to quant2_int8_mkldnn_pass #38023

Merged

Conversation

sfraczek
Copy link
Contributor

@sfraczek sfraczek commented Dec 9, 2021

PR types

Performance optimization

PR changes

Others

Describe

Fixed mkldnn fc with activation.
Also by adding map_matmul passes, all matmul_v2 ops are converted to either matmul or mul. Afterwards mul+elementiwse_add are fused to fc by fc_fuse_pass.
Adding those 3 map passes fix a problem of crashing introduced by putting matmul_v2_transpose_reshape_fuse_pass in this file. They improve performance. Those passes together with matmul_v2_transpose_reshape fuse pass change accuracy from acc: 0.5478 to 0.5383, but accuracy before this change was higher than reference obtained from tnewst_quant_model.
I also added fc_act_mkldnn_fuse pass which fuses fc+gelu. It improves performance.
Accuracy written in here: #36962 (comment)

@paddle-bot-old
Copy link

paddle-bot-old bot commented Dec 9, 2021

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@sfraczek sfraczek added the Intel label Dec 9, 2021
Copy link
Contributor

@lidanqing-intel lidanqing-intel left a comment

Choose a reason for hiding this comment

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

LGTM.

@sfraczek sfraczek changed the title add map_matmul passes to quant2_int8_mkldnn_pass add map_matmul and fc_act_fuse passes to quant2_int8_mkldnn_pass Dec 10, 2021
wozna
wozna previously approved these changes Dec 10, 2021
Copy link
Contributor

@wozna wozna left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@lidanqing-intel lidanqing-intel left a comment

Choose a reason for hiding this comment

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

LGTM

@sfraczek sfraczek dismissed stale reviews from lidanqing-intel and wozna via 18f7dd9 December 13, 2021 10:00
@lidanqing-intel
Copy link
Contributor

@baoachun @Aganlengzi Could you please merge this PR?

Copy link
Contributor

@Aganlengzi Aganlengzi left a comment

Choose a reason for hiding this comment

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

LGTM

@Aganlengzi Aganlengzi merged commit 8f800dc into PaddlePaddle:develop Dec 14, 2021
@sfraczek sfraczek added the int8 label Dec 21, 2021
Caozhou1995 pushed a commit to Caozhou1995/Paddle that referenced this pull request Dec 29, 2021
…dlePaddle#38023)

* add map_matmul passes to quant2_int8_mkldnn_pass

* fix fc+act fuse (activation scale)

* ci fix, c++17 structured bindings not available

* fix ci static check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants