Skip to content

Conversation

@AnnaTrainingG
Copy link
Contributor

@AnnaTrainingG AnnaTrainingG commented Aug 24, 2021

PR types

Function optimization

PR changes

OPs

Describe

Modify the reduce OP according to the kernel primitive API
适配kernel primitives api

reduce Any 替换前后性能变化:

axis case old us api us speed up
[2, 3] [16, 2048, 33, 33] 175.75 176.65 0.99
[0, 3] [32, 12, 128, 128] 35.268 35.559 0.99
[1, 3] [16, 32, 32, 32] 4.936 4.287 1.15
[1, 3] [16, 64, 512, 64] 155.58 155.06 1.00
[1, 3] [16, 2048, 32, 32] 172.312 172.162 1.00
[1, 3] [16, 32, 2048, 32] 157.6 157.53 1.00
[0, 2] [16, 2048, 32, 32] 160.95 160.53 1.00
[0, 2] [16, 32, 2048, 32] 159.832 160.614 1.00
[0, 2] [16, 2048, 33, 33] 179.86 178.95 1.01
[0, 2] [16, 33, 2048, 33] 236.8 231.78 1.02

reduceHigher 替换前后性能变化:

  axis case pytorch us paddle_old us api us speed up
0 axis=1 [16, 8, 128] 3.48 1.571 1.577 1.00
1 axis=0 [512    2048] 12.32 11.65 11.662 1.00
2 axis=0 [30522  1024] 160.66 152.68 153.41 1.00
3 axis=0 [32768  1280] 205.95 196.35 197.328 1.00
4 axis=0 [30522  10240] 1414.6 1409.20 1407.32 1.00
5 axis=0 [1024   1280] 8.265 9.37 9.39 1.00
6 axis=0 [30522  10240] 1415.5 1409.22 1407.18 1.00
7 axis=0 [2560   10240] 127.21 126.91 126.672 1.00
8 axis=0 [10240  1280] 77.276 69.44 69.418 1.00
9 axis=0 [32768  2560] 389.59 384.98 386.04 1.00
10 axis=0 [30522  1024] 161.01 152.43 152.966 1.00
11 axis=0 [32768  1280] 207.58 196.70 197.694 0.99
12 axis=0 [1024   1280] 7.949 9.06 9.39 0.97
13 axis=0 [256    12800] 18.259 20.65 21.592 0.96
14 axis=0 [256    10240] 15.742 19.10 20.039 0.95
15 axis=0 [128    1024] 5.535 4.88 5.23 0.93
16 axis=0 [16, 16, 1, 1] 3.117 1.882 2.262 0.83
17 axis=0 [1024   16] 4.656 4.07 5.36 0.76

@paddle-bot-old
Copy link

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

@AnnaTrainingG AnnaTrainingG changed the title Modify the reduce OP according to the kernel primitive API Modify the reduce op according to the kernel primitive API Aug 24, 2021
constexpr int kWarpSize = 32;
#endif

enum ReduceMode { GlobalMode, LocalMode };
Copy link
Contributor

Choose a reason for hiding this comment

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

枚举类型变量命名加k

@AnnaTrainingG
Copy link
Contributor Author

PR 关闭 转到另一个PR上:#35282

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