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

cmd/compile: store combining not complete #54120

Closed
randall77 opened this issue Jul 28, 2022 · 4 comments
Closed

cmd/compile: store combining not complete #54120

randall77 opened this issue Jul 28, 2022 · 4 comments
Assignees
Labels
compiler/runtime NeedsFix Performance
Milestone

Comments

@randall77
Copy link
Contributor

@randall77 randall77 commented Jul 28, 2022

https://go.dev/play/p/1mjcj4Qt_83

The PutUint64 should resolve to a single MOVQ. Instead it resolves to a MOVB/MOVL/MOVW/MOVB sequence.

Split off from #53324

@klauspost @wdvxdr1123

@randall77 randall77 added Performance NeedsFix compiler/runtime labels Jul 28, 2022
@randall77 randall77 added this to the Go1.20 milestone Jul 28, 2022
@agarciamontoro
Copy link
Contributor

@agarciamontoro agarciamontoro commented Jul 29, 2022

I'd like to work on this one, can I take it?

cuiweixie added a commit to cuiweixie/go that referenced this issue Jul 29, 2022
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 29, 2022

Change https://go.dev/cl/420115 mentions this issue: cmd/compile: store combining

cuiweixie added a commit to cuiweixie/go that referenced this issue Jul 30, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Jul 30, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Jul 30, 2022
@cuiweixie
Copy link
Contributor

@cuiweixie cuiweixie commented Jul 31, 2022

@randall77 I first work on rewrite rules. is the code right?

cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 1, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 1, 2022
Fixes golang#54120

compilebench between master and this cl
name                      old time/op       new time/op       delta
Template                        264ms ±13%        271ms ±15%    ~     (p=0.061 n=40+40)
Unicode                         143ms ±22%        144ms ±15%    ~     (p=0.707 n=39+40)
GoTypes                         1.55s ± 6%        1.56s ± 7%    ~     (p=0.090 n=39+38)
Compiler                        112ms ±24%        114ms ±21%    ~     (p=0.435 n=40+38)
SSA                             12.7s ± 4%        12.8s ± 4%  +0.92%  (p=0.021 n=40+39)
Flate                           166ms ±18%        167ms ±10%    ~     (p=0.181 n=39+36)
GoParser                        332ms ±11%        336ms ±12%    ~     (p=0.275 n=40+38)
Reflect                         660ms ±10%        658ms ±10%    ~     (p=0.899 n=39+38)
Tar                             227ms ±13%        229ms ±16%    ~     (p=0.529 n=40+39)
XML                             315ms ±15%        316ms ± 9%    ~     (p=0.664 n=40+39)
LinkCompiler                    489ms ± 9%        497ms ± 8%    ~     (p=0.105 n=40+39)
ExternalLinkCompiler            1.54s ± 4%        1.54s ± 5%    ~     (p=0.567 n=40+38)
LinkWithoutDebugCompiler        309ms ± 9%        314ms ±14%    ~     (p=0.438 n=38+39)
StdCmd                          26.6s ± 3%        26.8s ± 4%  +0.95%  (p=0.015 n=40+37)

name                      old user-time/op  new user-time/op  delta
Template                        323ms ±15%        327ms ±12%    ~     (p=0.298 n=40+39)
Unicode                         172ms ±17%        170ms ±18%    ~     (p=0.677 n=40+40)
GoTypes                         1.98s ± 7%        1.99s ± 6%    ~     (p=0.562 n=40+39)
Compiler                        133ms ±20%        136ms ±19%    ~     (p=0.256 n=39+39)
SSA                             17.1s ± 5%        17.2s ± 6%    ~     (p=0.192 n=39+39)
Flate                           195ms ±17%        200ms ±14%    ~     (p=0.098 n=40+38)
GoParser                        401ms ±11%        407ms ± 9%    ~     (p=0.160 n=40+39)
Reflect                         830ms ±11%        819ms ±12%    ~     (p=0.341 n=40+39)
Tar                             275ms ±10%        276ms ±15%    ~     (p=0.865 n=40+39)
XML                             381ms ±11%        381ms ±10%    ~     (p=0.857 n=40+39)
LinkCompiler                    757ms ± 9%        768ms ± 8%    ~     (p=0.122 n=37+39)
ExternalLinkCompiler            1.66s ± 5%        1.67s ± 6%    ~     (p=0.091 n=39+39)
LinkWithoutDebugCompiler        356ms ± 9%        360ms ±12%    ~     (p=0.475 n=38+39)

name                      old text-bytes    new text-bytes    delta
HelloSize                       764kB ± 0%        763kB ± 0%  -0.11%  (p=0.000 n=40+39)
CmdGoSize                      10.4MB ± 0%       10.4MB ± 0%  -0.06%  (p=0.000 n=40+39)

name                      old data-bytes    new data-bytes    delta
HelloSize                      13.6kB ± 0%       13.6kB ± 0%    ~     (all equal)
CmdGoSize                       305kB ± 0%        305kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       211kB ± 0%        211kB ± 0%    ~     (all equal)
CmdGoSize                       247kB ± 0%        247kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.20MB ± 0%       1.20MB ± 0%  -0.00%  (p=0.000 n=40+39)
CmdGoSize                      15.3MB ± 0%       15.3MB ± 0%  -0.06%  (p=0.000 n=40+39)
[weixiecui@QC_GZ-172_24_21_36-null ~]$ benchstat ~/old.txt ~/new.txt
name                      old time/op       new time/op       delta
Template                        264ms ±13%        271ms ±15%    ~     (p=0.061 n=40+40)
Unicode                         143ms ±22%        144ms ±15%    ~     (p=0.707 n=39+40)
GoTypes                         1.55s ± 6%        1.56s ± 7%    ~     (p=0.090 n=39+38)
Compiler                        112ms ±24%        114ms ±21%    ~     (p=0.435 n=40+38)
SSA                             12.7s ± 4%        12.8s ± 4%  +0.89%  (p=0.025 n=40+40)
Flate                           166ms ±18%        167ms ±10%    ~     (p=0.225 n=39+37)
GoParser                        332ms ±11%        336ms ±12%    ~     (p=0.272 n=40+39)
Reflect                         660ms ±10%        658ms ±10%    ~     (p=1.000 n=39+39)
Tar                             227ms ±13%        227ms ±15%    ~     (p=0.754 n=40+38)
XML                             315ms ±15%        315ms ±10%    ~     (p=0.807 n=40+40)
LinkCompiler                    489ms ± 9%        497ms ± 8%    ~     (p=0.079 n=40+40)
ExternalLinkCompiler            1.54s ± 4%        1.54s ± 5%    ~     (p=0.449 n=40+39)
LinkWithoutDebugCompiler        309ms ± 9%        313ms ±15%    ~     (p=0.515 n=38+40)
StdCmd                          26.6s ± 3%        26.8s ± 4%  +0.88%  (p=0.027 n=40+38)

name                      old user-time/op  new user-time/op  delta
Template                        323ms ±15%        327ms ±12%    ~     (p=0.298 n=40+39)
Unicode                         172ms ±17%        170ms ±18%    ~     (p=0.677 n=40+40)
GoTypes                         1.98s ± 7%        1.99s ± 6%    ~     (p=0.562 n=40+39)
Compiler                        133ms ±20%        136ms ±19%    ~     (p=0.256 n=39+39)
SSA                             17.1s ± 5%        17.2s ± 6%    ~     (p=0.272 n=39+40)
Flate                           195ms ±17%        200ms ±15%    ~     (p=0.152 n=40+39)
GoParser                        401ms ±11%        406ms ± 9%    ~     (p=0.180 n=40+40)
Reflect                         830ms ±11%        819ms ±12%    ~     (p=0.326 n=40+40)
Tar                             275ms ±10%        275ms ±15%    ~     (p=0.996 n=40+39)
XML                             381ms ±11%        380ms ±10%    ~     (p=0.989 n=40+40)
LinkCompiler                    757ms ± 9%        768ms ± 8%    ~     (p=0.090 n=37+40)
ExternalLinkCompiler            1.66s ± 5%        1.67s ± 6%    ~     (p=0.064 n=39+40)
LinkWithoutDebugCompiler        356ms ± 9%        360ms ±12%    ~     (p=0.528 n=38+40)

name                      old text-bytes    new text-bytes    delta
HelloSize                       764kB ± 0%        763kB ± 0%  -0.11%  (p=0.000 n=40+40)
CmdGoSize                      10.4MB ± 0%       10.4MB ± 0%  -0.06%  (p=0.000 n=40+40)

name                      old data-bytes    new data-bytes    delta
HelloSize                      13.6kB ± 0%       13.6kB ± 0%    ~     (all equal)
CmdGoSize                       305kB ± 0%        305kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       211kB ± 0%        211kB ± 0%    ~     (all equal)
CmdGoSize                       247kB ± 0%        247kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.20MB ± 0%       1.20MB ± 0%  -0.00%  (p=0.000 n=40+40)
CmdGoSize                      15.3MB ± 0%       15.3MB ± 0%  -0.06%  (p=0.000 n=40+40)
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 1, 2022
Fixes golang#54120

compilebench between master and this cl
name                      old time/op       new time/op       delta
Template                        264ms ±13%        271ms ±15%    ~     (p=0.061 n=40+40)
Unicode                         143ms ±22%        144ms ±15%    ~     (p=0.707 n=39+40)
GoTypes                         1.55s ± 6%        1.56s ± 7%    ~     (p=0.090 n=39+38)
Compiler                        112ms ±24%        114ms ±21%    ~     (p=0.435 n=40+38)
SSA                             12.7s ± 4%        12.8s ± 4%  +0.89%  (p=0.025 n=40+40)
Flate                           166ms ±18%        167ms ±10%    ~     (p=0.225 n=39+37)
GoParser                        332ms ±11%        336ms ±12%    ~     (p=0.272 n=40+39)
Reflect                         660ms ±10%        658ms ±10%    ~     (p=1.000 n=39+39)
Tar                             227ms ±13%        227ms ±15%    ~     (p=0.754 n=40+38)
XML                             315ms ±15%        315ms ±10%    ~     (p=0.807 n=40+40)
LinkCompiler                    489ms ± 9%        497ms ± 8%    ~     (p=0.079 n=40+40)
ExternalLinkCompiler            1.54s ± 4%        1.54s ± 5%    ~     (p=0.449 n=40+39)
LinkWithoutDebugCompiler        309ms ± 9%        313ms ±15%    ~     (p=0.515 n=38+40)
StdCmd                          26.6s ± 3%        26.8s ± 4%  +0.88%  (p=0.027 n=40+38)

name                      old user-time/op  new user-time/op  delta
Template                        323ms ±15%        327ms ±12%    ~     (p=0.298 n=40+39)
Unicode                         172ms ±17%        170ms ±18%    ~     (p=0.677 n=40+40)
GoTypes                         1.98s ± 7%        1.99s ± 6%    ~     (p=0.562 n=40+39)
Compiler                        133ms ±20%        136ms ±19%    ~     (p=0.256 n=39+39)
SSA                             17.1s ± 5%        17.2s ± 6%    ~     (p=0.272 n=39+40)
Flate                           195ms ±17%        200ms ±15%    ~     (p=0.152 n=40+39)
GoParser                        401ms ±11%        406ms ± 9%    ~     (p=0.180 n=40+40)
Reflect                         830ms ±11%        819ms ±12%    ~     (p=0.326 n=40+40)
Tar                             275ms ±10%        275ms ±15%    ~     (p=0.996 n=40+39)
XML                             381ms ±11%        380ms ±10%    ~     (p=0.989 n=40+40)
LinkCompiler                    757ms ± 9%        768ms ± 8%    ~     (p=0.090 n=37+40)
ExternalLinkCompiler            1.66s ± 5%        1.67s ± 6%    ~     (p=0.064 n=39+40)
LinkWithoutDebugCompiler        356ms ± 9%        360ms ±12%    ~     (p=0.528 n=38+40)

name                      old text-bytes    new text-bytes    delta
HelloSize                       764kB ± 0%        763kB ± 0%  -0.11%  (p=0.000 n=40+40)
CmdGoSize                      10.4MB ± 0%       10.4MB ± 0%  -0.06%  (p=0.000 n=40+40)

name                      old data-bytes    new data-bytes    delta
HelloSize                      13.6kB ± 0%       13.6kB ± 0%    ~     (all equal)
CmdGoSize                       305kB ± 0%        305kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       211kB ± 0%        211kB ± 0%    ~     (all equal)
CmdGoSize                       247kB ± 0%        247kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.20MB ± 0%       1.20MB ± 0%  -0.00%  (p=0.000 n=40+40)
CmdGoSize                      15.3MB ± 0%       15.3MB ± 0%  -0.06%  (p=0.000 n=40+40)
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 1, 2022
Fixes golang#54120

compilebench between master and this cl
name                      old time/op       new time/op       delta
Template                        264ms ±13%        271ms ±15%    ~     (p=0.061 n=40+40)
Unicode                         143ms ±22%        144ms ±15%    ~     (p=0.707 n=39+40)
GoTypes                         1.55s ± 6%        1.56s ± 7%    ~     (p=0.090 n=39+38)
Compiler                        112ms ±24%        114ms ±21%    ~     (p=0.435 n=40+38)
SSA                             12.7s ± 4%        12.8s ± 4%  +0.89%  (p=0.025 n=40+40)
Flate                           166ms ±18%        167ms ±10%    ~     (p=0.225 n=39+37)
GoParser                        332ms ±11%        336ms ±12%    ~     (p=0.272 n=40+39)
Reflect                         660ms ±10%        658ms ±10%    ~     (p=1.000 n=39+39)
Tar                             227ms ±13%        227ms ±15%    ~     (p=0.754 n=40+38)
XML                             315ms ±15%        315ms ±10%    ~     (p=0.807 n=40+40)
LinkCompiler                    489ms ± 9%        497ms ± 8%    ~     (p=0.079 n=40+40)
ExternalLinkCompiler            1.54s ± 4%        1.54s ± 5%    ~     (p=0.449 n=40+39)
LinkWithoutDebugCompiler        309ms ± 9%        313ms ±15%    ~     (p=0.515 n=38+40)
StdCmd                          26.6s ± 3%        26.8s ± 4%  +0.88%  (p=0.027 n=40+38)

name                      old user-time/op  new user-time/op  delta
Template                        323ms ±15%        327ms ±12%    ~     (p=0.298 n=40+39)
Unicode                         172ms ±17%        170ms ±18%    ~     (p=0.677 n=40+40)
GoTypes                         1.98s ± 7%        1.99s ± 6%    ~     (p=0.562 n=40+39)
Compiler                        133ms ±20%        136ms ±19%    ~     (p=0.256 n=39+39)
SSA                             17.1s ± 5%        17.2s ± 6%    ~     (p=0.272 n=39+40)
Flate                           195ms ±17%        200ms ±15%    ~     (p=0.152 n=40+39)
GoParser                        401ms ±11%        406ms ± 9%    ~     (p=0.180 n=40+40)
Reflect                         830ms ±11%        819ms ±12%    ~     (p=0.326 n=40+40)
Tar                             275ms ±10%        275ms ±15%    ~     (p=0.996 n=40+39)
XML                             381ms ±11%        380ms ±10%    ~     (p=0.989 n=40+40)
LinkCompiler                    757ms ± 9%        768ms ± 8%    ~     (p=0.090 n=37+40)
ExternalLinkCompiler            1.66s ± 5%        1.67s ± 6%    ~     (p=0.064 n=39+40)
LinkWithoutDebugCompiler        356ms ± 9%        360ms ±12%    ~     (p=0.528 n=38+40)

name                      old text-bytes    new text-bytes    delta
HelloSize                       764kB ± 0%        763kB ± 0%  -0.11%  (p=0.000 n=40+40)
CmdGoSize                      10.4MB ± 0%       10.4MB ± 0%  -0.06%  (p=0.000 n=40+40)

name                      old data-bytes    new data-bytes    delta
HelloSize                      13.6kB ± 0%       13.6kB ± 0%    ~     (all equal)
CmdGoSize                       305kB ± 0%        305kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       211kB ± 0%        211kB ± 0%    ~     (all equal)
CmdGoSize                       247kB ± 0%        247kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.20MB ± 0%       1.20MB ± 0%  -0.00%  (p=0.000 n=40+40)
CmdGoSize                      15.3MB ± 0%       15.3MB ± 0%  -0.06%  (p=0.000 n=40+40)
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 3, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 3, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 3, 2022
@cuiweixie
Copy link
Contributor

@cuiweixie cuiweixie commented Aug 3, 2022

@randall77 I have merge the two rules to one, how about it?

cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime NeedsFix Performance
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants