From 6d42be57395411af28afdcf3c31475eb4f1a7e2c Mon Sep 17 00:00:00 2001 From: arjun-raj-kuppala <60718144+arjun-raj-kuppala@users.noreply.github.com> Date: Thu, 20 May 2021 03:58:55 -0700 Subject: AMD ROCm 4.2.0: Bump up rocm recipes part 2 (#23779) Co-authored-by: Harmen Stoppels --- .../repos/builtin/packages/hsa-rocr-dev/package.py | 18 ++++- .../llvm-amdgpu/fix-spack-detection-4.2.0.patch | 94 ++++++++++++++++++++++ .../repos/builtin/packages/llvm-amdgpu/package.py | 4 + .../repos/builtin/packages/rocalution/package.py | 16 ++-- .../builtin/packages/rocm-debug-agent/package.py | 13 +-- .../repos/builtin/packages/rocm-gdb/package.py | 8 +- .../packages/rocm-validation-suite/package.py | 8 +- 7 files changed, 140 insertions(+), 21 deletions(-) create mode 100644 var/spack/repos/builtin/packages/llvm-amdgpu/fix-spack-detection-4.2.0.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py b/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py index 5ca7b8253d..9b82354dc1 100644 --- a/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py +++ b/var/spack/repos/builtin/packages/hsa-rocr-dev/package.py @@ -20,6 +20,7 @@ class HsaRocrDev(CMakePackage): maintainers = ['srekolam', 'arjun-raj-kuppala'] version('master', branch='master') + version('4.2.0', sha256='fa0e7bcd64e97cbff7c39c9e87c84a49d2184dc977b341794770805ec3f896cc') version('4.1.0', sha256='c223a5f7ccac280520abb6ea49fdd36fa9468718098a9d984be6ef839ccbc6db') version('4.0.0', sha256='e84c48e80ea38698a5bd5da3940048ad3cab3696d10a53132acad07ca357f17c') version('3.10.0', sha256='58866d8acdb6cc45227f2412098e37c65908b20ed3dd54901dfb515c15ad5f71') @@ -29,15 +30,18 @@ class HsaRocrDev(CMakePackage): version('3.5.0', sha256='52c12eec3e3404c0749c70f156229786ee0c3e6d3c979aed9bbaea500fa1f3b8') variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type') + variant('shared', default=True, description='Build shared or static library') + variant('image', default=True, description='build with or without image support') depends_on('cmake@3:', type="build") depends_on('libelf@0.8:', type='link') for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', - 'master']: + '4.2.0', 'master']: depends_on('hsakmt-roct@' + ver, type=('link', 'run'), when='@' + ver) - for ver in ['3.7.0', '3.8.0', '3.9.0', '4.0.0', '4.1.0', 'master']: + depends_on('rocm-device-libs@' + ver, type=('build', 'link'), when='@' + ver) + + for ver in ['3.7.0', '3.8.0', '3.9.0', '4.0.0', '4.1.0', '4.2.0', 'master']: depends_on('llvm-amdgpu@' + ver, type=('link', 'run'), when='@' + ver) - depends_on('rocm-device-libs@' + ver, type=('link', 'run'), when='@' + ver) # Both 3.5.0 and 3.7.0 force INSTALL_RPATH in different ways patch('0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch', when='@3.5.0') @@ -49,7 +53,13 @@ class HsaRocrDev(CMakePackage): libelf_include = self.spec['libelf'].prefix.include.libelf args = ['-DLIBELF_INCLUDE_DIRS=%s' % libelf_include] + self.define_from_variant('BUILD_SHARED_LIBS', 'shared') + if '@3.7.0:' in self.spec: - args.append('-DIMAGE_SUPPORT=ON') + self.define_from_variant('IMAGE_SUPPORT', 'image') + + if '@4.2.0:' in self.spec: + bitcode_dir = self.spec['rocm-device-libs'].prefix.amdgcn.bitcode + args.append('-DBITCODE_DIR={0}'.format(bitcode_dir)) return args diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/fix-spack-detection-4.2.0.patch b/var/spack/repos/builtin/packages/llvm-amdgpu/fix-spack-detection-4.2.0.patch new file mode 100644 index 0000000000..2cedd4f073 --- /dev/null +++ b/var/spack/repos/builtin/packages/llvm-amdgpu/fix-spack-detection-4.2.0.patch @@ -0,0 +1,94 @@ +diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp +--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp ++++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp +@@ -58,19 +58,16 @@ + llvm::sys::path::append(PackagePath, SubDirs[0]); + return PackagePath; + } +- if (SubDirs.size() == 0) { +- unsigned DiagID = D.getDiags().getCustomDiagID( +- DiagnosticsEngine::Error, +- "Expecting SPACK package %0 at %1 but not found"); +- D.Diag(DiagID) << Prefix << Cand.Path; ++ if (SubDirs.size() == 0 && Verbose) { ++ llvm::errs() << "SPACK package " << Prefix << " not found at " << Cand.Path ++ << '\n'; + return {}; + } + +- assert(SubDirs.size() > 1); +- unsigned DiagID = D.getDiags().getCustomDiagID( +- DiagnosticsEngine::Error, +- "Expecting one SPACK package %0 at %1 but found more"); +- D.Diag(DiagID) << Prefix << Cand.Path; ++ if (SubDirs.size() > 1 && Verbose) { ++ llvm::errs() << "Cannot use SPACK package " << Prefix << " at " << Cand.Path ++ << " due to multiple installations for the same version\n"; ++ } + return {}; + } + +@@ -305,6 +302,7 @@ + const Driver &D, const llvm::Triple &HostTriple, + const llvm::opt::ArgList &Args, bool DetectHIPRuntime, bool DetectDeviceLib) + : D(D) { ++ Verbose = Args.hasArg(options::OPT_v); + RocmPathArg = Args.getLastArgValue(clang::driver::options::OPT_rocm_path_EQ); + PrintROCmSearchDirs = + Args.hasArg(clang::driver::options::OPT_print_rocm_search_dirs); +diff --git a/clang/lib/Driver/ToolChains/ROCm.h b/clang/lib/Driver/ToolChains/ROCm.h +--- a/clang/lib/Driver/ToolChains/ROCm.h ++++ b/clang/lib/Driver/ToolChains/ROCm.h +@@ -110,6 +110,7 @@ + // Cache ROCm installation search paths. + SmallVector ROCmSearchDirs; + bool PrintROCmSearchDirs; ++ bool Verbose; + + bool allGenericLibsValid() const { + return !OCML.empty() && !OCKL.empty() && !OpenCL.empty() && !HIP.empty() && +diff --git a/clang/test/Driver/rocm-detect.hip b/clang/test/Driver/rocm-detect.hip +--- a/clang/test/Driver/rocm-detect.hip ++++ b/clang/test/Driver/rocm-detect.hip +@@ -61,12 +61,15 @@ + // RUN: %s 2>&1 | FileCheck -check-prefixes=SPACK-SET %s + + // Test invalid SPACK ROCm installation missing hip and rocm-device-libs packages. ++// The message about SPACK is emitted only if -v is specified. + + // RUN: rm -rf %T/rocm-spack/hip-* + // RUN: rm -rf %T/rocm-spack/rocm-device-libs-* + // RUN: %T/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin/clang -### -v \ + // RUN: -target x86_64-linux-gnu --cuda-gpu-arch=gfx900 %s 2>&1 \ + // RUN: | FileCheck -check-prefixes=SPACK-MISS %s ++// RUN: %T/rocm-spack/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin/clang --version 2>&1 \ ++// RUN: | FileCheck -check-prefixes=SPACK-MISS-SILENT %s + + // GFX902-DEFAULTLIBS: error: cannot find ROCm device library for gfx902. Provide its path via --rocm-path or --rocm-device-lib-path, or pass -nogpulib to build without ROCm device library + +@@ -90,8 +93,8 @@ + // SPACK-SAME: "-internal-isystem" "[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include" + + // SPACK-MULT: InstalledDir: [[DIR:.*]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin +-// SPACK-MULT-DAG: Expecting one SPACK package hip-4.0.0 at [[DIR]] but found more +-// SPACK-MULT-DAG: Expecting one SPACK package rocm-device-libs-4.0.0 at [[DIR]] but found more ++// SPACK-MULT-DAG: Cannot use SPACK package hip-4.0.0 at [[DIR]] due to multiple installations for the same version ++// SPACK-MULT-DAG: Cannot use SPACK package rocm-device-libs-4.0.0 at [[DIR]] due to multiple installations for the same version + // SPACK-MULT-NOT: Found HIP installation: [[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd + // SPACK-MULT-NOT: "-mlink-builtin-bitcode" "[[DIR]]/rocm-device-libs-4.0.0-6wnyzz4hgl3hr7uswasnagt7j2adctbs/amdgcn/bitcode/hip.bc" + // SPACK-MULT-NOT: "-internal-isystem" "[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include" +@@ -103,8 +106,12 @@ + // SPACK-SET-SAME: "-internal-isystem" "[[DIR]]/hip-4.0.0-abcd/include" + + // SPACK-MISS: InstalledDir: [[DIR:.*]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin +-// SPACK-MISS-DAG: Expecting SPACK package hip-4.0.0 at [[DIR]] but not found +-// SPACK-MISS-DAG: Expecting SPACK package rocm-device-libs-4.0.0 at [[DIR]] but not found ++// SPACK-MISS-DAG: SPACK package hip-4.0.0 not found at [[DIR]] ++// SPACK-MISS-DAG: SPACK package rocm-device-libs-4.0.0 not found at [[DIR]] + // SPACK-MISS-NOT: Found HIP installation: [[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd + // SPACK-MISS-NOT: "-mlink-builtin-bitcode" "[[DIR]]/rocm-device-libs-4.0.0-6wnyzz4hgl3hr7uswasnagt7j2adctbs/amdgcn/bitcode/hip.bc" + // SPACK-MISS-NOT: "-internal-isystem" "[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5/include" ++ ++// SPACK-MISS-SILENT-NOT: SPACK package hip-{{.*}} not found at ++// SPACK-MISS-SILENT-NOT: SPACK package rocm-device-libs-{{.*}} not found at ++// SPACK-MISS-SILENT-NOT: Found HIP installation diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py index d9372b3b6a..24cf89297b 100644 --- a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py +++ b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py @@ -18,6 +18,7 @@ class LlvmAmdgpu(CMakePackage): maintainers = ['srekolam', 'arjun-raj-kuppala'] version('master', branch='amd-stg-open') + version('4.2.0', sha256='751eca1d18595b565cfafa01c3cb43efb9107874865a60c80d6760ba83edb661') version('4.1.0', sha256='244e38d824fa7dfa8d0edf3c036b3c84e9c17a16791828e4b745a8d31eb374ae') version('4.0.0', sha256='aa1f80f429fded465e86bcfaef72255da1af1c5c52d58a4c979bc2f6c2da5a69') version('3.10.0', sha256='8262aff88c1ff6c4deb4da5a4f8cda1bf90668950e2b911f93f73edaee53b370') @@ -45,6 +46,9 @@ class LlvmAmdgpu(CMakePackage): patch('fix-system-zlib-ncurses.patch', when='@3.5.0:3.8.0') patch('fix-ncurses-3.9.0.patch', when='@3.9.0:4.0.0') + # This is already fixed in upstream but not in 4.2.0 rocm release + patch('fix-spack-detection-4.2.0.patch', when='@4.2.0') + conflicts('^cmake@3.19.0') root_cmakelists_dir = 'llvm' diff --git a/var/spack/repos/builtin/packages/rocalution/package.py b/var/spack/repos/builtin/packages/rocalution/package.py index f978ea2b21..01b0b2d25e 100644 --- a/var/spack/repos/builtin/packages/rocalution/package.py +++ b/var/spack/repos/builtin/packages/rocalution/package.py @@ -17,10 +17,11 @@ class Rocalution(CMakePackage): homepage = "https://github.com/ROCmSoftwarePlatform/rocALUTION" git = "https://github.com/ROCmSoftwarePlatform/rocALUTION.git" - url = "https://github.com/ROCmSoftwarePlatform/rocALUTION/archive/rocm-4.0.0.tar.gz" + url = "https://github.com/ROCmSoftwarePlatform/rocALUTION/archive/rocm-4.2.0.tar.gz" maintainers = ['srekolam', 'arjun-raj-kuppala'] + version('4.2.0', sha256='0424adf522ded41de5b77666e04464a25c73c92e34025762f30837f90a797445') version('4.1.0', sha256='3f61be18a02dff0c152a0ad7eb4779c43dd744b0ba172aa6a4267fc596d582e4') version('4.0.0', sha256='80a224a5c19dea290e6edc0e170c3dff2e726c2b3105d599ec6858cc66f076a9') version('3.10.0', sha256='c24cb9d1a8a1a3118040b8b16dec7c06268bcf157424d3378256cc9eb93f1b58') @@ -30,7 +31,8 @@ class Rocalution(CMakePackage): version('3.5.0', sha256='be2f78c10c100d7fd9df5dd2403a44700219c2cbabaacf2ea50a6e2241df7bfe') depends_on('cmake@3.5:', type='build') - for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0']: + for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', + '4.2.0']: depends_on('hip@' + ver, when='@' + ver) depends_on('rocblas@' + ver, type='link', when='@' + ver) depends_on('rocprim@' + ver, type='link', when='@' + ver) @@ -38,10 +40,12 @@ class Rocalution(CMakePackage): depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver) depends_on('comgr@' + ver, type='build', when='@' + ver) depends_on('llvm-amdgpu@' + ver, type='build', when='@' + ver) - if ver in ['3.9.0', '3.10.0', '4.0.0', '4.1.0']: - depends_on('rocrand@' + ver, type='link', when='@' + ver) - if ver in ['4.1.0']: - depends_on('hip-rocclr@' + ver, type='link', when='@' + ver) + + for ver in ['3.9.0', '3.10.0', '4.0.0', '4.1.0', '4.2.0']: + depends_on('rocrand@' + ver, type='link', when='@' + ver) + + for ver in ['4.1.0', '4.2.0']: + depends_on('hip-rocclr@' + ver, type='link', when='@' + ver) patch('0001-fix-hip-build-error.patch') diff --git a/var/spack/repos/builtin/packages/rocm-debug-agent/package.py b/var/spack/repos/builtin/packages/rocm-debug-agent/package.py index f3d4a57633..2cba38cc9d 100644 --- a/var/spack/repos/builtin/packages/rocm-debug-agent/package.py +++ b/var/spack/repos/builtin/packages/rocm-debug-agent/package.py @@ -12,10 +12,11 @@ class RocmDebugAgent(CMakePackage): homepage = "https://github.com/ROCm-Developer-Tools/rocr_debug_agent" git = "https://github.com/ROCm-Developer-Tools/rocr_debug_agent.git" - url = "https://github.com/ROCm-Developer-Tools/rocr_debug_agent/archive/rocm-4.1.0.tar.gz" + url = "https://github.com/ROCm-Developer-Tools/rocr_debug_agent/archive/rocm-4.2.0.tar.gz" maintainers = ['srekolam', 'arjun-raj-kuppala'] + version('4.2.0', sha256='ce02a5b752291882daa0a2befa23944e59087ce9fe65a91061476c3c399e4a0c') version('4.1.0', sha256='b1ae874887e5ee037070f1dd46b145ad02ec9fd8a724c6b6ae194b534f01acdb') version('4.0.0', sha256='a9e64834d56a9221c242e71aa110c2cef0087aa8f86f50428dd618e5e623cc3c') version('3.10.0', sha256='675b8d3cc4aecc4428a93553abf664bbe6a2cb153f1f480e6cadeeb4d24ef4b1') @@ -38,12 +39,14 @@ class RocmDebugAgent(CMakePackage): depends_on('cmake@3:', type='build') depends_on("elfutils", type='link') - for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0']: + for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', + '4.2.0']: depends_on('hsa-rocr-dev@' + ver, type='link', when='@' + ver) depends_on('hsakmt-roct@' + ver, type='link', when='@' + ver) - if ver in ['3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0']: - depends_on('rocm-dbgapi@' + ver, type='link', when='@' + ver) - depends_on('hip@' + ver, when='@' + ver) + + for ver in ['3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', '4.2.0']: + depends_on('rocm-dbgapi@' + ver, type='link', when='@' + ver) + depends_on('hip@' + ver, when='@' + ver) # https://github.com/ROCm-Developer-Tools/rocr_debug_agent/pull/4 patch('0001-Drop-overly-strict-Werror-flag.patch', when='@3.7.0:') diff --git a/var/spack/repos/builtin/packages/rocm-gdb/package.py b/var/spack/repos/builtin/packages/rocm-gdb/package.py index 76f5ec9a65..970c98d039 100644 --- a/var/spack/repos/builtin/packages/rocm-gdb/package.py +++ b/var/spack/repos/builtin/packages/rocm-gdb/package.py @@ -12,10 +12,11 @@ class RocmGdb(AutotoolsPackage): based on GDB, the GNU source-level debugger.""" homepage = "https://github.com/ROCm-Developer-Tools/ROCgdb/" - url = "https://github.com/ROCm-Developer-Tools/ROCgdb/archive/rocm-4.1.0.tar.gz" + url = "https://github.com/ROCm-Developer-Tools/ROCgdb/archive/rocm-4.2.0.tar.gz" maintainers = ['srekolam', 'arjun-raj-kuppala'] + version('4.2.0', sha256='4bc579584a1f8614111e7e44d8aa1c6d5d06be3f5db055aba2cf1abc140122ac') version('4.1.0', sha256='28dc806e48695d654d52fb1a634df6d4c1243f00846ae90161e7a5e9f4d88b24') version('4.0.0', sha256='b90291b0a8409fe66d8a65d2731dcb87b9f5a22bac9ce3ffbab726eb129ba13d') version('3.10.0', sha256='05455cb47dd42404ee8bba047def6a6846a7e877e7a7db8dcffc7100d5ba16f0') @@ -27,14 +28,15 @@ class RocmGdb(AutotoolsPackage): depends_on('cmake@3:', type='build') depends_on('texinfo', type='build') depends_on('bison', type='build') - depends_on('flex', type='build') + depends_on('flex@2.6.4:', type='build') depends_on('libunwind', type='build') depends_on('expat', type=('build', 'link')) depends_on('python', type=('build', 'link')) depends_on('zlib', type='link') depends_on('babeltrace@1.2.4', type='link') - for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0']: + for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', + '4.2.0']: depends_on('rocm-dbgapi@' + ver, type='link', when='@' + ver) depends_on('comgr@' + ver, type='link', when='@' + ver) diff --git a/var/spack/repos/builtin/packages/rocm-validation-suite/package.py b/var/spack/repos/builtin/packages/rocm-validation-suite/package.py index 41bf0a89f6..21c2254b1f 100644 --- a/var/spack/repos/builtin/packages/rocm-validation-suite/package.py +++ b/var/spack/repos/builtin/packages/rocm-validation-suite/package.py @@ -15,10 +15,11 @@ class RocmValidationSuite(CMakePackage): compatible platform.""" homepage = "https://github.com/ROCm-Developer-Tools/ROCmValidationSuite" - url = "https://github.com/ROCm-Developer-Tools/ROCmValidationSuite/archive/rocm-4.0.0.tar.gz" + url = "https://github.com/ROCm-Developer-Tools/ROCmValidationSuite/archive/rocm-4.2.0.tar.gz" maintainers = ['srekolam', 'arjun-raj-kuppala'] + version('4.2.0', sha256='b25e58a842a8eb90bfd6c4ae426ca5cfdd5de2f8a091761f83597f7cfc2cd0f3') version('4.1.0', sha256='f9618f89384daa0ae897b36638a3737bcfa47e98778e360338267cd1fe2bbc66') version('4.0.0', sha256='04743ca8901b94a801759a3c13c8caf3e6ea950ffcda6408173e6f9ef7b86e74') version('3.10.0', sha256='9f9a530f7850770663e0b0ec0c786367f2e22500a472ac6652c4fd9fb4df4f64') @@ -30,7 +31,7 @@ class RocmValidationSuite(CMakePackage): variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type') patch('001-fixes-for-rocblas-rocm-smi-install-prefix-path.patch') - patch('002-remove-force-setting-hip-inc-path.patch', when='@4.1.0') + patch('002-remove-force-setting-hip-inc-path.patch', when='@4.1.0:') depends_on('cmake@3.5:', type='build') depends_on('zlib', type='link') @@ -39,7 +40,8 @@ class RocmValidationSuite(CMakePackage): spec = self.spec build_env.set("HIPCC_PATH", spec['hip'].prefix) - for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0']: + for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', + '4.2.0']: depends_on('hip@' + ver, type='build', when='@' + ver) depends_on('rocm-device-libs@' + ver, type='build', when='@' + ver) depends_on('comgr@' + ver, type='build', when='@' + ver) -- cgit v1.2.3-70-g09d2