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

Optimize SWAP #527

Merged
merged 1 commit into from
Nov 25, 2022
Merged

Optimize SWAP #527

merged 1 commit into from
Nov 25, 2022

Conversation

chfast
Copy link
Member

@chfast chfast commented Nov 22, 2022

Clang compiler generates suboptimal code if the temporary struct is used in SWAP implementation. Workaround it by using 4x uint64_t temporaries.

llvm/llvm-project#59116

@chfast
Copy link
Member Author

chfast commented Nov 22, 2022

baseline/execute/main/blake2b_huff/empty_mean                         -0.0233         -0.0233            10            10            10            10
bnocgoto/execute/main/blake2b_huff/empty_mean                         -0.0003         -0.0003            11            11            11            11
baseline/execute/main/blake2b_huff/2805nulls_mean                     -0.0260         -0.0260           223           218           223           218
bnocgoto/execute/main/blake2b_huff/2805nulls_mean                     +0.0072         +0.0072           245           247           245           247
baseline/execute/main/blake2b_huff/5610nulls_mean                     -0.0239         -0.0239           436           425           436           425
bnocgoto/execute/main/blake2b_huff/5610nulls_mean                     +0.0057         +0.0057           480           482           480           482
baseline/execute/main/blake2b_huff/8415nulls_mean                     -0.0228         -0.0228           638           623           638           623
bnocgoto/execute/main/blake2b_huff/8415nulls_mean                     +0.0083         +0.0083           703           709           703           709
baseline/execute/main/blake2b_huff/65536nulls_mean                    -0.0216         -0.0216          4955          4848          4955          4848
bnocgoto/execute/main/blake2b_huff/65536nulls_mean                    +0.0063         +0.0063          5459          5494          5459          5494
baseline/execute/main/blake2b_shifts/2805nulls_mean                   -0.0502         -0.0502          2110          2004          2110          2004
bnocgoto/execute/main/blake2b_shifts/2805nulls_mean                   -0.0316         -0.0316          2438          2361          2438          2361
baseline/execute/main/blake2b_shifts/5610nulls_mean                   -0.0484         -0.0484          4195          3992          4195          3992
bnocgoto/execute/main/blake2b_shifts/5610nulls_mean                   -0.0330         -0.0330          4864          4704          4864          4704
baseline/execute/main/blake2b_shifts/8415nulls_mean                   -0.0464         -0.0464          6272          5981          6272          5981
bnocgoto/execute/main/blake2b_shifts/8415nulls_mean                   -0.0323         -0.0323          7285          7050          7285          7050
baseline/execute/main/blake2b_shifts/65536nulls_mean                  -0.0457         -0.0457         48664         46438         48663         46438
bnocgoto/execute/main/blake2b_shifts/65536nulls_mean                  -0.0326         -0.0326         56455         54615         56456         54615
baseline/execute/main/sha1_divs/empty_mean                            -0.0288         -0.0288            45            44            45            44
bnocgoto/execute/main/sha1_divs/empty_mean                            -0.0217         -0.0217            47            46            47            46
baseline/execute/main/sha1_divs/1351_mean                             -0.0295         -0.0295           946           918           946           918
bnocgoto/execute/main/sha1_divs/1351_mean                             -0.0234         -0.0234           987           964           987           964
baseline/execute/main/sha1_divs/2737_mean                             -0.0345         -0.0345          1851          1787          1851          1787
bnocgoto/execute/main/sha1_divs/2737_mean                             -0.0221         -0.0221          1924          1881          1924          1881
baseline/execute/main/sha1_divs/5311_mean                             -0.0314         -0.0314          3608          3495          3608          3495
bnocgoto/execute/main/sha1_divs/5311_mean                             -0.0230         -0.0230          3758          3672          3758          3672
baseline/execute/main/sha1_divs/65536_mean                            -0.0309         -0.0309         43991         42634         43992         42634
bnocgoto/execute/main/sha1_divs/65536_mean                            -0.0241         -0.0241         45797         44695         45797         44695
baseline/execute/main/sha1_shifts/empty_mean                          -0.0553         -0.0552            24            23            24            23
bnocgoto/execute/main/sha1_shifts/empty_mean                          +0.0045         +0.0045            26            26            26            26
baseline/execute/main/sha1_shifts/1351_mean                           -0.0533         -0.0533           522           494           522           494
bnocgoto/execute/main/sha1_shifts/1351_mean                           -0.0027         -0.0027           554           552           554           552
baseline/execute/main/sha1_shifts/2737_mean                           -0.0507         -0.0507          1018           966          1018           966
bnocgoto/execute/main/sha1_shifts/2737_mean                           +0.0013         +0.0013          1081          1082          1081          1082
baseline/execute/main/sha1_shifts/5311_mean                           -0.0508         -0.0508          1987          1886          1987          1886
bnocgoto/execute/main/sha1_shifts/5311_mean                           +0.0029         +0.0029          2110          2116          2110          2116
baseline/execute/main/sha1_shifts/65536_mean                          -0.0533         -0.0533         24279         22985         24279         22985
bnocgoto/execute/main/sha1_shifts/65536_mean                          +0.0072         +0.0072         25781         25966         25782         25966
baseline/execute/main/weierstrudel/0_mean                             +0.0044         +0.0044           145           146           145           146
bnocgoto/execute/main/weierstrudel/0_mean                             -0.0027         -0.0027           147           147           147           147
baseline/execute/main/weierstrudel/1_mean                             -0.0021         -0.0021           314           313           314           313
bnocgoto/execute/main/weierstrudel/1_mean                             -0.0110         -0.0110           322           319           322           319
baseline/execute/main/weierstrudel/3_mean                             -0.0020         -0.0020           490           489           490           489
bnocgoto/execute/main/weierstrudel/3_mean                             -0.0204         -0.0204           508           498           508           498
baseline/execute/main/weierstrudel/9_mean                             -0.0054         -0.0054          1017          1012          1017          1012
bnocgoto/execute/main/weierstrudel/9_mean                             -0.0157         -0.0157          1048          1032          1048          1032
baseline/execute/main/weierstrudel/14_mean                            -0.0092         -0.0092          1461          1448          1461          1448
bnocgoto/execute/main/weierstrudel/14_mean                            -0.0125         -0.0125          1498          1479          1498          1479
OVERALL_GEOMEAN                                                       -0.0212         -0.0212             0             0             0             0

@codecov
Copy link

codecov bot commented Nov 22, 2022

Codecov Report

Merging #527 (2432ec1) into master (69dff27) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #527      +/-   ##
==========================================
+ Coverage   97.99%   98.03%   +0.03%     
==========================================
  Files          59       59              
  Lines        5677     5687      +10     
==========================================
+ Hits         5563     5575      +12     
+ Misses        114      112       -2     
Flag Coverage Δ
blockchaintests 77.97% <100.00%> (+0.18%) ⬆️
statetests 72.68% <100.00%> (+0.14%) ⬆️
unittests 91.71% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/evmone/instructions.hpp 100.00% <100.00%> (+0.21%) ⬆️
lib/evmone/advanced_analysis.hpp 100.00% <0.00%> (+2.94%) ⬆️

Copy link
Collaborator

@rakita rakita left a comment

Choose a reason for hiding this comment

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

Magic! what else to say

Clang compiler generates suboptimal code if the temporary struct is used
in SWAP implementation. Workaround it by using 4x uint64_t temporaries.

llvm/llvm-project#59116
@chfast chfast merged commit 19fc038 into master Nov 25, 2022
@chfast chfast deleted the instr_swap branch November 25, 2022 09:48
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.

4 participants