Subject: [PATCH] gnu: rocm: Update to 5.6.0.
From: John Kehayias <[email-masked]>
To: Guix-patches <[email-masked]>
Cc: Lars-Dominik Braun <[email-masked]>
Date: Thu, 06 Jul 2023 16:32:22 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Guix and Lars (as a known ROCm user and knowledgeable about these packages),

Attached is a patch to update our rocm packages to the new release, 5.6.0. Nothing too major here in terms of packaging updates, was able to get rid of some unneeded patches and did some style updates at the same time. I also did llvm-for-rocm together in one patch/commit this time since I think it makes the most sense to include it as it should match rocm-version as well. I tested everything build locally (x86_64 only) and Darktable OpenCL works with this.

One gotcha I hit I wanted to note for future reference: rocm-comgr had lld (linker from LLVM) as an input which had worked. Until you change the order of the inputs. I guess some collision/conflict with the llvm-for-rocm used to build the package. The errors for 5.6.0 I saw were unable to link to LLVM libraries. Everything works fine removing that input.

Thanks!
John
From 3b827bc2b902ebcfa8e7ba1375e385005e3da438 Mon Sep 17 00:00:00 2001
Message-Id: <3b827[email-masked]>
From: John Kehayias <[email-masked]>
Date: Thu, 6 Jul 2023 11:55:03 -0400
Subject: [PATCH] gnu: rocm: Update to 5.6.0.

Update all of the ROCm packages at the same time as they share a version
number and should be upgraded together, including llvm-for-rocm.

* gnu/packages/llvm.scm (llvm-for-rocm): Update to 5.6.0.
[source]{patches}: Remove unneeded patches (linkdl and remove-isystem-usr-include).
* gnu/packages/rocm.scm (rocm-cmake, roct-thunk-interface, rocclr-src): Update
to 5.6.0.
(rocm-device-libs):  Update to 5.6.0.
[inputs]: Update style.
(rocm-comgr): Update to 5.6.0.
[inputs]: Remove lld.  Update style.
(rocr-runtime): Update to 5.6.0.
[arguments]: Use gexps.  Remove configure-flags.  Add add-rocm-device-lib-path
phase.
[inputs]: Add libdrm.  Update style.
[native-inputs]: Add pkg-config.  Update style.
(rocm-opencl-runtime): Update to 5.6.0.
[source]{patches}: Remove noopencl patch.
[arguments]{configure-flags}: Add BUILD_ICD=OFF and
FILE_REORG_BACKWARD_COMPATIBILITY=OFF flags.
[inputs]: Add opencl-headers.
(rocminfo): Update to 5.6.0.
[arguments]: Use gexps.  Use search-input-file instead of assoc-ref and which.
(rocm-bandwidth-test): Update to 5.6.0.
[source]{patches}: Add fix-includes patch.
* gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch: Update patches.
* gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch,
gnu/packages/patches/llvm-roc-5.0.0-linkdl.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch: Delete files.
* gnu/packages/patches/rocm-bandwidth-test-5.5.0-fix-includes.patch: New file.
* gnu/local.mk (dist_patch_DATA): Update patches.
---
 gnu/local.mk                                  |   6 +-
 gnu/packages/llvm.scm                         |   7 +-
 ...roc-4.0.0-remove-isystem-usr-include.patch |  29 -----
 .../patches/llvm-roc-5.0.0-linkdl.patch       |  15 ---
 ...cm-bandwidth-test-5.5.0-fix-includes.patch |  79 ++++++++++++++
 .../rocm-comgr-3.1.0-dependencies.patch       |  33 +++---
 .../rocm-opencl-runtime-4.3-noclinfo.patch    |  26 +++--
 .../rocm-opencl-runtime-4.3-noopencl.patch    |  70 ------------
 gnu/packages/rocm.scm                         | 100 ++++++++++--------
 9 files changed, 167 insertions(+), 198 deletions(-)
 delete mode 100644 gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch
 delete mode 100644 gnu/packages/patches/llvm-roc-5.0.0-linkdl.patch
 create mode 100644 gnu/packages/patches/rocm-bandwidth-test-5.5.0-fix-includes.patch
 delete mode 100644 gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6470f1abd4..1528beacd4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -50,7 +50,7 @@
 # Copyright © 2022 Daniel Meißner <[email-masked]>
 # Copyright © 2022 Remco van 't Veer <[email-masked]>
 # Copyright © 2022 Artyom V. Poptsov <[email-masked]>
-# Copyright © 2022 John Kehayias <[email-masked]>
+# Copyright © 2022, 2023 John Kehayias <[email-masked]>
 # Copyright © 2022 muradm <[email-masked]>
 # Copyright © 2022 Hilton Chain <[email-masked]>
 # Copyright © 2022 Alex Griffin <[email-masked]>
@@ -1544,8 +1544,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/llvm-9-fix-bitcast-miscompilation.patch	\
   %D%/packages/patches/llvm-9-fix-lpad-miscompilation.patch	\
   %D%/packages/patches/llvm-9-fix-scev-miscompilation.patch	\
-  %D%/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch \
-  %D%/packages/patches/llvm-roc-5.0.0-linkdl.patch \
   %D%/packages/patches/lm-sensors-hwmon-attrs.patch		\
   %D%/packages/patches/lsh-fix-x11-forwarding.patch		\
   %D%/packages/patches/lsof-fatal-test-failures.patch		\
@@ -1877,9 +1875,9 @@ dist_patch_DATA =						\
   %D%/packages/patches/remake-impure-dirs.patch			\
   %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch	\
   %D%/packages/patches/rng-tools-revert-build-randstat.patch	\
+  %D%/packages/patches/rocm-bandwidth-test-5.5.0-fix-includes.patch	\
   %D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch 	\
   %D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch 	\
-  %D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch 	\
   %D%/packages/patches/rottlog-direntry.patch 			\
   %D%/packages/patches/ruby-hiredis-use-system-hiredis.patch	\
   %D%/packages/patches/ruby-hydra-minimal-no-byebug.patch	\
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 6d83313af6..de5ad3718b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1462,7 +1462,7 @@ (define-public llvm-for-rocm
     ;; Based on LLVM 14 as of v5.0.0
     (inherit llvm-14)
     (name "llvm-for-rocm")
-    (version "5.1.3")                         ;this must match '%rocm-version'
+    (version "5.6.0")                         ;this must match '%rocm-version'
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -1471,10 +1471,7 @@ (define-public llvm-for-rocm
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0j6ydfkwrxwskgnhxc3cmry42n5faqbnwf2747qgf7lz5id8h8g5"))
-              (patches
-               (search-patches "llvm-roc-5.0.0-linkdl.patch"
-                               "llvm-roc-4.0.0-remove-isystem-usr-include.patch"))))
+                "1kg6q6aqijjrwaznj0gr3nd01gykrnqqnk8vz8wyfifr18l9jrgx"))))
     (arguments
      (substitute-keyword-arguments (package-arguments llvm-14)
        ((#:configure-flags flags)
diff --git a/gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch b/gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch
deleted file mode 100644
index f14ec4ac0d..0000000000
--- a/gnu/packages/patches/llvm-roc-4.0.0-remove-isystem-usr-include.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Author: Wilfried (justxi) Holzke
-
-Adopted from https://github.com/justxi/rocm/blob/master/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
-
-Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
-===================================================================
---- llvm-project-rocm-4.0.0.orig/clang/lib/Driver/ToolChains/AMDGPU.cpp
-+++ llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
-@@ -326,11 +326,6 @@ void RocmInstallationDetector::AddHIPInc
-     //
-     // ROCm 3.5 does not fully support the wrapper headers. Therefore it needs
-     // a workaround.
--    SmallString<128> P(D.ResourceDir);
--    if (UsesRuntimeWrapper)
--      llvm::sys::path::append(P, "include", "cuda_wrappers");
--    CC1Args.push_back("-internal-isystem");
--    CC1Args.push_back(DriverArgs.MakeArgString(P));
-   }
- 
-   if (DriverArgs.hasArg(options::OPT_nogpuinc))
-@@ -341,8 +336,6 @@ void RocmInstallationDetector::AddHIPInc
-     return;
-   }
- 
--  CC1Args.push_back("-internal-isystem");
--  CC1Args.push_back(DriverArgs.MakeArgString(getIncludePath()));
-   if (UsesRuntimeWrapper)
-     CC1Args.append({"-include", "__clang_hip_runtime_wrapper.h"});
- }
diff --git a/gnu/packages/patches/llvm-roc-5.0.0-linkdl.patch b/gnu/packages/patches/llvm-roc-5.0.0-linkdl.patch
deleted file mode 100644
index d6ed3aef93..0000000000
--- a/gnu/packages/patches/llvm-roc-5.0.0-linkdl.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Taken from the Gentoo patch:
-https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-devel/llvm-roc/files/llvm-roc-5.0.0-linkdl.patch
-
-LLVMOffloadArch should link libdl to fix undefined symbol 'dlsym' when linking
-
---- a/llvm/lib/OffloadArch/offload-arch/CMakeLists.txt
-+++ b/llvm/lib/OffloadArch/offload-arch/CMakeLists.txt
-@@ -3,6 +3,7 @@ add_llvm_tool(offload-arch
-   ${CMAKE_CURRENT_SOURCE_DIR}/offload-arch.cpp
-   DEPENDS generated-table LLVMOffloadArch
- )
-+target_link_libraries(LLVMOffloadArch PRIVATE ${CMAKE_DL_LIBS})
- target_link_libraries(offload-arch PRIVATE LLVMOffloadArch)
- 
- if(CMAKE_HOST_UNIX)
diff --git a/gnu/packages/patches/rocm-bandwidth-test-5.5.0-fix-includes.patch b/gnu/packages/patches/rocm-bandwidth-test-5.5.0-fix-includes.patch
new file mode 100644
index 0000000000..a5404ad62c
--- /dev/null
+++ b/gnu/packages/patches/rocm-bandwidth-test-5.5.0-fix-includes.patch
@@ -0,0 +1,79 @@
+See <https://github.com/RadeonOpenCompute/rocm_bandwidth_test/pull/90>.
+
+From a58f9fd4cb5d1120b9ce58c912ca87fa14720f73 Mon Sep 17 00:00:00 2001
+From: pppig236 <[email-masked]>
+Date: Tue, 2 May 2023 15:19:52 -0400
+Subject: [PATCH] fix include for rocm 5.5.0
+
+---
+ base_test.hpp           |  8 +-------
+ common.hpp              | 11 ++---------
+ rocm_bandwidth_test.hpp |  8 +-------
+ 3 files changed, 4 insertions(+), 23 deletions(-)
+
+diff --git a/base_test.hpp b/base_test.hpp
+index 3e79de1..af99a85 100755
+--- a/base_test.hpp
++++ b/base_test.hpp
+@@ -42,14 +42,8 @@
+ 
+ #ifndef ROC_BANDWIDTH_TEST_BASE_H_
+ #define ROC_BANDWIDTH_TEST_BASE_H_
+-#if(defined(RBT_HSA_VERSION_FLAT) && ((RBT_HSA_VERSION_FLAT) < RBT_HSA_VERSION_FILEREORG))
+-// Hsa package with out file reorganization
+-// This is for backward compatibility and will be deprecated from future release
+-#include "hsa.h"
+-#else
+ // Hsa package with file reorganization
+-#include "hsa/hsa.h"
+-#endif
++#include <hsa/hsa.h>
+ #include <iostream>
+ #include <string>
+ #include <vector>
+diff --git a/common.hpp b/common.hpp
+index d2933a0..3c4858f 100755
+--- a/common.hpp
++++ b/common.hpp
+@@ -48,16 +48,9 @@
+ #include <vector>
+ #include <cmath>
+ #include <stdio.h>
+-#if(defined(RBT_HSA_VERSION_FLAT) && ((RBT_HSA_VERSION_FLAT) < RBT_HSA_VERSION_FILEREORG))
+-// Hsa package with out file reorganization
+-// This is for backward compatibility and will be deprecated from future release
+-#include "hsa.h"
+-#include "hsa_ext_amd.h"
+-#else
+ // Hsa package with file reorganization
+-#include "hsa/hsa.h"
+-#include "hsa/hsa_ext_amd.h"
+-#endif
++#include <hsa/hsa.h>
++#include <hsa/hsa_ext_amd.h>
+ 
+ using namespace std;
+ 
+diff --git a/rocm_bandwidth_test.hpp b/rocm_bandwidth_test.hpp
+index f7eb338..b8550a7 100755
+--- a/rocm_bandwidth_test.hpp
++++ b/rocm_bandwidth_test.hpp
+@@ -43,14 +43,8 @@
+ #ifndef __ROC_BANDWIDTH_TEST_H__
+ #define __ROC_BANDWIDTH_TEST_H__
+ 
+-#if(defined(RBT_HSA_VERSION_FLAT) && ((RBT_HSA_VERSION_FLAT) < RBT_HSA_VERSION_FILEREORG))
+-// Hsa package with out file reorganization
+-// This is for backward compatibility and will be deprecated from future release
+-#include "hsa.h"
+-#else
+ // Hsa package with file reorganization
+-#include "hsa/hsa.h"
+-#endif
++#include <hsa/hsa.h>
+ #include "base_test.hpp"
+ #include "common.hpp"
+ 
+-- 
+2.40.1
+
diff --git a/gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch b/gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch
index fc2c74718a..6462b81eb9 100644
--- a/gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch
+++ b/gnu/packages/patches/rocm-comgr-3.1.0-dependencies.patch
@@ -1,4 +1,5 @@
-https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/pull/25
+See https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/pull/25 for
+original patch.
 
 From c65cba2e73f9118e128b9ab7e655ee0f8a7798e7 Mon Sep 17 00:00:00 2001
 From: Craig Andrews <[email-masked]>
@@ -12,23 +13,23 @@ Without these additional required dependencies, linking fails with errors such a
  1 file changed, 18 insertions(+), 2 deletions(-)
 
 diff --git a/lib/comgr/CMakeLists.txt b/lib/comgr/CMakeLists.txt
-index 8b5ca2f..a7d226f 100644
+index fd3ae4a..131e581 100644
 --- a/lib/comgr/CMakeLists.txt
 +++ b/lib/comgr/CMakeLists.txt
-@@ -294,7 +294,11 @@ install(FILES
-   DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}")
+@@ -322,7 +322,11 @@ install(FILES
  
- set(CLANG_LIBS
--  clangFrontendTool)
-+  clangFrontendTool
-+  clangFrontend
-+  clangBasic
-+  clangDriver
-+  clangSerialization)
- 
- set(LLD_LIBS
-   lldELF
-@@ -305,8 +309,21 @@ if (LLVM_LINK_LLVM_DYLIB)
+ if(TARGET clangFrontendTool)
+   set(CLANG_LIBS
+-    clangFrontendTool)
++    clangFrontendTool
++    clangFrontend
++    clangBasic
++    clangDriver
++    clangSerialization)
+ else()
+   set(CLANG_LIBS
+     clang-cpp)
+@@ -337,8 +341,23 @@ if (LLVM_LINK_LLVM_DYLIB)
  else()
    llvm_map_components_to_libnames(LLVM_LIBS
      ${LLVM_TARGETS_TO_BUILD}
@@ -38,6 +39,8 @@ index 8b5ca2f..a7d226f 100644
 +    Symbolize
 +    Support
 +    Object
++    TargetParser
++    Bitreader
 +    BitWriter
 +    MC
 +    MCParser
diff --git a/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch b/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch
index 97376fd421..65ad362307 100644
--- a/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch
+++ b/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch
@@ -1,14 +1,12 @@
 Do not build and install clinfo.
 
-diff --git a/CMakeLists.txt.orig b/CMakeLists.txt
-index 76847d3..3f62bfe 100644
---- a/CMakeLists.txt.orig
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0dc5bf4..95a12af 100644
+--- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -15,9 +15,9 @@ option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorganization backward co
- 
- 
- set(OPENCL_ICD_LOADER_HEADERS_DIR "${CMAKE_CURRENT_LIST_DIR}/khronos/headers/opencl2.2" CACHE PATH "")
- #add_subdirectory(khronos/icd)
+@@ -27,7 +27,7 @@ else()
+   find_package(OpenCL REQUIRED)
+ endif()
  add_subdirectory(amdocl)
 -add_subdirectory(tools/clinfo)
 +#add_subdirectory(tools/clinfo)
@@ -16,14 +14,14 @@ index 76847d3..3f62bfe 100644
  if(BUILD_TESTS)
    add_subdirectory(tests/ocltst)
 diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt
-index 48353eb..cd1e7c1 100644
+index a703f58..c07546a 100644
 --- a/packaging/CMakeLists.txt
 +++ b/packaging/CMakeLists.txt
-@@ -5,6 +5,6 @@ set(CPACK_COMPONENTS_ALL binary dev icd)
+@@ -12,6 +12,6 @@ endif()
  set(CPACK_DEB_COMPONENT_INSTALL ON)
  set(CPACK_RPM_COMPONENT_INSTALL ON)
  
--install(TARGETS clinfo DESTINATION bin COMPONENT binary)
-+#install(TARGETS clinfo DESTINATION bin COMPONENT binary)
- install(TARGETS amdocl DESTINATION lib COMPONENT binary)
- install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.txt DESTINATION share/doc/${CMAKE_PROJECT_NAME} COMPONENT binary)
+-install(TARGETS clinfo DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT binary)
++#install(TARGETS clinfo DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT binary)
+ install(TARGETS amdocl DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT binary)
+ install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.txt DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT binary)
diff --git a/gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch b/gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch
deleted file mode 100644
index 9f80d7da9d..0000000000
--- a/gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-Do not build and install libOpenCL.
-
---- b/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -15,9 +15,9 @@ option(FILE_REORG_BACKWARD_COMPATIBILITY "Enable File Reorganization backward co
- 
- 
- set(OPENCL_ICD_LOADER_HEADERS_DIR "${CMAKE_CURRENT_LIST_DIR}/khronos/headers/opencl2.2" CACHE PATH "")
--add_subdirectory(khronos/icd)
-+#add_subdirectory(khronos/icd)
- add_subdirectory(amdocl)
- add_subdirectory(tools/clinfo)
- add_subdirectory(tools/cltrace)
- if(BUILD_TESTS)
-   add_subdirectory(tests/ocltst)
-@@ -25,16 +25,6 @@ endif()
- 
- ###--- Packaging ------------------------------------------------------------###
- 
--# DEV package
--install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL"
--        DESTINATION include
--        COMPONENT DEV
--        USE_SOURCE_PERMISSIONS
--        PATTERN cl_d3d10.h EXCLUDE
--        PATTERN cl_d3d11.h EXCLUDE
--        PATTERN cl_dx9_media_sharing.h EXCLUDE
--        PATTERN cl_egl.h EXCLUDE)
--
- #############################
- # Packaging steps
- #############################
-@@ -53,8 +43,8 @@ if (DEFINED ROCM_PATCH_VERSION)
-   set(OPENCL_AMD_ICD_FILE "amdocl64_${ROCM_PATCH_VERSION}.icd")
- endif()
- 
--get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
--get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
-+#get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
-+#get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
- 
- #Set Package Version
- set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
-diff --git a/khronos/icd/CMakeLists.txt b/khronos/icd/CMakeLists.txt
-index 4bafa86..987dd6f 100644
---- a/khronos/icd/CMakeLists.txt	2020-06-07 16:05:32.425022904 +0200
-+++ b/khronos/icd/CMakeLists.txt	2020-06-07 16:06:03.273022786 +0200
-@@ -132,7 +132,7 @@ if (BUILD_TESTING)
-     add_subdirectory (test)
- endif()
- 
--install (TARGETS OpenCL
--    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
--    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
--    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-+#install (TARGETS OpenCL
-+#    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-+#    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-+#    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt
-index 48353eb..cd1e7c1 100644
---- a/packaging/CMakeLists.txt
-+++ b/packaging/CMakeLists.txt
-@@ -17,5 +17,5 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/khronos/headers/opencl2.2/CL
-         PATTERN cl_dx9_media_sharing.h EXCLUDE
-         PATTERN cl_egl.h EXCLUDE )
- 
--install(TARGETS OpenCL DESTINATION lib COMPONENT icd )
-+#install(TARGETS OpenCL DESTINATION lib COMPONENT icd )
- install(FILES ${CMAKE_SOURCE_DIR}/khronos/icd/LICENSE DESTINATION share/doc/rocm-ocl-icd COMPONENT icd)
diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm
index b85b39d783..0acdd9a4dc 100644
--- a/gnu/packages/rocm.scm
+++ b/gnu/packages/rocm.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Lars-Dominik Braun <[email-masked]>
-;;; Copyright © 2022 John Kehayias <[email-masked]>
+;;; Copyright © 2022, 2023 John Kehayias <[email-masked]>
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify it
 ;;; under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ (define-module (gnu packages rocm)
 
 ;; The components are tightly integrated and can only be upgraded as a unit. If
 ;; you want to upgrade ROCm, bump this version number and update hashes below.
-(define %rocm-version "5.1.3")
+(define %rocm-version "5.6.0")
 
 (define-public rocm-cmake
   (package
@@ -51,7 +51,7 @@ (define-public rocm-cmake
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1bn3l04qnc1ls9abs15s1sgsrwmkfk0g8jgdjqshrcr3ab8ffcpf"))))
+                "183s2ksn142r7nl7l56qvyrgvvkdgqfdzmgkfpp4a6g9mjp88ady"))))
     (build-system cmake-build-system)
     (arguments `(#:tests? #f)) ; Tests try to use git commit
     (native-inputs (list git))
@@ -73,13 +73,13 @@ (define-public rocm-device-libs
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "07vkrxxc49i72r0lcl6dap0qcw1bignsw920rj4h1mac3bwa8q4j"))))
+                "1jg96ycy99s9fis8sk1b7qx5p33anw16mqlm07zqbnhry2gqkcbh"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
        (list "-DCMAKE_SKIP_BUILD_RPATH=FALSE"
              "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE")))
-    (inputs `(("llvm" ,llvm-for-rocm)))
+    (inputs (list llvm-for-rocm))
     (home-page "https://github.com/RadeonOpenCompute/ROCm-Device-Libs")
     (synopsis "ROCm Device libraries")
     (description "AMD-specific device-side language runtime libraries, namely
@@ -98,7 +98,7 @@ (define-public rocm-comgr
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1achb3216cbm7x2d05xj7j7ivn24y11q2d2p5whw3v4ykgfqql6f"))
+                "15s2dx0pdvjv3xfccq5prkplcbwps8x9jas5qk93q7kv8wx57p3b"))
               (patches
                (search-patches "rocm-comgr-3.1.0-dependencies.patch"))))
     (build-system cmake-build-system)
@@ -108,10 +108,7 @@ (define-public rocm-comgr
          (add-after 'unpack 'chdir
            (lambda _
              (chdir "lib/comgr"))))))
-    (inputs
-     `(("rocm-device-libs" ,rocm-device-libs)
-       ("llvm" ,llvm-for-rocm)
-       ("lld" ,lld)))
+    (inputs (list llvm-for-rocm rocm-device-libs))
     (home-page "https://github.com/RadeonOpenCompute/ROCm-CompilerSupport")
     (synopsis "ROCm Code Object Manager")
     (description "The Comgr library provides APIs for compiling and inspecting
@@ -130,7 +127,7 @@ (define-public roct-thunk-interface
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0k5bchq1jhgraqrhj9q47b45n33wnd2ipwrrj39q51jzxmyyzxj2"))))
+                "0v8j4gkbb21gqqmz1b4nmampx5ywva99ipsx8lcjr5ckcg84fn9x"))))
     (build-system cmake-build-system)
     (arguments `(#:tests? #f)) ; Not sure how to run tests.
     (inputs (list libdrm numactl))
@@ -153,27 +150,32 @@ (define-public rocr-runtime
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1j1cy64w13plgsy20mir4xm6x4xnwkyil3g03xnda6ynhd7bkhv7"))))
+                "07wh7s1kgvpw8ydxmr2wvvn05fdqcmcc20qjbmnc3cbbhxviksyr"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:configure-flags
-       `(,(string-append
-           "-DBITCODE_DIR="
-           (assoc-ref %build-inputs "rocm-device-libs")
-           "/amdgcn/bitcode/"))
-       #:tests? #f ; No tests.
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'chdir
-           (lambda _
-             (chdir "src"))))))
+     (list
+      #:tests? #f ; No tests.
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'add-rocm-device-lib-path
+            (lambda _
+              (substitute* "src/image/blit_src/CMakeLists.txt"
+                (("-O2")
+                 (string-append
+                  "-O2 --rocm-device-lib-path="
+                  #$(this-package-input "rocm-device-libs")
+                  "/amdgcn/bitcode/")))))
+          (add-after 'add-rocm-device-libs-path 'chdir
+            (lambda _
+              (chdir "src"))))))
     (inputs
-     `(("libelf" ,libelf)
-       ("numactl" ,numactl)
-       ("llvm" ,llvm-for-rocm)
-       ("roct-thunk-interface" ,roct-thunk-interface)
-       ("rocm-device-libs" ,rocm-device-libs))) ; For bitcode.
-    (native-inputs (list xxd))
+     (list libdrm
+           libelf
+           llvm-for-rocm
+           numactl
+           rocm-device-libs ; For bitcode.
+           roct-thunk-interface))
+    (native-inputs (list pkg-config xxd))
     (home-page "https://github.com/RadeonOpenCompute/ROCR-Runtime")
     (synopsis "ROCm Platform Runtime")
     (description "User-mode API interfaces and libraries necessary for host
@@ -182,7 +184,7 @@ (define-public rocr-runtime
 
 ;; This is the source only for ROCclr as from v4.5 it should only be built as
 ;; part of a client.  A warning is output if attempting to build stand-alone
-;; and there is no install.  The previous version is kept as rocclr-4.
+;; and there is no install.
 (define rocclr-src
   (origin
     (method git-fetch)
@@ -191,7 +193,7 @@ (define rocclr-src
           (commit (string-append "rocm-" %rocm-version))))
     (sha256
      (base32
-      "0x1frzpz9j1s516vscbdm9g5cqirvv5w7wmq2kyljcygnci7yqar"))))
+      "1fzvnngxcvxscn718cqfglm4izccx88zjdr3g5ldfqw7hyd034sk"))))
 
 (define-public rocm-opencl-runtime
   (package
@@ -206,11 +208,9 @@ (define-public rocm-opencl-runtime
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1rirvc8h0ahicw1vw4js4jq5gw25x47gmg3gczmyz97c72wvgfiv"))
+                "1azfxf0ac3mnbyfgn30bz5glwlmaigzdz0cd29jzc4b05hks1yr3"))
               (patches
                (search-patches
-                ;; Do not install libOpenCL, which ocl-icd provides.
-                "rocm-opencl-runtime-4.3-noopencl.patch"
                 ;; Guix includes a program clinfo already.
                 "rocm-opencl-runtime-4.3-noclinfo.patch"))))
     (build-system cmake-build-system)
@@ -222,7 +222,12 @@ (define-public rocm-opencl-runtime
          (string-append "-DAMD_OPENCL_PATH=" #$(package-source this-package))
          ;; The ROCclr source is needed to build the runtime.
          (string-append "-DROCCLR_PATH=" #$rocclr-src)
-         (string-append "-DROCM_PATH=" #$output))
+         (string-append "-DROCM_PATH=" #$output)
+         ;; Don't build the ICD loader as we have the opencl-icd-loader
+         ;; package already.
+         "-DBUILD_ICD=OFF"
+         ;; Don't duplicate the install in an "opencl" directory as well.
+         "-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'install 'create-icd
@@ -238,6 +243,7 @@ (define-public rocm-opencl-runtime
      (list glew
            mesa
            numactl
+           opencl-headers
            opencl-icd-loader
            rocm-comgr
            rocr-runtime))
@@ -258,18 +264,19 @@ (define-public rocminfo
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0hdfbvn55h5lk5s8vqlmri5r94vlas8v8yjxwd9d70igslk0kr67"))))
+                "150bvyxp9krq8f7jqd1g5b4l85rih4ch322y4sg1hnciqpabn6a6"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:tests? #f ; No tests.
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-binary-paths
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* "rocminfo.cc"
-               (("lsmod")
-                (string-append (assoc-ref inputs "kmod") "/bin/lsmod"))
-               (("grep") (which "grep"))))))))
+     (list
+      #:tests? #f ; No tests.
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-binary-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "rocminfo.cc"
+                (("lsmod")
+                 (search-input-file inputs "bin/lsmod"))
+                (("grep") (search-input-file inputs "bin/grep"))))))))
     (inputs
      (list rocr-runtime kmod))
     (home-page "https://github.com/RadeonOpenCompute/rocminfo")
@@ -290,7 +297,8 @@ (define-public rocm-bandwidth-test
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0rnn2ms68mvzpcp31dk304sfqnv352i7vb48k7rw3qjahhrjm48c"))))
+                "0ca6r8xijw3a3hrlgkqqsf3iqyia6sdmidgmjl12f5vypxzp5kmm"))
+              (patches (search-patches "rocm-bandwidth-test-5.5.0-fix-includes.patch"))))
     (build-system cmake-build-system)
     (arguments `(#:tests? #f)) ; No tests.
     (inputs (list rocr-runtime))

base-commit: 67c276a870b9d6be69c2a9e867683e58928c38ef
prerequisite-patch-id: e282a1c5d3286b7715cad72962f494d2d56d8fcc
prerequisite-patch-id: 656485c99b42352c0eedb241af948bd19ef1857c
prerequisite-patch-id: 89c7181debe0bc9d94a4035c5ddfc2e495becd65
prerequisite-patch-id: 7da573a9b135e39c3c1c6128ea8f2b9433bef949
prerequisite-patch-id: 7d38c3df34cc98d2d71e984cf4eb72d20a86f694
prerequisite-patch-id: 89c7181debe0bc9d94a4035c5ddfc2e495becd65
prerequisite-patch-id: 0f7d5306c9953ff425c1b5d44807c43d0908f5ff
prerequisite-patch-id: bf6e8bbc7adbef9dfeaa237b57806f0e051a1588
prerequisite-patch-id: d9b03fadf4e0617ae9fd99e2a4569088fa138cb0
prerequisite-patch-id: 89c7181debe0bc9d94a4035c5ddfc2e495becd65
prerequisite-patch-id: 3edd9b05dbcaf02b276087982465fc292fd23c95
prerequisite-patch-id: 5cefe6598904cb7ba36ccae9309084438d84069d
prerequisite-patch-id: eb2f92015e487fe1fb9e1f0803cb1c9614c05af7
prerequisite-patch-id: bf6e8bbc7adbef9dfeaa237b57806f0e051a1588
prerequisite-patch-id: 970c3e5af1d647a77c104cdaf487c986cf6660f3
prerequisite-patch-id: 81c8e47534c6523fa1c10f713bf6b10ae05e9b54
prerequisite-patch-id: a088a24f20373d230ed54818b1405ac76a336537
prerequisite-patch-id: ae0750f361cb74b38d61b705511e18b847791e9a
prerequisite-patch-id: f63b0379f89a9d6249b1270eec4042b7918ab8eb
prerequisite-patch-id: 99dbf414e972f019b3e6b2602932cfb6fa9a505f
prerequisite-patch-id: 4e19cc41474d02a2836ac745de1d6e565867fd55
prerequisite-patch-id: 00d8c76f452dad9009e90fce0dc8d1859ab51a0b
prerequisite-patch-id: eca1fb4c330a3925e55db95b18ae8ca7403569e5
-- 
2.40.1