Stream: t-compiler/major changes

Topic: Eagerly construct bodies of THIR compiler-team#409


triagebot (Feb 22 2021 at 16:10, on Zulip):

A new proposal has been announced: Eagerly construct bodies of THIR #409. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.

nagisa (Feb 22 2021 at 16:15, on Zulip):

could the issue list the exhaustive list of motivations known to us. Right now it says that doing so _might_ allow moving unsafety checking to thir.

oli (Feb 22 2021 at 16:38, on Zulip):

I thought the whole point of THIR was to not create a duplicate version of HIR

Léo Lanteri Thauvin (Feb 22 2021 at 16:39, on Zulip):

I guess in practice the THIR tree gets constructed anyway so MIR can be built from it

Léo Lanteri Thauvin (Feb 22 2021 at 16:40, on Zulip):

nikomatsakis mentioned peak memory usage as the main point of the current lazy construction

Léo Lanteri Thauvin (Feb 22 2021 at 16:40, on Zulip):

I should have written that in

oli (Feb 23 2021 at 10:35, on Zulip):

My initial reaction was "doesn't this actually increase peak memory usage?", because we'd have HIR, THIR and MIR exist fully at the same time, but is what you are saying that we could steal the HIR for THIR and steal the THIR for MIR so each would get dropped asap?

triagebot (Feb 24 2021 at 10:39, on Zulip):

@T-compiler: Proposal #409 has been seconded, and will be approved in 10 days if no objections are raised.

nikomatsakis (Feb 24 2021 at 10:39, on Zulip):

whoops, I should have read comments before seconding :)

nikomatsakis (Feb 24 2021 at 10:40, on Zulip):

@oli I expect it to potentially increase peak memory usage

nikomatsakis (Feb 24 2021 at 10:40, on Zulip):

however

nikomatsakis (Feb 24 2021 at 10:40, on Zulip):

we still only keep the THIR for one function at a time

nikomatsakis (Feb 24 2021 at 10:40, on Zulip):

I think there is a viable alternative

nikomatsakis (Feb 24 2021 at 10:41, on Zulip):

in which, as THIR is constructed, we invoke "callbacks" for things like unsafety check

nikomatsakis (Feb 24 2021 at 10:41, on Zulip):

but I'm not a big fan of this approach

nikomatsakis (Feb 24 2021 at 10:41, on Zulip):

let me edit the MCP a bit to add some details about that

nikomatsakis (Feb 24 2021 at 10:44, on Zulip):

@simulacrum is there a way to "cancel" a rustbot second?

Léo Lanteri Thauvin (Feb 24 2021 at 10:48, on Zulip):

Is peak memory usage measured by "max rss" in rustc-perf?

Léo Lanteri Thauvin (Feb 24 2021 at 10:48, on Zulip):

I'm working on an implementation, so I'll try to make available for a perf run as soon as possible

nikomatsakis (Feb 24 2021 at 10:50, on Zulip):

I added a FAQ to the document

nikomatsakis (Feb 24 2021 at 10:50, on Zulip):

Léo Lanteri Thauvin said:

Is peak memory usage measured by "max rss" in rustc-perf?

yes

nikomatsakis (Feb 24 2021 at 10:50, on Zulip):

Léo Lanteri Thauvin said:

I'm working on an implementation, so I'll try to make available for a perf run as soon as possible

even better!

nikomatsakis (Feb 24 2021 at 10:50, on Zulip):

let me add that to the FAQ

nikomatsakis (Feb 24 2021 at 10:50, on Zulip):

also, I think that FAQ should just be a standard section for MCPs, that was fun to write

tm (Feb 24 2021 at 10:50, on Zulip):

Is a peak memory usage a concern for THIR? I would expect it to be negligible compared to memory usage of data flow analysis running on MIR.

nikomatsakis (Feb 24 2021 at 10:51, on Zulip):

I am not convinced it's going to be relevant

nikomatsakis (Feb 24 2021 at 10:51, on Zulip):

It is an unknown

nikomatsakis (Feb 24 2021 at 11:13, on Zulip):

Let's move detailed discussion to #project-thir-unsafeck > eager THIR construction

nikomatsakis (Feb 24 2021 at 11:13, on Zulip):

it'll be easier for me :)

nikomatsakis (Feb 24 2021 at 11:13, on Zulip):

(that is, detailed discussion around the prototype and measurement, we can bring the results back to this topic for those who don't care to follow the grungy details)

oli (Feb 24 2021 at 11:18, on Zulip):

Yea, I just wanted to bring up the discussion, I'm not too worried, especially since we have several paths forward here for improvements in the future.

If the THIR is consumed while being converted to MIR we may not even have an increase in peak memory usage at all as things are freed right when being converted to MIR

triagebot (Feb 24 2021 at 11:20, on Zulip):

@T-compiler: Proposal #409 has been seconded, and will be approved in 10 days if no objections are raised.

simulacrum (Feb 24 2021 at 11:57, on Zulip):

@nikomatsakis you can just remove the label I think, we don't track in DB IIRC?

Léo Lanteri Thauvin (Feb 24 2021 at 11:58, on Zulip):

MCPs are accepted manually

triagebot (Mar 07 2021 at 14:06, on Zulip):

This proposal has been accepted: #409.

Last update: May 07 2021 at 07:30UTC