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

[nll] only compute liveness for variables whose types include regions #52034

Closed
nikomatsakis opened this issue Jul 3, 2018 · 4 comments
Closed
Labels
A-NLL Area: Non-lexical lifetimes (NLL) E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. NLL-performant Working towards the "performance is good" goal T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@nikomatsakis
Copy link
Contributor

Looking more at the tuple-stress benchmark, @nnethercote and I were thinking that one way to speed it up -- and possibly others as well! -- would be to tweak the liveness code. Instead of computing the liveness of all variables, for the purposes of NLL we only need to compute the liveness for variables whose types include regions. We could use the same flag mechanism described in #52027 to modify the liveness code and skip those variables whose types do not have any free regions.

To do this, we'd have to modify the liveness code. I imagine something like this:

  • We modify the liveness code so that it is parametric in some new index type. This index type would be Local if you are using all locals, but possibly something else otherwise. It would take some kind of Local -> Option<N> map.
  • In the NLL code, we would walk the locals and make a dense map of those whose types include regions (using the same flags described in [nll] optimize tuple-stress benchmark by skipping visit of types that do not have regions #52027 to quickly test). We would also wind up with two vectors, one IndexVec<Local, Option<RegionLocal>> mapping to the compressed id, and one IndexVec<RegionLocal, Local> mapping back to the original id.
  • The liveness callbacks would be giving us RegionLocal which we would map back.
@nikomatsakis nikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-compiler-nll NLL-performant Working towards the "performance is good" goal labels Jul 3, 2018
@nikomatsakis nikomatsakis added this to the Rust 2018 Preview 2 milestone Jul 3, 2018
@nikomatsakis nikomatsakis added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Jul 3, 2018
@nikomatsakis
Copy link
Contributor Author

There are some loose mentoring instructions here. If you'd like more details, pop in on Zulip and ask me some questions.

@Dylan-DPC-zz
Copy link

@nikomatsakis can do this 👍

@nikomatsakis
Copy link
Contributor Author

@Dylan-DPC awesome! let me know how it goes. I'd call this pretty high priority, since right now tuple-stress stands at a 16000% overhead. =)

@nikomatsakis
Copy link
Contributor Author

BTW if you have any questions please join us on Zulip and ask them in #wg-nll

@nikomatsakis nikomatsakis added the A-NLL Area: Non-lexical lifetimes (NLL) label Jul 17, 2018
bors added a commit that referenced this issue Jul 21, 2018
…matsakis

only compute liveness for variables whose types include regions

Closes #52034

r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. NLL-performant Working towards the "performance is good" goal 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

2 participants