When -N doesn't equal -j, TH continually calls setNumCapabilities
While investigating #22960, I attempted to call GHC with -j > -N.
-j controls how many modules may be compiled concurrently, while
-N controls the amount of capabilities. Normally these are the same number, since if you don't explicitly set
-N, the make driver code will set it to be the same as
Strangely, the eventlog showed that capabilities would occasionally be created and destroyed.
I found that the only other call to
setNumCapabilities is in
It looks like
createBCO has a slightly different copy of the capability logic found in the driver. Unlike the driver code it also changes the capability count even if
-N has been manually set.
createBCO is called while evaluating TH, so that explains the behaviour I was seeing.
A fix would be to harmonise the logic with what we have in the driver, but I'm confused why this code is calling
setNumCapabilities at all.
setNumCapabilities seems a bit heavy-weight to call in a function like this.
I think the
setNumCapabilities logic should be removed from
createBCO altogether. According to
git blame it was introduced to speed up remote TH. So, maybe it needs to be moved somewhere else on the remote TH side.
I'd be happy to make an MR