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

Potential performance regression from new LTO effort after export changes #71248

Closed
pnkfelix opened this issue Apr 17, 2020 · 6 comments
Closed
Assignees
Labels
A-incr-comp Area: Incremental compilation I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

Spawned off of #71131 (comment)

PR #71131 may have injected a performance regression into incremental compilation. It certainly seemed like it did on the two try runs we did on the PR itself:

So this issue is to track the investigation of that potential regression. (Namely, to evaluation whether a regression truly happened; assuming it did, then what its underlying causes were, and whether any of the significant sources of regression are avoidable.)

@pnkfelix pnkfelix self-assigned this Apr 17, 2020
@pnkfelix pnkfelix added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-slow Issue: Problems and improvements with respect to performance of generated code. I-compiletime Issue: Problems and improvements with respect to compile times. A-incr-comp Area: Incremental compilation and removed I-slow Issue: Problems and improvements with respect to performance of generated code. labels Apr 17, 2020
@pnkfelix
Copy link
Member Author

Interesting: I instrumented the first case I was interested in ("is valid cap letter" on regex, as noted here), and it reports that in all five of the cases where we are now not reusing the Post-LTO build product, it is because the exports_all_green boolean is false; the set comparison test that I was worried about isn't even being run!

I'll have to go back and review the original logic about the all-green flags; I will admit that when I transcribed that part of the code, it was more a blind "well surely this matters" kind of reasoning.

@pnkfelix
Copy link
Member Author

(My intuition is that we do need the exports_all_green computation, and when it is non-green we do need to re-do LTO. After all, the basis of #69798 (comment) was that a global symbol in module A was determined to be unused in module B, and thus the global symbol was demoted to a local to A; then a later change to B injected a use of that global symbol, and so the change to the importing module (B) is significant to the compilation of A.

Another, separate question is whether injecting { } (as the "is valid cap letter" patch does) can be made something that doesn't trigger this code to treat changed module as non-green here...)

@pnkfelix
Copy link
Member Author

(My intuition is that we do need the exports_all_green computation, and when it is non-green we do need to re-do LTO. After all, the basis of #69798 (comment) was that a global symbol in module A was determined to be unused in module B, and thus the global symbol was demoted to a local to A; then a later change to B injected a use of that global symbol, and so the change to the importing module (B) is significant to the compilation of A.

Having said that, I did prototype taking out exports_all_green, and with it gone, the regression test for #69798 still passes...

@pnkfelix
Copy link
Member Author

I suppose if the import map actually reflects the true usage of the symbols in the importing module, then in fact it should not be necessary for us to look at exports_all_green.

I'm willing to have a go with a PR that removes it and see how things go.

pnkfelix added a commit to pnkfelix/rust that referenced this issue Apr 18, 2020
…ll_green` flag.

(My hypothesis is that my use of this flag was an overly conservative
generalization of PR 67020.)
Mark-Simulacrum pushed a commit to Mark-Simulacrum/rust that referenced this issue Apr 20, 2020
…ll_green` flag.

(My hypothesis is that my use of this flag was an overly conservative
generalization of PR 67020.)
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 21, 2020
…s-all-green, r=nagisa

attempt to recover perf by removing `exports_all_green`

attempt to recover perf by removing `exports_all_green` flag.

cc rust-lang#71248

(My hypothesis is that my use of this flag was an overly conservative generalization of PR rust-lang#67020.)
@Mark-Simulacrum
Copy link
Member

@pnkfelix Now that #71267 has landed, I'm going to go ahead and close this but feel free to reopen if you think there's more to track here.

@fenollp
Copy link

fenollp commented May 3, 2020

I've opened #71850 which seems related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants