diff --git a/hcc-lc/hcc-lc-dockerfile.template b/hcc-lc/hcc-lc-dockerfile.template index a3322f4..7d44175 100644 --- a/hcc-lc/hcc-lc-dockerfile.template +++ b/hcc-lc/hcc-lc-dockerfile.template @@ -59,30 +59,35 @@ RUN cd /usr/local/src && \ ENV HCC_BUILD_PATH=/usr/local/src/hcc-lc ENV PATH=${PATH}:${hcc_lc_volume}bin:~/bin +# While working out build issues, it usually pays off to seperate the following build steps into multiple build statements +# to save time having to build each build component, if rebuilding the image multiple times +# It will result in about double the image size, and the final dockerfile should always build the compiler in 1 run statement + # Compiling hcc-lc requires a custom build tool RUN mkdir -p ~/bin && \ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && \ chmod a+x ~/bin/repo # This is a long series of build steps, all listed under one RUN statement to keep image size down -# Build hcc-lc, install to /usr/local +# Build hcc-lc, install to /opt/rocm RUN mkdir -p ${HCC_BUILD_PATH} && \ cd ${HCC_BUILD_PATH} && \ ~/bin/repo init --depth=1 -u https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA.git -b ${repo_branch_hcc_lc} && \ ~/bin/repo sync && \ # build amd-common LLVM/LLD/Clang - cd llvm && \ + cd ${HCC_BUILD_PATH}/llvm && \ mkdir -p build && \ cd build && \ cmake \ -DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \ -DCMAKE_BUILD_TYPE=${build_config} \ - -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" .. && \ + -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" \ + -DLLVM_APPEND_VC_REV=ON .. && \ make -j $(nproc) install && \ # build ROCm-Device-Libs with amd-common Clang - cd ../../ocml/ && \ + cd ${HCC_BUILD_PATH}/ocml/ && \ mkdir -p build && \ cd build && \ CC=${HCC_BUILD_PATH}/llvm/build/bin/clang cmake \ @@ -105,8 +110,9 @@ RUN mkdir -p ${HCC_BUILD_PATH} && \ cmake \ -DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \ -DCMAKE_BUILD_TYPE=${build_config} \ - -DHSA_AMDGPU_GPU_TARGET=AMD:AMDGPU:8:0:3 \ -DROCM_DEVICE_LIB_DIR=${hcc_lc_volume}/lib \ +# -DHSA_AMDGPU_GPU_TARGET="AMD:AMDGPU:7:0:1;AMD:AMDGPU:8:0:1;AMD:AMDGPU:8:0:3" \ + -DHSA_AMDGPU_GPU_TARGET="AMD:AMDGPU:7:0:1;AMD:AMDGPU:8:0:3" \ .. && \ make -j $(nproc) world && \ make install && \ @@ -118,56 +124,10 @@ RUN mkdir -p ${HCC_BUILD_PATH} && \ ldconfig # The following downloads and builds the latest HiP using this new compiler +# Build hip, install to /opt/rocm RUN mkdir -p /usr/local/src && cd /usr/local/src && \ - git clone -b developer-preview https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP.git && \ + git clone --depth 1 -b developer-preview https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP.git && \ mkdir -p hip-build && cd hip-build && \ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-DDISABLE_COPY_EXT=1 ../HIP && \ make install && \ cd .. && rm -rf hip-build && rm -rf HIP - -## The following HCC build steps are seperated into multiple RUN statements which snapshots each individual component build -## Useful in debugging build, which saves compile time and but results in about double the image size -## Build hcc-lc, install to /usr/local -#RUN mkdir -p ${HCC_BUILD_PATH} && \ -# cd ${HCC_BUILD_PATH} && \ -# ~/bin/repo init --depth=1 -u https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA.git -b ${repo_branch_hcc_lc} && \ -# ~/bin/repo sync - -# # build amd-common LLVM/LLD/Clang -#RUN cd ${HCC_BUILD_PATH}/llvm && \ -# mkdir -p build && \ -# cd build && \ -# cmake \ -# -DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \ -# -DCMAKE_BUILD_TYPE=${build_config} \ -# -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" .. && \ -# make -j $(nproc) install - -# # build ROCm-Device-Libs with amd-common Clang -#RUN cd ${HCC_BUILD_PATH}/ocml/ && \ -# mkdir -p build && \ -# cd build && \ -# CC=${HCC_BUILD_PATH}/llvm/build/bin/clang cmake \ -# -DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \ -# -DCMAKE_BUILD_TYPE=${build_config} \ -# -DAMDHSACOD=/opt/rocm/bin/amdhsacod \ -# -DLLVM_DIR="${HCC_BUILD_PATH}/llvm/build" \ -# .. && \ -# make -j $(nproc) install - -# # build HCC with ROCm-Device-Libs -#RUN cd ${HCC_BUILD_PATH}/hcc && \ -# mkdir -p build && \ -# cd build && \ -# cmake \ -# -DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \ -# -DCMAKE_BUILD_TYPE=${build_config} \ -# -DHSA_AMDGPU_GPU_TARGET=AMD:AMDGPU:8:0:3 \ -# -DROCM_DEVICE_LIB_DIR=${hcc_lc_volume}/lib \ -# .. && \ -# make -j $(nproc) world && \ -# make install && \ -# git log -n 3 > ${hcc_lc_volume}/git-stamp.log && \ -# ${hcc_lc_cleanup} \ -# echo "${hcc_lc_volume}/lib" >> /etc/ld.so.conf.d/hcc-lc.conf && \ -# ldconfig