summaryrefslogtreecommitdiffstats
path: root/amd/packages/patches
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2025-06-19 19:25:22 -0500
committermsglm <msglm@techchud.xyz>2025-06-19 19:25:22 -0500
commitd6119d8f49be6149c176f3de34a9e65cd7a20064 (patch)
treefb397b181178a713009c27dede3783cb7b56b779 /amd/packages/patches
parentedb38a355aebe1786447bacdfd5b3550aee5f91e (diff)
downloadguix-msglm-d6119d8f49be6149c176f3de34a9e65cd7a20064.tar.gz
guix-msglm-d6119d8f49be6149c176f3de34a9e65cd7a20064.tar.bz2
guix-msglm-d6119d8f49be6149c176f3de34a9e65cd7a20064.zip
import guix-hpc amd modules and add gfx1100 supportHEADmaster
Diffstat (limited to 'amd/packages/patches')
-rw-r--r--amd/packages/patches/hip-headers-5.6.1.patch15
-rw-r--r--amd/packages/patches/hipamd-5.6.1.patch16
-rw-r--r--amd/packages/patches/hipblas-6.2.0.patch21
-rw-r--r--amd/packages/patches/hipcc-5.6.1.patch35
-rw-r--r--amd/packages/patches/hipify-6.2.0.patch13
-rw-r--r--amd/packages/patches/llvm-rocm-5.7.1.patch126
-rw-r--r--amd/packages/patches/llvm-rocm-6.1.1.patch156
-rw-r--r--amd/packages/patches/llvm-rocm-6.2.0.patch77
-rw-r--r--amd/packages/patches/perfetto-meson.patch22
-rw-r--r--amd/packages/patches/rocblas-6.2.0.patch28
-rw-r--r--amd/packages/patches/rochpl-6.0.0-cmake.patch61
-rw-r--r--amd/packages/patches/rocm-bandwidth-test-reorg.patch48
-rw-r--r--amd/packages/patches/rocprof-register-6.2.0.patch26
-rw-r--r--amd/packages/patches/rocr-runtime-5.5.patch16
-rw-r--r--amd/packages/patches/tensile-5.3.3-copy-if-not-exist.patch19
15 files changed, 679 insertions, 0 deletions
diff --git a/amd/packages/patches/hip-headers-5.6.1.patch b/amd/packages/patches/hip-headers-5.6.1.patch
new file mode 100644
index 0000000..ce7dc2d
--- /dev/null
+++ b/amd/packages/patches/hip-headers-5.6.1.patch
@@ -0,0 +1,15 @@
+FindHIP: Improved search logic for HIP_ROOT_DIR
+diff --git a/cmake/FindHIP.cmake b/cmake/FindHIP.cmake
+index 24e475d3..43f4ce28 100644
+--- a/cmake/FindHIP.cmake
++++ b/cmake/FindHIP.cmake
+@@ -89,6 +89,9 @@ if(NOT APPLE)
+ DOC "HIP installed location"
+ NO_DEFAULT_PATH
+ )
++ if(NOT HIP_ROOT_DIR)
++ find_path(HIP_ROOT_DIR NAMES bin/hipconfig)
++ endif()
+ if(NOT EXISTS ${HIP_ROOT_DIR})
+ if(HIP_FIND_REQUIRED)
+ message(FATAL_ERROR "Specify HIP_ROOT_DIR")
diff --git a/amd/packages/patches/hipamd-5.6.1.patch b/amd/packages/patches/hipamd-5.6.1.patch
new file mode 100644
index 0000000..6d6b18f
--- /dev/null
+++ b/amd/packages/patches/hipamd-5.6.1.patch
@@ -0,0 +1,16 @@
+Remove windows specific versions of hipcc and hipconfig
+diff --git a/hipamd/CMakeLists.txt b/hipamd/CMakeLists.txt
+index c14a9ad32..f882e890b 100755
+--- a/hipamd/CMakeLists.txt
++++ b/hipamd/CMakeLists.txt
+@@ -400,8 +400,8 @@ if (NOT ${HIPCC_BIN_DIR} STREQUAL "")
+ install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc.pl DESTINATION bin)
+ install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.pl DESTINATION bin)
+ install(PROGRAMS ${HIPCC_BIN_DIR}/hipvars.pm DESTINATION bin)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)
+- install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)
++ # install(PROGRAMS ${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)
++ # install(PROGRAMS ${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)
+ endif()
+
+ #############################
diff --git a/amd/packages/patches/hipblas-6.2.0.patch b/amd/packages/patches/hipblas-6.2.0.patch
new file mode 100644
index 0000000..ea62494
--- /dev/null
+++ b/amd/packages/patches/hipblas-6.2.0.patch
@@ -0,0 +1,21 @@
+Remove git as a hard dependency and set rocblas_VERSION_COMMIT_ID
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 9766be2..dbecfca 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -45,14 +45,7 @@ if( BUILD_VERBOSE )
+ endif( )
+
+ # Get the git hash of the hipBLAS branch
+-find_package(Git REQUIRED)
+-
+-execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
+- WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+- OUTPUT_VARIABLE GIT_HASH_HIPBLAS
+- OUTPUT_STRIP_TRAILING_WHITESPACE)
+-
+-set(hipblas_VERSION_COMMIT_ID "${GIT_HASH_HIPBLAS}")
++set(hipblas_VERSION_COMMIT_ID "unknown_guix")
+
+ # log build commits
+ message( STATUS "*** Building hipBLAS commit: ${hipblas_VERSION_COMMIT_ID}" )
diff --git a/amd/packages/patches/hipcc-5.6.1.patch b/amd/packages/patches/hipcc-5.6.1.patch
new file mode 100644
index 0000000..595c301
--- /dev/null
+++ b/amd/packages/patches/hipcc-5.6.1.patch
@@ -0,0 +1,35 @@
+Make the hipcc compiler wrapper compatible with the modified hipvars perl module
+and the more modular pacakging approach compared to upstream ROCm
+diff --git a/bin/hipcc.pl b/bin/hipcc.pl
+index 56dcda2..e75ef67 100755
+--- a/bin/hipcc.pl
++++ b/bin/hipcc.pl
+@@ -128,8 +128,10 @@ $HIP_CLANG_PATH = $hipvars::HIP_CLANG_PATH;
+ $CUDA_PATH = $hipvars::CUDA_PATH;
+ $HIP_PATH = $hipvars::HIP_PATH;
+ $ROCM_PATH = $hipvars::ROCM_PATH;
++$ROCMINFO_PATH = $hipvars::ROCMINFO_PATH;
+ $HIP_VERSION = $hipvars::HIP_VERSION;
+-$HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME;
++$HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME;
++$DEVICE_LIB_PATH = $hipvars::DEVICE_LIB_PATH;
+
+ if ($HIP_PLATFORM eq "amd") {
+ $HIP_INCLUDE_PATH = "$HIP_ROCCLR_HOME/include";
+@@ -483,7 +485,7 @@ if($HIP_PLATFORM eq "amd"){
+ $targetsStr = $ENV{HCC_AMDGPU_TARGET};
+ } elsif (not $isWindows) {
+ # Else try using rocm_agent_enumerator
+- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator";
++ $ROCM_AGENT_ENUM = "${ROCMINFO_PATH}/bin/rocm_agent_enumerator";
+ $targetsStr = `${ROCM_AGENT_ENUM} -t GPU`;
+ $targetsStr =~ s/\n/,/g;
+ }
+@@ -613,6 +615,7 @@ if ($needLDFLAGS and not $compileOnly) {
+ $CMD .= " $HIPLDFLAGS";
+ }
+ $CMD .= " $toolArgs";
++$CMD .= " --hip-path=${HIP_PATH}";
+
+ if ($verbose & 0x1) {
+ print "hipcc-cmd: ", $CMD, "\n";
diff --git a/amd/packages/patches/hipify-6.2.0.patch b/amd/packages/patches/hipify-6.2.0.patch
new file mode 100644
index 0000000..04cac7b
--- /dev/null
+++ b/amd/packages/patches/hipify-6.2.0.patch
@@ -0,0 +1,13 @@
+Ensure installed files carry over the same permissions as the source.
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0d105e20..0c1bbb57 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -177,6 +177,7 @@ if (NOT HIPIFY_CLANG_TESTS_ONLY)
+ install(
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin
+ DESTINATION .
++ USE_SOURCE_PERMISSIONS
+ PATTERN "hipify-perl"
+ PATTERN "*.sh"
+ PATTERN "findcode.sh" EXCLUDE
diff --git a/amd/packages/patches/llvm-rocm-5.7.1.patch b/amd/packages/patches/llvm-rocm-5.7.1.patch
new file mode 100644
index 0000000..832a616
--- /dev/null
+++ b/amd/packages/patches/llvm-rocm-5.7.1.patch
@@ -0,0 +1,126 @@
+Fix libpath to ensure standard path is not modified or overwritten.
+NOTE: upstream clang-*-libc-search-path.patch does NOT apply cleanly
+for ROCm versions based on LLVM 17. Therefore it is duplicated here.
+diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
+index 85d82180a805..b7bc4a28f5ab 100644
+--- a/clang/lib/Driver/Distro.cpp
++++ b/clang/lib/Driver/Distro.cpp
+@@ -98,6 +98,10 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
+ }
+
+ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
++ // The compiler should always behave the same, even when used via Guix on a
++ // foreign distro.
++ return Distro::UnknownDistro;
++
+ Distro::DistroType Version = Distro::UnknownDistro;
+
+ // Newer freedesktop.org's compilant systemd-based systems
+diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
+index fe3664647560..bab3b75b6314 100644
+--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -271,6 +271,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
+ ROCmSearchDirs.emplace_back(D.ResourceDir,
+ /*StrictChecking=*/true);
+
++ #if 0
+ ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/rocm",
+ /*StrictChecking=*/true);
+
+@@ -318,6 +319,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
+ /*StrictChecking=*/true);
+ }
+
++ #endif
+ DoPrintROCmSearchDirs();
+ return ROCmSearchDirs;
+ }
+diff --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+index feaf0570b56f..c3e4df02ee94 100644
+--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
++++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+@@ -214,9 +214,9 @@ const char *AMDGCN::OpenMPLinker::constructLLVMLinkCommand(
+ }
+
+ // If device debugging turned on, add specially built bc files
+- StringRef libpath = Args.MakeArgString(C.getDriver().Dir + "/../" + LibSuffix);
++ StringRef libpath = Args.MakeArgString(C.getDriver().InstalledDir + "/../" + LibSuffix);
+ std::string lib_debug_perf_path = FindDebugPerfInLibraryPath(LibSuffix);
+- if (!lib_debug_perf_path.empty())
++ if (!lib_debug_perf_path.empty() && LibSuffix != "lib")
+ libpath = lib_debug_perf_path;
+
+ llvm::SmallVector<std::string, 12> BCLibs;
+diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
+index 7bc0892b6734..25de67d680b4 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.cpp
++++ b/clang/lib/Driver/ToolChains/Cuda.cpp
+@@ -125,6 +125,9 @@ CudaInstallationDetector::CudaInstallationDetector(
+ const Driver &D, const llvm::Triple &HostTriple,
+ const llvm::opt::ArgList &Args)
+ : D(D) {
++ // Don't look for CUDA in /usr.
++ return;
++
+ struct Candidate {
+ std::string Path;
+ bool StrictChecking;
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 94c26cb94ee9..56c23ed2e24c 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -187,6 +187,10 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ Generic_GCC::PushPPaths(PPaths);
+
++ // Comment out the distro-specific tweaks so that they don't bite when
++ // using Guix on a foreign distro.
++#if 0
++
+ Distro Distro(D.getVFS(), Triple);
+
+ if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
+@@ -247,6 +251,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ #ifdef ENABLE_LINKER_BUILD_ID
+ ExtraOpts.push_back("--build-id");
++#endif
+ #endif
+
+ // The selection of paths to try here is designed to match the patterns which
+@@ -268,6 +273,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ }
+ Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
+
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib", MultiarchTriple), Paths);
+ addPathIfExists(D, concat(SysRoot, "/lib/..", OSLibDir), Paths);
+
+@@ -296,9 +302,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, concat(SysRoot, "/", OSLibDir, ABIName), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir, ABIName), Paths);
+ }
++#endif
+
+ Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
+
++#if 0
+ // The deprecated -DLLVM_ENABLE_PROJECTS=libcxx configuration installs
+ // libc++.so in D.Dir+"/../lib/". Detect this path.
+ // TODO Remove once LLVM_ENABLE_PROJECTS=libcxx is unsupported.
+@@ -308,6 +316,14 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
++#endif
++
++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
++ // and friends can be found.
++ addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
++
++ // Add GCC's lib/ directory so libstdc++.so can be found.
++ addPathIfExists(D, GCCInstallation.getParentLibPath(), Paths);
+ }
+
+ ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
diff --git a/amd/packages/patches/llvm-rocm-6.1.1.patch b/amd/packages/patches/llvm-rocm-6.1.1.patch
new file mode 100644
index 0000000..3201e4f
--- /dev/null
+++ b/amd/packages/patches/llvm-rocm-6.1.1.patch
@@ -0,0 +1,156 @@
+Set perl script activation and necessary GUIX variables for HIPCC.
+Fix libpath to ensure standard path is not modified or overwritten.
+NOTE: upstream clang-*-libc-search-path.patch does NOT apply cleanly
+for ROCm versions based on LLVM 17. Therefore it is duplicated here.
+diff --git a/amd/hipcc/bin/hipcc.pl b/amd/hipcc/bin/hipcc.pl
+index 513a4278482c..65ecd6f9c6e1 100755
+--- a/amd/hipcc/bin/hipcc.pl
++++ b/amd/hipcc/bin/hipcc.pl
+@@ -129,8 +129,10 @@ $HIP_CLANG_PATH = $hipvars::HIP_CLANG_PATH;
+ $CUDA_PATH = $hipvars::CUDA_PATH;
+ $HIP_PATH = $hipvars::HIP_PATH;
+ $ROCM_PATH = $hipvars::ROCM_PATH;
++$ROCMINFO_PATH = $hipvars::ROCMINFO_PATH;
+ $HIP_VERSION = $hipvars::HIP_VERSION;
+-$HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME;
++$HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME;
++$DEVICE_LIB_PATH = $hipvars::DEVICE_LIB_PATH;
+
+ sub get_normalized_path {
+ return $doubleQuote . $_[0] . $doubleQuote;
+@@ -484,7 +486,7 @@ if($HIP_PLATFORM eq "amd"){
+ $targetsStr = $ENV{HCC_AMDGPU_TARGET};
+ } elsif (not $isWindows) {
+ # Else try using rocm_agent_enumerator
+- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator";
++ $ROCM_AGENT_ENUM = "${ROCMINFO_PATH}/bin/rocm_agent_enumerator";
+ $targetsStr = `${ROCM_AGENT_ENUM} -t GPU`;
+ $targetsStr =~ s/\n/,/g;
+ }
+@@ -610,6 +612,7 @@ if ($needLDFLAGS and not $compileOnly) {
+ $CMD .= " $HIPLDFLAGS";
+ }
+ $CMD .= " $toolArgs";
++$CMD .= " --hip-path=${HIP_PATH}";
+
+ if ($verbose & 0x1) {
+ print "hipcc-cmd: ", $CMD, "\n";
+diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
+index e86b589a1cfb..ca702717b482 100644
+--- a/clang/lib/Driver/Distro.cpp
++++ b/clang/lib/Driver/Distro.cpp
+@@ -99,6 +99,10 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
+ }
+
+ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
++ // The compiler should always behave the same, even when used via Guix on a
++ // foreign distro.
++ return Distro::UnknownDistro;
++
+ Distro::DistroType Version = Distro::UnknownDistro;
+
+ // Newer freedesktop.org's compilant systemd-based systems
+diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
+index 8eb0ee0ef3c9..70271113c126 100644
+--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -271,6 +271,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
+ ROCmSearchDirs.emplace_back(D.ResourceDir,
+ /*StrictChecking=*/true);
+
++ #if 0
+ ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/rocm",
+ /*StrictChecking=*/true);
+
+@@ -315,6 +316,7 @@ RocmInstallationDetector::getInstallationPathCandidates() {
+ ROCmSearchDirs.emplace_back(D.SysRoot + "/usr",
+ /*StrictChecking=*/true);
+
++ #endif
+ DoPrintROCmSearchDirs();
+ return ROCmSearchDirs;
+ }
+diff --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+index 2511a4e73afc..351b805681bb 100644
+--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
++++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+@@ -244,9 +244,9 @@ const char *amdgpu::dlr::getLinkCommandArgs(
+ }
+
+ // If device debugging turned on, add specially built bc files
+- StringRef libpath = Args.MakeArgString(C.getDriver().Dir + "/../" + LibSuffix);
++ StringRef libpath = Args.MakeArgString(C.getDriver().InstalledDir + "/../" + LibSuffix);
+ std::string lib_debug_perf_path = FindDebugPerfInLibraryPath(LibSuffix);
+- if (!lib_debug_perf_path.empty())
++ if (!lib_debug_perf_path.empty() && LibSuffix != "lib")
+ libpath = lib_debug_perf_path;
+
+ llvm::SmallVector<std::string, 12> BCLibs;
+diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
+index e4691d006848..1a6b8b4b571c 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.cpp
++++ b/clang/lib/Driver/ToolChains/Cuda.cpp
+@@ -129,6 +129,9 @@ CudaInstallationDetector::CudaInstallationDetector(
+ const Driver &D, const llvm::Triple &HostTriple,
+ const llvm::opt::ArgList &Args)
+ : D(D) {
++ // Don't look for CUDA in /usr
++ return;
++
+ struct Candidate {
+ std::string Path;
+ bool StrictChecking;
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 957ff0f83271..e1f782d1d1e8 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -220,6 +220,10 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ Generic_GCC::PushPPaths(PPaths);
+
++ // Comment out the distro-specific tweaks so that they don't bite when
++ // using Guix on a foreign distro
++#if 0
++
+ Distro Distro(D.getVFS(), Triple);
+
+ if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
+@@ -280,6 +284,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ #ifdef ENABLE_LINKER_BUILD_ID
+ ExtraOpts.push_back("--build-id");
++#endif
+ #endif
+
+ // The selection of paths to try here is designed to match the patterns which
+@@ -300,7 +305,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, concat(SysRoot, "/usr/libo32"), Paths);
+ }
+ Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
+-
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib", MultiarchTriple), Paths);
+ addPathIfExists(D, concat(SysRoot, "/lib/..", OSLibDir), Paths);
+
+@@ -329,11 +334,21 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, concat(SysRoot, "/", OSLibDir, ABIName), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir, ABIName), Paths);
+ }
++#endif
+
+ Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
+
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
++#endif
++
++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
++ // and friends can be found
++ addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
++
++ // Add GCC's lib/ directory so libstdc++.so can be found
++ addPathIfExists(D, GCCInstallation.getParentLibPath(), Paths);
+ }
+
+ ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
diff --git a/amd/packages/patches/llvm-rocm-6.2.0.patch b/amd/packages/patches/llvm-rocm-6.2.0.patch
new file mode 100644
index 0000000..5c865e3
--- /dev/null
+++ b/amd/packages/patches/llvm-rocm-6.2.0.patch
@@ -0,0 +1,77 @@
+Set perl script activation and necessary GUIX variables for HIPCC.
+Fix libpath to ensure standard path is not modified or overwritten.
+diff --git a/amd/hipcc/bin/hipcc b/amd/hipcc/bin/hipcc
+index 8559bb099f1c..4002631b5721 100755
+--- a/amd/hipcc/bin/hipcc
++++ b/amd/hipcc/bin/hipcc
+@@ -29,7 +29,7 @@ use File::Spec::Functions 'catfile';
+
+ # TODO: By default select perl script until change incorporated in HIP build script.
+ my $USE_PERL_SCRIPT = $ENV{'HIP_USE_PERL_SCRIPTS'};
+-$USE_PERL_SCRIPT //= 0; # use defined-or assignment operator. Use env var, but if not defined default to 1.
++$USE_PERL_SCRIPT //= 1; # use defined-or assignment operator. Use env var, but if not defined default to 1.
+
+ my $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys');
+ # escapes args with quotes SWDEV-341955
+diff --git a/amd/hipcc/bin/hipcc.pl b/amd/hipcc/bin/hipcc.pl
+index 27839e58fa4e..a5f896df2283 100755
+--- a/amd/hipcc/bin/hipcc.pl
++++ b/amd/hipcc/bin/hipcc.pl
+@@ -129,8 +129,10 @@ $HIP_CLANG_PATH = $hipvars::HIP_CLANG_PATH;
+ $CUDA_PATH = $hipvars::CUDA_PATH;
+ $HIP_PATH = $hipvars::HIP_PATH;
+ $ROCM_PATH = $hipvars::ROCM_PATH;
++$ROCMINFO_PATH = $hipvars::ROCMINFO_PATH;
+ $HIP_VERSION = $hipvars::HIP_VERSION;
+-$HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME;
++$HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME;
++$DEVICE_LIB_PATH = $hipvars::DEVICE_LIB_PATH;
+
+ sub get_normalized_path {
+ return $doubleQuote . $_[0] . $doubleQuote;
+@@ -480,7 +482,7 @@ if($HIP_PLATFORM eq "amd"){
+ $targetsStr = $ENV{HCC_AMDGPU_TARGET};
+ } elsif (not $isWindows) {
+ # Else try using rocm_agent_enumerator
+- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator";
++ $ROCM_AGENT_ENUM = "${ROCMINFO_PATH}/bin/rocm_agent_enumerator";
+ $targetsStr = `${ROCM_AGENT_ENUM} -t GPU`;
+ $targetsStr =~ s/\n/,/g;
+ }
+@@ -606,6 +608,7 @@ if ($needLDFLAGS and not $compileOnly) {
+ $CMD .= " $HIPLDFLAGS";
+ }
+ $CMD .= " $toolArgs";
++$CMD .= " --hip-path=${HIP_PATH}";
+
+ if ($verbose & 0x1) {
+ print "hipcc-cmd: ", $CMD, "\n";
+diff --git a/amd/hipcc/bin/hipconfig b/amd/hipcc/bin/hipconfig
+index f9385bb94149..58a2abf51bde 100755
+--- a/amd/hipcc/bin/hipconfig
++++ b/amd/hipcc/bin/hipconfig
+@@ -29,7 +29,7 @@ use File::Spec::Functions 'catfile';
+
+ #TODO: By default select perl script until change incorporated in HIP build script
+ my $USE_PERL_SCRIPT = $ENV{'HIP_USE_PERL_SCRIPTS'};
+-$USE_PERL_SCRIPT //= 0; # use defined-or assignment operator. Use env var, but if not defined default to 0.
++$USE_PERL_SCRIPT //= 1; # use defined-or assignment operator. Use env var, but if not defined default to 0.
+ my $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys');
+ my $SCRIPT_DIR=dirname(__FILE__);
+ if ($USE_PERL_SCRIPT) {
+diff --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+index e27d59206e99..29ae8736353b 100644
+--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
++++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+@@ -255,9 +255,9 @@ const char *amdgpu::dlr::getLinkCommandArgs(
+ }
+
+ // If device debugging turned on, add specially built bc files
+- StringRef libpath = Args.MakeArgString(C.getDriver().Dir + "/../" + LibSuffix);
++ StringRef libpath = Args.MakeArgString(C.getDriver().InstalledDir + "/../" + LibSuffix);
+ std::string lib_debug_perf_path = FindDebugPerfInLibraryPath(LibSuffix);
+- if (!lib_debug_perf_path.empty())
++ if (!lib_debug_perf_path.empty() && LibSuffix != "lib")
+ libpath = lib_debug_perf_path;
+
+ llvm::SmallVector<std::string, 12> BCLibs;
diff --git a/amd/packages/patches/perfetto-meson.patch b/amd/packages/patches/perfetto-meson.patch
new file mode 100644
index 0000000..0330aef
--- /dev/null
+++ b/amd/packages/patches/perfetto-meson.patch
@@ -0,0 +1,22 @@
+Install perfetto headers
+diff --git a/meson.build b/meson.build
+index 5ef6fce52c..561dcf4768 100644
+--- a/meson.build
++++ b/meson.build
+@@ -44,6 +44,7 @@ lib_perfetto = static_library(
+ )
+
+ inc_perfetto = include_directories('sdk')
++install_headers('sdk/perfetto.h')
+
+ dir_perfetto_trace = join_paths(meson.current_source_dir(),
+ 'protos/perfetto/trace')
+@@ -57,3 +58,8 @@ dep_perfetto = declare_dependency(
+ 'pkgdatadir': dir_perfetto_trace,
+ }
+ )
++
++pkg = import('pkgconfig')
++pkg.generate(lib_perfetto)
++
++
diff --git a/amd/packages/patches/rocblas-6.2.0.patch b/amd/packages/patches/rocblas-6.2.0.patch
new file mode 100644
index 0000000..f890774
--- /dev/null
+++ b/amd/packages/patches/rocblas-6.2.0.patch
@@ -0,0 +1,28 @@
+Remove git as a hard dependency and set rocblas_VERSION_COMMIT_ID
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 90a75dd3..8ca10301 100755
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -143,20 +143,12 @@ if( BUILD_VERBOSE )
+ message( STATUS "\t==>CMAKE_SHARED_LINKER_FLAGS_RELEASE: ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" )
+ endif( )
+
+-find_package(Git REQUIRED)
+-
+-# Get the git hash of the rocBLAS branch
+-execute_process(
+- COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
+- WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+- OUTPUT_VARIABLE GIT_HASH_ROCBLAS
+- OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ #set the rocBLAS commit hash
+-set(rocblas_VERSION_COMMIT_ID "${GIT_HASH_ROCBLAS}")
++set(rocblas_VERSION_COMMIT_ID "unknown_guix")
+
+ #set the Tensile commit hash
+-set(tensile_VERSION_COMMIT_ID "${tensile_tag}")
++set(tensile_VERSION_COMMIT_ID "unkown_guix")
+
+ # log build commits
+ message( STATUS "*** Building rocBLAS commit: ${rocblas_VERSION_COMMIT_ID}" )
diff --git a/amd/packages/patches/rochpl-6.0.0-cmake.patch b/amd/packages/patches/rochpl-6.0.0-cmake.patch
new file mode 100644
index 0000000..77f52c4
--- /dev/null
+++ b/amd/packages/patches/rochpl-6.0.0-cmake.patch
@@ -0,0 +1,61 @@
+Add support for gfx1031
+Install executables in bin subdirectory
+Allow roctracer to be installed in a separate location
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c1c8704..48489a7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -110,7 +110,7 @@ if(HIP_VERSION VERSION_GREATER_EQUAL "4.3")
+ set(TARGETS "${TARGETS};gfx90a")
+ endif()
+ if (HIP_VERSION VERSION_GREATER_EQUAL "5.3")
+- set(TARGETS "${TARGETS};gfx940")
++ set(TARGETS "${TARGETS};gfx940;gfx1030;gfx1100")
+ endif()
+ if (HIP_VERSION VERSION_GREATER_EQUAL "5.7")
+ set(TARGETS "${TARGETS};gfx941;gfx942")
+@@ -195,9 +195,9 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/HPL.dat
+ rocm_install_targets(TARGETS rochpl)
+
+ install(PROGRAMS ${CMAKE_BINARY_DIR}/run_rochpl ${CMAKE_BINARY_DIR}/mpirun_rochpl
+- DESTINATION ${CMAKE_INSTALL_PREFIX})
++ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+ install(FILES ${CMAKE_BINARY_DIR}/HPL.dat
+- DESTINATION ${CMAKE_INSTALL_PREFIX})
++ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
+
+ # Package specific CPACK vars
+ set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-dev (>= 3.5.0)")
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 2154faf..cb824f0 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -83,10 +83,10 @@ list(APPEND CMAKE_PREFIX_PATH ${ROCBLAS_PATH} ${ROCM_PATH} )
+ list(APPEND CMAKE_MODULE_PATH ${ROCM_PATH}/lib/cmake/hip )
+
+ find_library(ROCTRACER NAMES roctracer64
+- PATHS ${ROCM_PATH}/lib
++ PATHS ${ROCTRACER_PATH}/lib
+ NO_DEFAULT_PATH)
+ find_library(ROCTX NAMES roctx64
+- PATHS ${ROCM_PATH}/lib
++ PATHS ${ROCTRACER_PATH}/lib
+ NO_DEFAULT_PATH)
+
+ message("-- roctracer: ${ROCTRACER}")
+@@ -94,13 +94,13 @@ message("-- roctx: ${ROCTX}")
+
+ add_library(roc::roctracer SHARED IMPORTED)
+ set_target_properties(roc::roctracer PROPERTIES
+- INTERFACE_INCLUDE_DIRECTORIES "${ROCM_PATH}/include"
++ INTERFACE_INCLUDE_DIRECTORIES "${ROCTRACER_PATH}/include"
+ INTERFACE_LINK_LIBRARIES "hip::host"
+ IMPORTED_LOCATION "${ROCTRACER}"
+ IMPORTED_SONAME "libroctracer.so")
+ add_library(roc::roctx SHARED IMPORTED)
+ set_target_properties(roc::roctx PROPERTIES
+- INTERFACE_INCLUDE_DIRECTORIES "${ROCM_PATH}/include"
++ INTERFACE_INCLUDE_DIRECTORIES "${ROCTRACER_PATH}/include"
+ INTERFACE_LINK_LIBRARIES "hip::host"
+ IMPORTED_LOCATION "${ROCTX}"
+ IMPORTED_SONAME "libroctx64.so")
diff --git a/amd/packages/patches/rocm-bandwidth-test-reorg.patch b/amd/packages/patches/rocm-bandwidth-test-reorg.patch
new file mode 100644
index 0000000..2186f62
--- /dev/null
+++ b/amd/packages/patches/rocm-bandwidth-test-reorg.patch
@@ -0,0 +1,48 @@
+hsa-runtime64 is provided through rocr-runtime; this patch removes
+CMake paths that tries to resolve hsa-runtime64 using opt/rocm.
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a2172e7..762acfd 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -134,41 +134,6 @@ include(utils)
+ # This scheme could fail when using older builds of ROCm. In such a case the
+ # build system relies on user defined locations to find header and library files
+ find_package(hsa-runtime64 PATHS /opt/rocm )
+-if(${hsa-runtime64_FOUND})
+- # hsa-runtime config files will provide the include path via INSTALL_INTERFACE
+- message("hsa-runtime64 found @ ${hsa-runtime64_DIR} ")
+- set(RBT_HSA_VERSION_MAJ ${hsa-runtime64_VERSION_MAJOR} )
+- set(RBT_HSA_VERSION_MIN ${hsa-runtime64_VERSION_MINOR} )
+- set(RBT_HSA_VERSION_PATCH ${hsa-runtime64_VERSION_PATCH} )
+- # With file reorg changes
+- # Actual header files /opt/rocm-ver/include/hsa/
+- # Wrapper header file /opt/rocm-ver/hsa/include/hsa/
+- # Rocm 5.3.0 will have Hsa file reorg changes. Corresponding Hsa package version is 1056300
+- # If hsa package version greater than or equal to file reorg version,use hsa/hsa.h else use hsa.h
+- math(EXPR RBT_HSA_VERSION_FILEREORG "1056300")
+- add_compile_options(-DRBT_HSA_VERSION_FILEREORG=${RBT_HSA_VERSION_FILEREORG})
+-
+- if( (RBT_HSA_VERSION_MAJ GREATER 999) OR (RBT_HSA_VERSION_MIN GREATER 999) )
+- # Build will fail ,if package version is invalid
+- message(FATAL_ERROR "RBT hsa-runtime64: Too big HSA runtime version number(s)" )
+- else() # if valid hsa package version
+- # find the hsa package version and set flat version
+- math(EXPR RBT_HSA_VERSION_FLAT "(${RBT_HSA_VERSION_MAJ}*1000000+${RBT_HSA_VERSION_MIN}*1000+${RBT_HSA_VERSION_PATCH})" )
+- add_compile_options(-DRBT_HSA_VERSION_FLAT=${RBT_HSA_VERSION_FLAT})
+- endif()
+-else()
+- message("find_package did NOT find hsa-runtime64, finding it the OLD Way")
+- message("Looking for header files in ${ROCR_INC_DIR}")
+- message("Looking for library files in ${ROCR_LIB_DIR}")
+-
+- # Search for ROCr header file in user defined locations
+- # Since the search is for hsa/hsa.h and the default include is "hsa/hsa.h", this will support all version of rocm
+- find_path(ROCR_HDR hsa/hsa.h PATHS ${ROCR_INC_DIR} "/opt/rocm" PATH_SUFFIXES include REQUIRED)
+- INCLUDE_DIRECTORIES(${ROCR_HDR})
+-
+- # Search for ROCr library file in user defined locations
+- find_library(ROCR_LIB ${CORE_RUNTIME_TARGET} PATHS ${ROCR_LIB_DIR} "/opt/rocm" PATH_SUFFIXES lib lib64 REQUIRED)
+-endif()
+
+ #
+ # Set the package version for the test. It is critical that this
diff --git a/amd/packages/patches/rocprof-register-6.2.0.patch b/amd/packages/patches/rocprof-register-6.2.0.patch
new file mode 100644
index 0000000..edcd47f
--- /dev/null
+++ b/amd/packages/patches/rocprof-register-6.2.0.patch
@@ -0,0 +1,26 @@
+Do not let CMake attempt to build fmt and glog; let CMake find it instead
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 30d1308..7572226 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -113,6 +113,6 @@ if(ROCPROFILER_REGISTER_BUILD_SAMPLES)
+ add_subdirectory(samples)
+ endif()
+
+-include(rocprofiler_register_config_packaging)
++#include(rocprofiler_register_config_packaging)
+
+ rocprofiler_register_print_features()
+diff --git a/source/lib/rocprofiler-register/CMakeLists.txt b/source/lib/rocprofiler-register/CMakeLists.txt
+index 840fbed..2cdca02 100644
+--- a/source/lib/rocprofiler-register/CMakeLists.txt
++++ b/source/lib/rocprofiler-register/CMakeLists.txt
+@@ -17,6 +17,8 @@ target_include_directories(
+ rocprofiler-register PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/source
+ ${PROJECT_BINARY_DIR}/source)
+
++find_package(fmt REQUIRED)
++find_package(glog REQUIRED)
+ target_link_libraries(
+ rocprofiler-register
+ PUBLIC rocprofiler-register::headers
diff --git a/amd/packages/patches/rocr-runtime-5.5.patch b/amd/packages/patches/rocr-runtime-5.5.patch
new file mode 100644
index 0000000..72e92fe
--- /dev/null
+++ b/amd/packages/patches/rocr-runtime-5.5.patch
@@ -0,0 +1,16 @@
+Help clang find relevant device libraries
+diff --git a/src/image/blit_src/CMakeLists.txt b/src/image/blit_src/CMakeLists.txt
+index 21f998b..9aa1d8c 100644
+--- a/src/image/blit_src/CMakeLists.txt
++++ b/src/image/blit_src/CMakeLists.txt
+@@ -67,8 +67,8 @@ function(gen_kernel_bc TARGET_ID INPUT_FILE OUTPUT_FILE)
+
+ separate_arguments(CLANG_ARG_LIST UNIX_COMMAND
+ "-O2 -x cl -Xclang -finclude-default-header -cl-denorms-are-zero -cl-std=CL2.0
+- -target amdgcn-amd-amdhsa -mcpu=${TARGET_ID} -mcode-object-version=4
+- -o ${OUTPUT_FILE} ${INPUT_FILE}")
++ -target amdgcn-amd-amdhsa -mcpu=${TARGET_ID} -mcode-object-version=5
++ -o ${OUTPUT_FILE} ${INPUT_FILE} --hip-device-lib-path=${BITCODE_DIR}")
+
+ ## Add custom command to produce a code object file.
+ ## This depends on the kernel source file & compiler.
diff --git a/amd/packages/patches/tensile-5.3.3-copy-if-not-exist.patch b/amd/packages/patches/tensile-5.3.3-copy-if-not-exist.patch
new file mode 100644
index 0000000..44f9969
--- /dev/null
+++ b/amd/packages/patches/tensile-5.3.3-copy-if-not-exist.patch
@@ -0,0 +1,19 @@
+Only copy static files if they do not already exist at the destination
+diff --git a/Tensile/TensileCreateLibrary.py b/Tensile/TensileCreateLibrary.py
+index 2d63160b..a7ccf268 100644
+--- a/Tensile/TensileCreateLibrary.py
++++ b/Tensile/TensileCreateLibrary.py
+@@ -738,8 +738,11 @@ def copyStaticFiles(outputPath=None):
+
+ for fileName in libraryStaticFiles:
+ # copy file
+- shutil.copy( os.path.join(globalParameters["SourcePath"], fileName), \
+- outputPath )
++
++ path = os.path.join(globalParameters["SourcePath"], fileName)
++ if not os.path.isfile(path):
++ shutil.copy( os.path.join(globalParameters["SourcePath"], fileName), \
++ outputPath )
+
+ return libraryStaticFiles
+