Installation
This page details, how to install or build all components for SX-Aurora offloading.
Installing the Package
NEC provides LLVM including our OpenMP offloading implementation as package in a YUM repository.
The packaged version is build from the hpce/stable branch of the NEC llvm-project repository at the llvm-ve-rv-1.9.0 tag.
Thus, the included version of our OpenMP offloading implementation will not be at the latest state of development.
However, further functionality and SX-Aurora specific fixes and extensions are included.
- Download
llvm-ve-rv-1.9.0-1.9.0-1.el8.x86_64.rpmwget https://sx-aurora.com/repos/llvm/x86_64/llvm-ve-rv-1.9.0-1.9.0-1.el8.x86_64.rpm - Install RPM
sudo yum install ./llvm-ve-rv-1.9.0-1.9.0-1.el8.x86_64.rpm
- Add the
https://sx-aurora.com/repos/llvm/x86_64/yum repository to your/etc/yum.repo.d(consult How to add a Yum repository by Red Hat) - Install
llvm-ve-rv-1.9.0sudo yum install llvm-ve-rv-1.9.0
Release Notes
LLVM for NEC SX-Aurora VE (llvm-ve-rv 1.8-dev)
This is a fork of the LLVM repositoy with support for the NEC SX-Aurora TSUBASA Vector Engine (VE).
Features
- C, C++ support.
- VEL intrinsics for low-level vector programming.
- Automatic vectorization through LLVM's loop and SLP vectorizers.
- When combined with RV for SX-Aurora, provides user-guided (and some automatic) outer-loop vectorization through the Region Vectorizer.
- Two OpenMP offloading modes: VE to VH and VH to VE.
Build instructions
To build llvm-ve from source refer to llvm-dev and Compile.rst.
General Usage
To compile C/C++ code for the VE run Clang/Clang++ with the following command line:
$ clang -target ve-linux -O3 ...
OpenMP offloading for/from SX-Aurora
To compile with OpenMP offloading from VE to VH (VHCall) use:
$ clang -target ve-linux -fopenmp -fopenmp-targets=x86_64-pc-linux -O3 ...
To compile with OpenMP offloading from VH to VE (VEO) use:
$ clang -march=native -fopenmp -fopenmp-targets=ve-linux -O3 ...
Outer-loop Vectorization
LLVM for SX-Aurora provides outer-loop vectorization, provided it is build with the Region Vectorizer. The following usage examples require an RV-enabled build.
To use user-guided outer-loop vectorization with RV annotate the loops to
vectorize with #pragma omp simd and use:
$ clang -fopenmp-simd -mllvm -rv -O3 ...
This release comes with a preview feature for automatic outer-loop vectorization
with RV. This will work for some loops that use int64_t for their iteration
variables (loop counters). To enable automatic outer-loop vectorization with RV
use:
$ clang -mllvm -rv -mllvm -rv-autovec -O3 ...
VEL Intrinsics for direct vector programming
See the manual. To use VEL
intrinsics, pass the compiler option -mattr=+packed. The resulting LLVM
bitcode and objects are compatible with those compiler without this option.
Clang Experimental Options
To enable packed mode support, call Clang with -mve-packed.
This sets the machine attribute +packed.
LLVM Experimental Options
Clang and llc accept these flags directly, prefix them with -mllvm to use them with Clang.
-ve-regalloc=0disable the experimental improvements to the vector register allocator.
Building the Project
This project now comes as a single llvm-project repository, forked from LLVM's upstream repository. All components can be checked out from a single source and built, closely following the Clang build instructions.
To build the project, first check out the llvm-project repository and
switch to the aurora-offloading branch before configuring the project with CMake.
Configure with CMake
After checking out the aurora-offloading branch,
change the working directory to llvm-project/llvm and run CMake with, at least,
the following CMake variables:
- Set
LLVM_ENABLE_PROJECTStoclang;openmp;libcxx;libcxxabito enable at least clang, openmp, libcxx and libcxxabi. - Set
OPENMP_LIBOMPTARGETtoONto enable libomptarget
Additionally, make sure that:
LIBOMPTARGET_DEP_VEO_LIBRARIESPoints to an installation oflibveo.so(usually found under/opt/nec/ve/veos/lib64/)LIBOMPTARGET_DEP_VEOSINFO_LIBRARIESPoints to an installation oflibveosinfo.so(usually found under/opt/nec/ve/veos/lib64/)NECAURORA_TARGET_COMPILER_NCCpoints to your installation ofncc(usually found under/opt/nec/ve/bin).
Static Linking
To be able to statically link the target image, please make sure that, additionally, the following CMake variables are set
NECAURORA_LIBAVEOVE_STATIC, pointing tolibaveoVE.aNECAURORA_LIBURPCVE_STATIC, pointing toliburpcVE_omp.aNECAURORA_LIBVEIO, pointing tolibveio.so
Usually these libraries are installed at /opt/nec/ve/lib.
Enable Testing
To enable the test suite for the source transformation, simply set SOTOC_ENABLE_TESTS to ON.
The test suite uses the llvm-lit and FileCheck tool build together with the project and uses the project's Clang as test compiler.
CMake Options
-
NECAURORA_LIBELF_INCLUDE_DIRPoints to the include directory containing the headers forlibelf.so(required for static linking). -
NECAURORA_LIBELF_LIBRARIESPoints to alibelf.so(required for static linking). -
NECAURORA_LIBAVEOVE_STATICPoints tolibaveoVE.a(required for static linking). -
NECAURORA_LIBURPCVE_STATICPoints toliburpcVE_omp.a(required for static linking). -
NECAURORA_LIBVEIOPoints tolibveio.so(required for static linking). -
NECAURORA_TARGET_COMPILER_CLANGThe path to the Clang compiler used for target compilations with the option-fopenmp-nec-compiler=clang. -
NECAURORA_TARGET_COMPILER_RVCLANGThe path to the target compiler used for target compilations with the option-fopenmp-nec-compiler=rclangpreset. -
NECAURORA_TARGET_COMPILER_NCCThe path to the target compiler used for target compilations with the option-fopenmp-nec-compiler=ncc. -
NECAURORA_DEFAULT_TARGET_OPTIONThe default option for-fopenmp-nec-compiler=(defaults toncc). -
SOTOC_DEBUG_OUTPUTEnables debug output for sotoc (when the env-varSOTOC_DEBUG=1is set). -
SOTOC_ENABLE_TESTSEnables the test suite for sotoc (can be called with makecheck-sotoc). -
SOTOC_LLVM_LIT_EXECUTABLEThellvm-litexecutable required for testing. -
LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIRThe include-directory for alibffiinstallation (required for Run-On-Host). -
LIBOMPTARGET_DEP_LIBFFI_LIBRARIESThe path to alibffi.so(required for Run-On-Host). -
LIBOMPTARGET_DEP_VEO_INCLUDE_DIRThe include-directory forve_offload.h. -
LIBOMPTARGET_DEP_VEO_LIBRARIESPath tolibveo.so/libaveo.so.
Building the NEC packaged version
To build the packaged version by NEC (e.g. if debug information is needed) some Makefiles are provided.
To get those clone the llvm-dev repository.
git clone https://github.com/sx-aurora-dev/llvm-dev.git -b hpce/develop
The actual LLVM repository and all required submodules can be cloned by doing:
LLVM_BUILD_TYPE=Debug BUILD_TYPE=Debug BRANCH=hpce/develop REPOS=https://github.com/sx-aurora-dev make clone
For the build process cmake, ninja and clang are required.
module purge && module load DEVELOP cmake ninja-build clang
Afterwards LLVM can be build by issuing the following command:
LLVM_BUILD_TYPE=Debug BUILD_TYPE=Debug BRANCH=hpce/develop REPOS=https://github.com/sx-aurora-dev make install