laitimes

Huawei's masterpiece BiSheng compiler joined the Euler open source operating system software repository, and the performance was greatly improved

IT House January 29 news, OpenEuler official now announced: Bi Sheng compiler officially added to the Euler open source operating system software repository, in the OpenEuler system can be installed through yum, currently only support Arm architecture.

According to the benchmark test results, under the same hardware and software conditions, the performance of bisheng compiler 2.1.0 is 24.3% better than that of GCC 9.3.0, and the use of Bisheng compiler can further improve application performance.

What is the Bisheng compiler

BiSheng Compiler is a high-performance, high-trust and easily scalable compiler created by Huawei Compiler Lab, which supports programming languages such as C/C++/Fortran, enhances and introduces a variety of compilation optimization technologies, and optimizes for some application scenarios, especially in high-performance computing (HPC) scenarios.

Huawei's masterpiece BiSheng compiler joined the Euler open source operating system software repository, and the performance was greatly improved

The latest version of the Bisheng compiler is currently 2.1.0, released on December 30, 2021. The current version 2.1.0 enhances loop optimization, struct recombination optimization, Block reorder optimization features to improve the performance of multiple spec CPU 2017 sub-items and HPC workload, adds support for pow initialization immediate number fitting, mathematical function control and other precision control options, further enhance precision tuning options, support for multi-threaded parallel programming technology and Input / output enhancements (Fortran 2003)/ Asynchronous IO feature to meet the needs of Kunpeng scenarios for Fortran language ecology.

Huawei's masterpiece BiSheng compiler joined the Euler open source operating system software repository, and the performance was greatly improved

Optimization features

The Bisheng compiler uses a variety of enhanced compilation optimization techniques, including but not limited to the following optimization features:

Loop optimization

These include Loop Unswitching: reducing the number of executions of branch jumps; Loop unroll-and-jam: improving memory and cache locality and utilization; Loop Fusion: directly reusing values in other loops, exposing more instruction scheduling opportunities; Loop Distribution: reducing register pressure in loops and exposing more vectorization opportunities; loops Unrolling: You can reduce the number of dynamic instructions, find more optimization opportunities, such as data multiplexing, a wider range of instruction scheduling, and improve vectorized data concurrency.

Memory layout optimization

Converts a struct array (AoS) to an array struct (SoA), and rearranges the array optimization. By using the above methods, the hit ratio of the Cache will be improved, which will improve the performance of the program.

Software prefetching

By coordinating with the Kunpeng processor, the Bisheng compiler accurately models the hardware-related features, so that the compiler prefetch analysis code can accurately simulate the access characteristics of the Kunpeng processor, and then insert accurate prefetch instructions in the code, thereby improving the Cache hit rate and improving the performance of the program.

Automatic vectorization

Combined with the Kunpeng NEON/SVE instruction set, the Bisheng compiler has enhanced vector automation by converting a scalar program that performs similar operations into a vectorized program, thus enabling computer programs to process multiple pieces of data with one instruction, improving program performance.

Autotuner

Based on the ML automatic search technology, through multiple iterations, find the best options in the optimizable space, and then compile the target program with better performance.

performance

Test environment:

Operating system: OpenEuler 20.03

CPU:Kunpeng 920

The Bisheng compiler development team conducted performance reviews based on the Bisheng compiler version 2.1.0, and the SPEC CPU 2017 test report showed that the Overall Score of the Bisheng Compiler 2.1.0 reached 399 points, and the GCC 9.3.0 overall score was 321 points. In the same hardware and software environment, the performance of the Bisheng compiler is 24.3% higher than that of GCC.

How to use

In the openEuler system, you can use yum to install the Bisheng compiler; other Linux operating systems can be installed as a package. The installation tutorial is as follows:

Note: If you have other versions of the LLVM compiler on your system, run the hash -r command immediately after installing and uninstalling the Bisheng compiler to empty the hash table of the current window to prevent the clang command from being captured by hash and the problem that the Bisheng compiler or the open source LLVM compiler cannot be used.

Yum source installation

Step 1: Add the configuration file bisheng-comliper.repo to the /etc /yum.repos.d/ directory and run the following command:

cat > /etc/yum.repos.d/bisheng-comliper.repo

[bisheng-comliper]

name=bisheng-comliper

baseurl-https://repo.oepkgs.net/bisheng/aarch64/

enabled=1

gpgcheck=0

priority=100

Step 2: Use the yum command to install:

yum update

yum install bisheng-comliler

Package installation

Step 1: Go to the Bisheng compiler product page (original link) to download the Bisheng compiler:

Step 2: Set the installation directory

Take the /opt/ compiler directory as an example, if your installation directory is different, please refer to the actual directory.

Create the Bisheng compiler installation directory

mkdir -p /opt/compiler

Copy the Bisheng compiler package to the installation directory:

cp bisheng-compiler-2.1.0-aarch64-linux.tar.gz /opt/compiler

Step 3: Extract the package

cd /opt/compiler

tar -zxvf bisheng-compiler-2.1.0-aarch64-linux.tar.gz

After the extraction is complete, a directory named bisheng-compiler-2.1.0-aarch64-linux appears in the current directory.

Step 4: Configure the environment variables of the Bisheng compiler

export PATH=/opt/compiler/bisheng-compiler-2.1.0-aarch64-linux/bin:\$PATH

export LD_LIBRARY_PATH=/opt/compiler/bisheng-compiler-2.1.0-aarch64-linux/lib:\$LD_LIBRARY_PATH

Step Five: Verify that the installation was successful

clang --v

Returning the following information indicates that the installation was successful:

Huawei Bisheng Compiler clang version 12.0.0 (clang-7a3fa32529f2 flang-774a1ed6a7c1)\

Target: aarch64-unknown-linux-gnu\

Thread model: posix

IT House learned that the bisheng compiler uses the same way as LLVM, and the new optimization options and features are used, please refer to the documentation of the Bisheng compiler product page (original link).

Read on