Stream: t-compiler/wg-parallel-rustc

Topic: The jobserver-per-rustc patch


Alex Crichton (Jan 14 2020 at 21:19, on Zulip):

Ok I've finally gotten some time to test out @simulacrum's patch here -- https://github.com/rust-lang/rust/pull/67398#issuecomment-571863525

Alex Crichton (Jan 14 2020 at 21:19, on Zulip):

some quick testing shows that it is indeed working in terms of limiting jobs, -j4 on my 28-thread machine indeed only pins 4 cores (ish)

Alex Crichton (Jan 14 2020 at 21:20, on Zulip):

and I don't see extra processes getting spawned or anything like that

Alex Crichton (Jan 14 2020 at 21:20, on Zulip):

I do, however, get that weird panic message I posted on the PR

Alex Crichton (Jan 14 2020 at 21:20, on Zulip):

so something at least is going awry

Alex Crichton (Jan 14 2020 at 21:21, on Zulip):

I'm not sure if it's from cargo or rustc currently

simulacrum (Jan 14 2020 at 21:21, on Zulip):

One thing -- I have been passively thinking about it, and I think it does not really quite work out, in the sense that our protocol is insufficient since we do not have a "oh Cargo I don't actually need the requested token anymore" state.

simulacrum (Jan 14 2020 at 21:22, on Zulip):

The panic might just be from us requesting/freeing tokens during shutdown as the rayon threadpool winds down

Alex Crichton (Jan 14 2020 at 21:23, on Zulip):

hm not sure I follow?

Alex Crichton (Jan 14 2020 at 21:24, on Zulip):

but it does sounds like a situation that'd lend itself ot an edge case pretty quickly

simulacrum (Jan 14 2020 at 21:25, on Zulip):

I'm not sure when rayon will tell us to release tokens, but I could see that happening during thread shutdown

simulacrum (Jan 14 2020 at 21:25, on Zulip):

(may of course be a complete misdiagnosis - I did not see those when testing locally)

Alex Crichton (Jan 14 2020 at 21:27, on Zulip):

FWIW I'm just running cargo check on cargo itself

Alex Crichton (Jan 14 2020 at 21:27, on Zulip):

and intermittently getting panics

simulacrum (Jan 14 2020 at 21:27, on Zulip):

hm, and is that with higher thread counts or whatever?

simulacrum (Jan 14 2020 at 21:27, on Zulip):

(that was my test case as well, IIRC)

Alex Crichton (Jan 14 2020 at 21:27, on Zulip):

I think by default the rustc is -Zthreads=1

Alex Crichton (Jan 14 2020 at 21:27, on Zulip):

so, no

Alex Crichton (Jan 14 2020 at 21:27, on Zulip):

increasing it causes more panics though

simulacrum (Jan 14 2020 at 21:29, on Zulip):

I can try and dig in

simulacrum (Jan 14 2020 at 21:29, on Zulip):

are you just using the try build?

simulacrum (Jan 14 2020 at 21:35, on Zulip):

running cargo +579786e1369ea425f42bd0d97aa4dfabe24ab79b check gives me a fully clean build

simulacrum (Jan 14 2020 at 21:42, on Zulip):

aha I was able to reproduce I think

Alex Crichton (Jan 14 2020 at 21:45, on Zulip):

@simulacrum oh you can't just use the try build, you'll have to download cargo yourself and put it into the right place

Alex Crichton (Jan 14 2020 at 21:45, on Zulip):

to make sure you're using the same build's cargo

simulacrum (Jan 14 2020 at 21:45, on Zulip):

ah, I did -c=cargo for rustup-toolchain-install-master and that seems to have worked

Alex Crichton (Jan 14 2020 at 21:45, on Zulip):

heh that works too

simulacrum (Jan 14 2020 at 21:46, on Zulip):

are you able to reliably reproduce? I've run it multiple times now and only very rarely do I actually see it go wrong

simulacrum (Jan 14 2020 at 22:17, on Zulip):

@Alex Crichton Updated the Cargo branch with a flag which I believe should gate it entirely

Alex Crichton (Jan 14 2020 at 23:11, on Zulip):

@simulacrum nice!

Alex Crichton (Jan 14 2020 at 23:11, on Zulip):

Wanna ping me on the PR and I'll review tmw

simulacrum (Jan 14 2020 at 23:11, on Zulip):

sounds good

simulacrum (Jan 16 2020 at 03:08, on Zulip):

Okay I've refactored Cargo's job queue and I'm increasingly grumpy about jobserver :)

https://github.com/rust-lang/cargo/pull/7731 should be ready for another round of review though I also want to maybe discuss a bit at our sync meeting tomorrow (in particular it is not apparent to me how to nicely structure implicit token sharing)

Last update: Jan 28 2020 at 01:00UTC