Project to add support for parallel compilation process to GCC

As part of a research project Parallel GCC work has begun on adding a feature to GCC that allows you to split the compilation process into several parallel threads. Currently, to improve build speed on multi-core systems, the make utility uses separate compiler processes, each of which builds a separate code file. The new project is experimenting with providing parallelization at the compiler level, which will potentially improve performance on multi-core systems.

For testing prepared by a separate parallelizing branch of GCC, for setting the number of threads in which a new parameter "-param=num-threads=N" is proposed. At the initial stage, interprocedural optimizations are moved to separate execution threads, which are cyclically called for each function and lend themselves well to parallelization. GIMPLE operations are placed in separate threads, which are responsible for hardware-independent optimizations that evaluate the interaction of functions with each other.

At the next stage, it is also planned to move interprocedural RTL optimizations into separate threads, taking into account the peculiarities of the hardware platform. After that, it is planned to implement the parallelization of intra-procedural optimizations (IPA) applied to the code inside the function, regardless of the features of the call. The limiting link so far is the garbage collector, which has a global lock that disables garbage collection operations while running in multithreaded mode (in the future, the garbage collector will be adapted for GCC multithreading).

To evaluate the change in performance, a test suite has been prepared that builds the gimple-match.c file, which includes more than 100 thousand lines of code and 1700 functions. Tests on a system with an Intel Core i5-8250U CPU with 4 physical cores and 8 virtual cores (Hyperthreading) showed a decrease in the execution time of Intra Procedural GIMPLE optimizations from 7 to 4 seconds when starting 2 threads and up to 3 seconds when starting 4 threads, i.e. an increase in the speed of the considered assembly stage by 1.72 and 2.52 times, respectively, was achieved. Tests have also shown that using virtual cores with Hyperthreading does not lead to performance gains.

Project to add support for parallel compilation process to GCC

The overall build time has been reduced by about 10%, but parallelization of RTL optimizations is predicted to achieve more tangible results, since this stage takes significantly longer to compile. Approximately after RTL parallelization, the total assembly time will be reduced by 1.61 times. After that, it will be possible to reduce build time by another 5-10% due to parallelization of IPA optimizations.

Project to add support for parallel compilation process to GCC

Source: opennet.ru

Add a comment