Rate This Document
Findability
Accuracy
Completeness
Readability

Enabling the BiSheng Compiler

Enabling the BiSheng Compiler can improve the performance of some core libraries.

  1. Install the BiSheng Compiler. For details, see BiSheng Compiler User Guide.
  2. Verify whether the BiSheng Compiler functions properly.
    clang -v

    If the information shown in the preceding figure is displayed, the BiSheng Compiler is normal.

  3. Go to the /home/software directory and modify the build.sh script in 3.1.
    1. Set the compiler mode. In commands for compiling libwebp-1.2.1, libjpeg-turbo-1.5.2, giflib-5.1.4, libpng-1.6.38, GraphicsMagick-1.3.38, and AOM, set the compiler mode to BiSheng Compiler.
    2. Add -flto=full and -mcpu=hip09 to the compiler parameters of libwebp-1.2.1, libpng-1.6.38, and AOM. Save the following modified code as the build-bisheng.sh script.
      • Set the BiSheng compiler as follows:
        • cmake: -DCMAKE_C_COMPILER=clang
        • configure: CC=clang
      • Add compiler parameters as follows:
        • cmake: Add the parameters to -DCMAKE_C_FLAGS.
        • configure: Add the parameters to CPPFLAGS.
      • Compiler parameter description:
        • -mcpu=hip09: specifies the architecture of the target processor and generates optimization code for the processor. This parameter is valid for the new Kunpeng 920 processor model, but not for the Kunpeng 920 processor.
        • -flto=full: enables full link-time optimization.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    #!/bin/bash
    # Define the installation location.
    rm -rf /opt/jdimg/*
    JDIMG_PATH="/opt/jdimg" 
    echo "$JDIMG_PATH/lib" > /etc/ld.so.conf.d/jdimg.conf
    echo "$JDIMG_PATH/lib64" > /etc/ld.so.conf.d/jdimg_lib64.conf
    export PKG_CONFIG_PATH="$JDIMG_PATH/lib/pkgconfig:$PKG_CONFIG_PATH"
    pushd libwebp-1.2.1/ && rm -rf build && mkdir build && pushd build && \
    cmake -DCMAKE_INSTALL_PREFIX:PATH=$JDIMG_PATH -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_FULL_LIBDIR=/lib -DBUILD_SHARED_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=OFF -DCMAKE_C_FLAGS="-ffp-contract=off -flto=full -mcpu=hip09" -DCMAKE_C_COMPILER=clang .. && \
    make -j8 && make install && popd && popd && \
    pushd libjpeg-turbo-1.5.2 && chmod +x ./configure && rm -rf build && mkdir build && pushd build &&\
    ../configure --prefix=$JDIMG_PATH CC=clang CFLAGS="-O3 -ffp-contract=off" CPPFLAGS="-Wall -ffp-contract=off" && \
    make -j8 && make install && popd && popd && \
    pushd giflib-5.1.4/ && chmod +x ./configure && rm -rf build && mkdir build && pushd build && \
    ../configure --prefix=$JDIMG_PATH CC=clang CFLAGS="-O3 -ffp-contract=off" CPPFLAGS="-Wall -ffp-contract=off" && \
    make -j8 && make install && popd && popd && \
    pushd zlib-1.2.11 && chmod +x ./configure && rm -rf build && mkdir build && pushd build && \
    ../configure --prefix=$JDIMG_PATH && make -j8 && make install && popd && popd && \
    pushd libpng-1.6.38 && chmod +x ./configure && rm -rf build && mkdir build && pushd build && \
    ../configure --prefix=$JDIMG_PATH LDFLAGS="-L$JDIMG_PATH/lib/ -lz -flto=full" CFLAGS="-g -O2 -ffp-contract=off -I$JDIMG_PATH/include" CPPFLAGS="-ffp-contract=off -mcpu=hip09 -flto=full" CC=clang && \
    make -j8 && make install && popd && popd && \
    pushd GraphicsMagick-1.3.38 && chmod +x ./configure && rm -rf build && mkdir build && pushd build && \
    ../configure --prefix=$JDIMG_PATH --disable-openmp --enable-shared --without-tiff --without-x LDFLAGS="-L$JDIMG_PATH/lib" CPPFLAGS="-I$JDIMG_PATH/include -ffp-contract=off " CC=clang CFLAGS="-g -Ofast -Wall -ffp-contract=off " && make -j8 && make install && popd && popd && \
    pushd aom && rm -rf aom_build && mkdir aom_build && pushd aom_build && cmake -DCMAKE_INSTALL_PREFIX:PATH=$JDIMG_PATH -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_FULL_LIBDIR=/lib -DBUILD_SHARED_LIBS=1 -DENABLE_TESTS=ON -DENABLE_EXAMPLES=ON -DENABLE_DOCS=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="-Ofast -mcpu=hip09 -flto=full -ffp-contract=off -fPIC" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-Ofast -mcpu=hip09 -flto=full -ffp-contract=off -fPIC" .. && make -j8 && make install && popd && popd && \
    pushd SVT-AV1-v0.8.7/Build/linux && chmod +x ./build.sh && ./build.sh release shared install prefix=$JDIMG_PATH cc=gcc cxx=g++ && popd  && \
    pushd libyuv && rm -rf build && mkdir build && pushd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=$JDIMG_PATH -DCMAKE_CXX_STANDARD=11 -DBUILD_SHARED_LIBS=1 .. && make -j8 && make install && popd && popd  && \
    mkdir -p $JDIMG_PATH/lib64 && cp $JDIMG_PATH/lib/libaom.so $JDIMG_PATH/lib64/ && pushd libavif-0.9.3 && rm -rf build && mkdir build && pushd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=$JDIMG_PATH -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_FULL_LIBDIR=/lib -DCMAKE_LIBRARY_ARCHITECTURE=ON -DBUILD_SHARED_LIBS=1 -DAVIF_CODEC_AOM=ON -DAVIF_CODEC_DAV1D=OFF -DAVIF_CODEC_LIBGAV1=OFF -DAVIF_CODEC_RAV1E=OFF -DAVIF_CODEC_SVT=ON -DAVIF_BUILD_EXAMPLES=OFF -DCMAKE_VERBOSE_MAKEFILE=OFF -DAVIF_BUILD_APPS=ON  -DDAV1D_INCLUDE_DIR=$JDIMG_PATH/include  -DCMAKE_C_FLAGS=" -fopenmp" .. && make -j8 && make install && popd && popd
    
  4. Run the script and wait until the execution is complete.
    sh build-bisheng.sh