Skip to content

Add fastpath1d #571

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add fastpath1d #571

wants to merge 1 commit into from

Conversation

shz0116
Copy link

@shz0116 shz0116 commented Mar 22, 2021

Summary:
Completely rewrite the implementation. Now the the code can reuse the weight data and activation data. Direct performs much better than im2col.

  1. No profiling

    MB, IC, OC, IW, G, KW, stride_w, pad_w, Type, M, N, K, GOPS
    1, 600, 100, 1, 1, 3, 1, 1, FusedIm2Col, 1, 100, 1800, 8.78
    1, 600, 100, 1, 1, 3, 1, 1, direct, 1, 100, 1800, 12.42
    1, 600, 100, 2, 1, 3, 1, 1, FusedIm2Col, 2, 100, 1800, 18.06
    1, 600, 100, 2, 1, 3, 1, 1, direct, 2, 100, 1800, 22.17
    1, 600, 100, 3, 1, 3, 1, 1, FusedIm2Col, 3, 100, 1800, 22.12
    1, 600, 100, 3, 1, 3, 1, 1, direct, 3, 100, 1800, 27.02
    1, 600, 100, 4, 1, 3, 1, 1, FusedIm2Col, 4, 100, 1800, 23.21
    1, 600, 100, 4, 1, 3, 1, 1, direct, 4, 100, 1800, 24.10
    1, 600, 100, 5, 1, 3, 1, 1, FusedIm2Col, 5, 100, 1800, 23.90
    1, 600, 100, 5, 1, 3, 1, 1, direct, 5, 100, 1800, 27.56
    1, 600, 100, 6, 1, 3, 1, 1, FusedIm2Col, 6, 100, 1800, 27.15
    1, 600, 100, 6, 1, 3, 1, 1, direct, 6, 100, 1800, 30.52
    1, 600, 100, 7, 1, 3, 1, 1, FusedIm2Col, 7, 100, 1800, 28.23
    1, 600, 100, 7, 1, 3, 1, 1, direct, 7, 100, 1800, 33.14
    1, 600, 100, 8, 1, 3, 1, 1, FusedIm2Col, 8, 100, 1800, 29.87
    1, 600, 100, 8, 1, 3, 1, 1, direct, 8, 100, 1800, 36.01
    1, 600, 100, 9, 1, 3, 1, 1, FusedIm2Col, 9, 100, 1800, 32.56
    1, 600, 100, 9, 1, 3, 1, 1, direct, 9, 100, 1800, 38.23
    1, 200, 162, 1, 1, 3, 1, 1, FusedIm2Col, 1, 162, 600, 6.32
    1, 200, 162, 1, 1, 3, 1, 1, direct, 1, 162, 600, 9.53
    1, 300, 192, 11, 1, 3, 1, 1, FusedIm2Col, 11, 192, 900, 41.49
    1, 300, 192, 11, 1, 3, 1, 1, direct, 11, 192, 900, 42.65
    1, 256, 162, 23, 1, 3, 1, 1, FusedIm2Col, 23, 162, 768, 47.69
    1, 256, 162, 23, 1, 3, 1, 1, direct, 23, 162, 768, 50.81
    1, 128, 16, 74, 2, 4, 1, 1, FusedIm2Col, 73, 8, 512, 7.92
    1, 128, 16, 74, 2, 4, 1, 1, direct, 73, 8, 512, 13.08
    1, 128, 128, 100, 1, 1, 1, 0, FusedIm2Col, 100, 128, 128, 35.13
    1, 128, 128, 100, 1, 1, 1, 0, direct, 100, 128, 128, 34.44
    1, 160, 55, 34, 1, 3, 1, 1, FusedIm2Col, 34, 55, 480, 25.36
    1, 160, 55, 34, 1, 3, 1, 1, direct, 34, 55, 480, 28.06
    1, 64, 55, 40, 1, 3, 1, 1, FusedIm2Col, 40, 55, 192, 17.51
    1, 64, 55, 40, 1, 3, 1, 1, direct, 40, 55, 192, 22.26

Differential Revision: D22350402

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D22350402

Summary:
Pull Request resolved: pytorch#571

Completely rewrite the implementation. Now the the code can reuse the weight data and activation data. Direct performs much better than im2col.

1. No profiling

    MB, IC, OC, IW, G,  KW, stride_w, pad_w, Type, M, N, K,  GOPS
   1, 600, 100, 1, 1, 3, 1, 1,   FusedIm2Col,      1,    100,   1800, 8.78
   1, 600, 100, 1, 1, 3, 1, 1,        direct,      1,    100,   1800, 12.42
   1, 600, 100, 2, 1, 3, 1, 1,   FusedIm2Col,      2,    100,   1800, 18.06
   1, 600, 100, 2, 1, 3, 1, 1,        direct,      2,    100,   1800, 22.17
   1, 600, 100, 3, 1, 3, 1, 1,   FusedIm2Col,      3,    100,   1800, 22.12
   1, 600, 100, 3, 1, 3, 1, 1,        direct,      3,    100,   1800, 27.02
   1, 600, 100, 4, 1, 3, 1, 1,   FusedIm2Col,      4,    100,   1800, 23.21
   1, 600, 100, 4, 1, 3, 1, 1,        direct,      4,    100,   1800, 24.10
   1, 600, 100, 5, 1, 3, 1, 1,   FusedIm2Col,      5,    100,   1800, 23.90
   1, 600, 100, 5, 1, 3, 1, 1,        direct,      5,    100,   1800, 27.56
   1, 600, 100, 6, 1, 3, 1, 1,   FusedIm2Col,      6,    100,   1800, 27.15
   1, 600, 100, 6, 1, 3, 1, 1,        direct,      6,    100,   1800, 30.52
   1, 600, 100, 7, 1, 3, 1, 1,   FusedIm2Col,      7,    100,   1800, 28.23
   1, 600, 100, 7, 1, 3, 1, 1,        direct,      7,    100,   1800, 33.14
   1, 600, 100, 8, 1, 3, 1, 1,   FusedIm2Col,      8,    100,   1800, 29.87
   1, 600, 100, 8, 1, 3, 1, 1,        direct,      8,    100,   1800, 36.01
   1, 600, 100, 9, 1, 3, 1, 1,   FusedIm2Col,      9,    100,   1800, 32.56
   1, 600, 100, 9, 1, 3, 1, 1,        direct,      9,    100,   1800, 38.23
   1, 200, 162, 1, 1, 3, 1, 1,   FusedIm2Col,      1,    162,    600, 6.32
   1, 200, 162, 1, 1, 3, 1, 1,        direct,      1,    162,    600, 9.53
   1, 300, 192, 11, 1, 3, 1, 1,   FusedIm2Col,     11,    192,    900, 41.49
   1, 300, 192, 11, 1, 3, 1, 1,        direct,     11,    192,    900, 42.65
   1, 256, 162, 23, 1, 3, 1, 1,   FusedIm2Col,     23,    162,    768, 47.69
   1, 256, 162, 23, 1, 3, 1, 1,        direct,     23,    162,    768, 50.81
   1, 128, 16, 74, 2, 4, 1, 1,   FusedIm2Col,     73,      8,    512, 7.92
   1, 128, 16, 74, 2, 4, 1, 1,        direct,     73,      8,    512, 13.08
   1, 128, 128, 100, 1, 1, 1, 0,   FusedIm2Col,    100,    128,    128, 35.13
   1, 128, 128, 100, 1, 1, 1, 0,        direct,    100,    128,    128, 34.44
   1, 160, 55, 34, 1, 3, 1, 1,   FusedIm2Col,     34,     55,    480, 25.36
   1, 160, 55, 34, 1, 3, 1, 1,        direct,     34,     55,    480, 28.06
   1, 64, 55, 40, 1, 3, 1, 1,   FusedIm2Col,     40,     55,    192, 17.51
   1, 64, 55, 40, 1, 3, 1, 1,        direct,     40,     55,    192, 22.26

Differential Revision: D22350402

fbshipit-source-id: 2aabaaf507336e61bf179cc631297dd8c59b6239
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D22350402

@facebook-github-bot
Copy link
Contributor

Hi @shz0116!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

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.

2 participants