-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
RFC: -j/--jobs for zig subcommands #12101
Copy link
Copy link
Open
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
Reason: bazel-zig-cc invokes zig cc. Bazel takes care of parallelism itself, so it will assume zig is a "simple" command that uses a single core. It is not, however.
On many-core machines this leads to many parallel processes using many cores. Thus we should use zig cc -j1 (or equivalent) in bazel-zig-cc. Otherwise the number of jobs multiples quickly. (Unfortunately, Bazel neither supports jobserver nor can limit the number of downstream cores via cgroups or similar.)
I have almost implemented -jN, --jobs=N like this:
ThreadPool.init()accepts a new argumentjobs: ?usize- If
jobsis set, uses that variable forthread_count, otherwise the behavior is as before.
And interesting questions ensued:
- Is
-jN, --jobs=Na reasonable argument to add tozig cc,zig build-*et al? - This would be the first option that clang does not accept (technically, not in
clang/include/clang/Driver/Options.td). Is this OK as a precedent to havezig ccoptions that are not validclangoptions? I can also do this go-style viaZIGMAXPROCS. :)
EDIT: removed a long question about two thread pools in src/test.zig, that was somewhat answered in a commit message where they were introduced.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.