Created
July 12, 2022 08:06
-
-
Save cgmb/ebfa9c9b1071823580113d8db6f6b1c1 to your computer and use it in GitHub Desktop.
How to build rocm-hipamd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install basic tools | |
| sudo apt install build-essential devscripts packaging-dev git vim dos2unix | |
| # setup workspace to build in | |
| mkdir hip | |
| cd hip | |
| gbp clone https://salsa.debian.org/rocm-team/rocm-hipamd.git | |
| cd rocm-hipamd | |
| gbp export-orig | |
| # fixup line endings; corrected upstream in | |
| # https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/4b579bf25a0e7e0262f2836d03720a974bd2e866 | |
| dos2unix ./opencl/tests/ocltst/module/perf/oclperf.exclude | |
| git add ./opencl/tests/ocltst/module/perf/oclperf.exclude | |
| git commit -m 'fix oclperf.exclude line endings' | |
| # install dependencies | |
| mk-build-deps --install --root-cmd sudo --remove | |
| git clean -dfx | |
| # apply patch to replace .hipVersion | |
| # https://lists.debian.org/debian-ai/2022/07/msg00019.html | |
| gbp pq import | |
| git apply << 'EOF' | |
| > diff --git a/hip/bin/hipcc b/hip/bin/hipcc | |
| index 4174ebe..29b27a7 100755 | |
| --- a/hip/bin/hipcc | |
| +++ b/hip/bin/hipcc | |
| @@ -105,6 +105,9 @@ $ROCM_PATH = $hipvars::ROCM_PATH; | |
| $HIP_VERSION = $hipvars::HIP_VERSION; | |
| $HSA_PATH = $hipvars::HSA_PATH; | |
| $HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME; | |
| +$HIP_VERSION_MAJOR = $hipvars::HIP_VERSION_MAJOR; | |
| +$HIP_VERSION_MINOR = $hipvars::HIP_VERSION_MINOR; | |
| +$HIP_VERSION_PATCH = $hipvars::HIP_VERSION_PATCH; | |
| if ($HIP_PLATFORM eq "amd") { | |
| # If using ROCclr runtime, need to find HIP_ROCCLR_HOME | |
| @@ -208,6 +208,12 @@ if ($HIP_PLATFORM eq "amd") { | |
| $HIPCFLAGS .= " -isystem $HSA_PATH/include"; | |
| } | |
| + # debian: there is no FHS compliant location for .hipVersion where clang will still be | |
| + # able to find it, so .hipVersion has been omitted and the hip version is passed explicitly | |
| + $HIPCXXFLAGS .= " --hip-version=$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH"; | |
| + $HIPCFLAGS .= " --hip-version=$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH"; | |
| + $HIPLDFLAGS .= " --hip-version=$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH"; | |
| + | |
| } elsif ($HIP_PLATFORM eq "nvidia") { | |
| $CUDA_PATH=$ENV{'CUDA_PATH'} // '/usr/local/cuda'; | |
| $HIP_INCLUDE_PATH = "$HIP_PATH/include"; | |
| EOF | |
| git add -u | |
| git commit -m 'set version explicitly' | |
| gbp pq export --commit | |
| # build package | |
| gbp buildpackage | |
| # install package | |
| sudo apt install ../*.deb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment