-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
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.optimization
Milestone
Description
Currently, the only parallelization the main pipeline does is AstGen jobs and C compilation jobs:
Lines 1913 to 1945 in 8a6de78
| // Here we queue up all the AstGen tasks first, followed by C object compilation. | |
| // We wait until the AstGen tasks are all completed before proceeding to the | |
| // (at least for now) single-threaded main work queue. However, C object compilation | |
| // only needs to be finished by the end of this function. | |
| var zir_prog_node = main_progress_node.start("AstGen", self.astgen_work_queue.count); | |
| defer zir_prog_node.end(); | |
| var c_obj_prog_node = main_progress_node.start("Compile C Objects", self.c_source_files.len); | |
| defer c_obj_prog_node.end(); | |
| self.work_queue_wait_group.reset(); | |
| defer self.work_queue_wait_group.wait(); | |
| { | |
| self.astgen_wait_group.reset(); | |
| defer self.astgen_wait_group.wait(); | |
| while (self.astgen_work_queue.readItem()) |file| { | |
| self.astgen_wait_group.start(); | |
| try self.thread_pool.spawn(workerAstGenFile, .{ | |
| self, file, &zir_prog_node, &self.astgen_wait_group, | |
| }); | |
| } | |
| while (self.c_object_work_queue.readItem()) |c_object| { | |
| assert(@ptrToInt(c_object) != 0xaaaa_aaaa_aaaa_aaaa); | |
| self.work_queue_wait_group.start(); | |
| try self.thread_pool.spawn(workerUpdateCObject, .{ | |
| self, c_object, &c_obj_prog_node, &self.work_queue_wait_group, | |
| }); | |
| } | |
| } |
If you scroll down and look at the rest of the queue handling, you can see that, among others, the following tasks are done serially:
C/C++ library compilation tasks
- glibc_crt_file
- glibc_shared_objects
- musl_crt_file
- mingw_crt_file
- windows_import_lib
- libunwind
- libcxx
- libcxxabi
- libtsan
- wasi_libc_crt_file
- libssp
zig code compilation tasks:
- compiler_rt_lib
- compiler_rt_obj
- zig_libc
- libfuzzer
At the very least, the C/C++ library compilation tasks should be kicked off in parallel, in the same wait group as C object compilation tasks. The zig compilation tasks can also happen in parallel, but they should wait until after the AstGen tasks are all complete.
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.optimization