Stream: t-compiler/wg-pipelining

Topic: More aggressive pipelining


nnethercote (Sep 03 2019 at 00:12, on Zulip):

I tried making pipelining more aggressive, by moving metadata generation from after analysis (typeck, borrowck, etc.) to before analysis. This increases the amount of overlap possible. It's basically working (only 3 tests fail in the entire rustc test suite, not sure why yet), but the performance results are disappointing: https://paste.mozilla.org/0qBZWYjv

nnethercote (Sep 03 2019 at 00:14, on Zulip):

That shows the effect of the existing pipelining, which has some big speedups like 1.79x, 1.39x, 1.38x, 1.17x.

nnethercote (Sep 03 2019 at 00:15, on Zulip):

It also shows the effect of the more aggressive pipelining, which has much smaller speedups like 1.06x, 1.04x, 1.02x (and the 1.02x is probably indistinguishable from noise)

nnethercote (Sep 03 2019 at 00:15, on Zulip):

I guess in hindsight it's not that surprising; code generation takes a lot longer than analysis

nnethercote (Sep 03 2019 at 00:18, on Zulip):

Also, the more aggressive pipelining slows down some workflows slightly -- the production of type/borrow/other errors is slightly delayed by metadata generation. And that's a common workflow -- think about when you're repeatedly compiling code when working through errors.

nnethercote (Sep 03 2019 at 00:19, on Zulip):

So I think it's probably not worthwhile pursuing further, overall.

Zoxc (Sep 03 2019 at 00:27, on Zulip):

Did you measure how much time was spent doing analysis after metadata generation? I'd expect metadata generation to basically trigger all of it.

nnethercote (Sep 03 2019 at 02:03, on Zulip):

I rearranged things so that metadata generation finished before analysis started. This was non-trivial, given the way the passes are arranged.

nnethercote (Sep 03 2019 at 04:06, on Zulip):

I have filed #64112 so others can see the code and results.

nnethercote (Sep 03 2019 at 22:25, on Zulip):

@Alex Crichton ^^^ (in case you haven't already seen it)

Alex Crichton (Sep 04 2019 at 14:37, on Zulip):

Hm interesting! It may also be the case that the meteadata generation ends up needing all of the analysis anyway, so moving it back may not actually skip any stages of compilation before it's generated

Alex Crichton (Sep 04 2019 at 14:39, on Zulip):

@nnethercote it may be worth looking into optimizing metadata at some point

Alex Crichton (Sep 04 2019 at 14:39, on Zulip):

IIRC it's pretty quick but still like megabyte big for a kilobyte crate

Alex Crichton (Sep 04 2019 at 14:39, on Zulip):

so we're probably taking too long to emit it and/or storing way too much in there in one form or another

Taylor Cramer (Sep 04 2019 at 16:33, on Zulip):

+1 this would also help with distributed builds-- sending metadata elsewhere is slow today

Zoxc (Sep 04 2019 at 17:24, on Zulip):

Just FYI, I'd like to remove metadata and just rely on stored queries instead. We currently store a lot of information in both metadata and the query cache, which is not very efficient.

nnethercote (Sep 04 2019 at 20:33, on Zulip):

@Alex Crichton I used debugging println statements to verify that metadata generation completes before analysis. It's possible I'm missing some subtlety, but the basic contours seem correct, and the results suggest that things really have changed to some degree.

nnethercote (Sep 04 2019 at 20:33, on Zulip):

@Alex Crichton What are the filenames for metadata? .rmeta?

Alex Crichton (Sep 04 2019 at 20:40, on Zulip):

@nnethercote yeah *.rmeta

Alex Crichton (Sep 04 2019 at 20:40, on Zulip):

and rustc has tons of caches internally

Alex Crichton (Sep 04 2019 at 20:40, on Zulip):

so the time previously spent in analysis may just be shifted to metadata generation now

Alex Crichton (Sep 04 2019 at 20:40, on Zulip):

(maybe)

Alex Crichton (Sep 04 2019 at 20:41, on Zulip):

and the analysis phase, which happens later, just hits all the caches and doesn't actually do anything

nnethercote (Sep 04 2019 at 20:41, on Zulip):

right, that's the subtleties/contours I was referring to

Alex Crichton (Sep 04 2019 at 20:41, on Zulip):

just random guess as to why it may not help much

nnethercote (Sep 04 2019 at 20:41, on Zulip):

codegen does take like 10x longer than analysis

Alex Crichton (Sep 04 2019 at 20:41, on Zulip):

heh that too!

Last update: Nov 15 2019 at 10:20UTC