Update HIP-Clang build instruction (#1764)

[ROCm/hip commit: af697eaefe]
Этот коммит содержится в:
Yaxun (Sam) Liu
2020-01-06 02:02:47 -05:00
коммит произвёл Maneesh Gupta
родитель 2a70e452a5
Коммит 3dae7945ff
+32 -9
Просмотреть файл
@@ -42,20 +42,43 @@ apt-get install hip-hcc
* Install the [rocm](http://gpuopen.com/getting-started-with-boltzmann-components-platforms-installation/) packages. ROCm will install some of the necessary components, including the kernel driver, HSA runtime, etc.
* Build LLVM/clang/lld by using the following repository and branch and following the general LLVM/clang build procedure. It is recommended to use -DCMAKE_INSTALL_PREFIX=/opt/rocm/llvm with cmake so that LLVM/clang/lld are installed to the default path expected by hipcc.
* Build HIP-Clang
```
git clone https://github.com/llvm/llvm-project.git
cd llvm-project/llvm/tools
ln -s clang ../../clang
ln -s lld ../../lld
cd ../..
mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" ../llvm
make -j
sudo make install
```
* LLVM: https://github.com/RadeonOpenCompute/llvm.git amd-common branch
* clang: https://github.com/RadeonOpenCompute/clang amd-common branch
* lld: https://github.com/RadeonOpenCompute/lld amd-common branch
* Build Rocm device library
* Checkout https://github.com/RadeonOpenCompute/ROCm-Device-Libs.git master branch and build it with clang built from the last step.
```
export PATH=/opt/rocm/llvm/bin:$PATH
git clone -b master https://github.com/RadeonOpenCompute/ROCm-Device-Libs.git
cd ROCm-Device-Libs
mkdir -p build && cd build
CC=clang CXX=clang++ cmake -DLLVM_DIR=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_WERROR=1 -DLLVM_ENABLE_ASSERTIONS=1 ..
make -j
sudo make install
```
* Build HIP
* Checkout https://github.com/ROCm-Developer-Tools/HIP.git master branch and build it with HCC installed with ROCm packages. Please use -DHIP_COMPILER=clang with cmake to enable hip-clang.
```
git clone -b master https://github.com/ROCm-Developer-Tools/HIP.git
cd HIP
mkdir -p build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm/hip -DHIP_COMPILER=clang -DCMAKE_BUILD_TYPE=Release ..
make -j
sudo make install
```
* Default paths and environment variables:
* By default HIP looks for HSA in /opt/rocm/hsa (can be overridden by setting HSA_PATH environment variable)