[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1108071: unblock: rocm-hipamd/5.7.1-6



Package: release.debian.org
Severity: normal
X-Debbugs-Cc: rocm-hipamd@packages.debian.org, cgmb@slerp.xyz
Control: affects -1 + src:rocm-hipamd
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package rocm-hipamd

[ Reason ]
The rocm-hipamd 5.7.1-6 package update contains a number of bug fixes.
None of the bug fixes are release critical, but collectively they are a
meaningful improvement on the quality of the package.

The rocm-hipamd 5.7.1-6 upload was made near the end of the soft freeze
and I had mistakenly believed that it would be able to migrate on its
own. My appologies.

[ Impact ]
Without these updates, in order of most important to least important:

- Any user building a HIP library using CMake will see a deprecation
warning from find_package(hip). (Bug #1087869)
The fix in 5.7.1-5.1 merely allows the tests to pass despite this
warning, while the 5.7.1-6 change eliminates the warning.

- Compiling PyTorch from source will require a workaround for the broken
state of FindHIP.cmake when ROCM_PATH is defined (Bug #1099404).
With that said, building PyTorch also requires other packages that
are not in testing.

- Any projects built using find_package(hiprtc) will fail to configure
because the search will succeed but the hiprtc library won't actually
exist on disk. The change in rocm-hipamd 5.7.1-6 ensures that
find_package(hiprtc) fails, accurately reflecting the libraries
shipped on Debian Trixie. (Bug #1088540)

- Some programs or libraries (including PyTorch) may fail to compile
because the hip/hip_bf16.h header does not include all the headers
it requires (Bug #1099402). For example, this program woould fail to
compile:

#include <hip/hip_bf16.h>
#include <hip/hip_fp16.h>
#include <hip/hip_runtime.h>
int main() { return 0; }

- There will be no man pages for rocm-hipamd utilties. (Bug #1103689)

- The roc-obj-ls --help and roc-obj-extract --help commands will print
perl warnings. (Bug #1103558)

- The libamdhip64-5, libhiprtc-builtins5, and rocm-opencl-icd packages
will not be coinstallable with multiple architectures. In practice,
I'm not sure this is of much importance, as there are practically no
users of ROCm on non-x86 architectures. (Bug #1086329)

- The libamdhip64-dev package won't suggests hipcc. The change to
suggest this package in rocm-hipamd 5.7.1-6 was to help indicate to
users that some features of libamdhip64-dev require installing hipcc.
I marked this as fixing Bug #1094763, although, a package suggestion
is probably not actually sufficient to prevent all user confusion.

If we choose not to unblock rocm-hipamd 5.7.1-6, I will probably need to
prepare a stable update to fix the first three or four bugs. Those will
be annoyances for users trying to build key AI libraries from source.
The last two bugs I would probably have left unfixed had I realized this
would end up in the hard freeze. Appologies.

There are some minor errors in the formatting of the hipcc manpage
introduced in 5.7.1-6 (Bug #1107681). That is unfortunate, but having a
manpage with a formatting mistake in it is still an improvement from not
having a manpage at all. The bug could be fixed with a rocm-hipamd
5.7.1-7 upload, but I figured the time on unstable of the 5.7.1-6
package is part of the evidence of its stability and I didn't want to
reset that with a fix for a minor documentation error.

[ Tests ]
The rocm-hipamd package has autopkgtests with basic checks for ensuring
that compiling code using libamdhip64-dev and hipcc library will
succeed [1]. However, runtime tests require AMD GPU hardware, which is
not available on the debci. There is an extensive set of runtime tests
run on the Debian ROCm Team's instance of the DebCI. Most of the reverse
dependencies have been tested with the new rocm-hipamd package
there (e.g., hipsolver [2]).

[ Risks ]
The src:rocm-hipamd package is perhaps the most important package in the
ROCm compute stack and it is has a couple dozen reverse dependencies.
However, the list of reverse dependencies is small enough that I have
been directly involved in the packaging of the majority of them. The
proposed changes are generally minor and mostly relate to build-time
features. I don't think there are any significant risks of affecting the
run-time behaviour of the libraries depending on libamdhip64-5.

The biggest risk would be a coding error introducing a FTBFS into the
reverse dependencies of libamdhip64-dev. This is, however, unlikely
given how long 5.7.1-6 has been in unstable and the lack of bugs found
during the packaging efforts in-progress for new reverse dependencies
such as ggml, llama.cpp, magma-rocm, cupy-rocm, dbcsr-rocm, etc. If we
are concerned, it could be further mitigated by systemically rebuilding
all the reverse dependencies on testing.

[ Checklist ]
[X] all changes are documented in the d/changelog
[X] I reviewed all changes and I approve them
[X] attach debdiff against the package in testing

[ Other info ]
None

[1]: https://ci.debian.net/packages/r/rocm-hipamd/testing/amd64/60480261/
[2]: https://ci.rocm.debian.net/packages/h/hipsolver/unstable/amd64+gfx900/

unblock rocm-hipamd/5.7.1-6
diff -Nru rocm-hipamd-5.7.1/debian/changelog rocm-hipamd-5.7.1/debian/changelog
--- rocm-hipamd-5.7.1/debian/changelog	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/changelog	2025-05-13 11:50:23.000000000 +0000
@@ -1,3 +1,29 @@
+rocm-hipamd (5.7.1-6) unstable; urgency=medium
+
+  * Revert "tests: allow deprecation warnings via allow-stderr restriction"
+  * d/p/0031-find-package-minimum-policy.patch: raise max policy version
+    in CMake config files to 3.31 to prevent deprecation warnings
+    from find_package(hip) or enable_language(hip)
+  * Remove the broken hiprtc::hiprtc imported target (Closes: #1088540)
+  * d/control: libamdhip64-dev now suggests hipcc, which is required for
+    HIP language support (Closes: #1094763)
+  * Add d/p/0038-fix-FindHIP-search-for-HIP_CLANG_PATH.patch to prevent
+    FindHIP.cmake from choosing an incorrect HIP_CLANG_PATH when ROCM_PATH
+    or HIP_PATH are set (Closes: #1099404)
+  * Add d/p/0039-fix-roc-obj-help.patch to fix garbage output in
+    roc-obj-ls --help and roc-obj-extract --help (Closes: #1103558)
+  * Add d/p/0040-self-sufficient-bf16-header.patch to fix undeclared
+    identifier '__ockl_sdot2' errors in translation units that include
+    hip_bf16.h before other headers (Closes: #1099402)
+  * Add manpages for hipcc, hipconfig, roc-obj, roc-obj-ls, and roc-obj-extract
+    (Closes: #1103689)
+
+  [ Helmut Grohne ]
+  * Mark libamdhip64-5, libhiprtc-builtins5, and rocm-opencl-icd
+    Multi-Arch: same (Closes: #1086329)
+
+ -- Cordell Bloor <cgmb@slerp.xyz>  Tue, 13 May 2025 05:50:23 -0600
+
 rocm-hipamd (5.7.1-5.1) unstable; urgency=medium
 
   * Non-maintainer upload
diff -Nru rocm-hipamd-5.7.1/debian/control rocm-hipamd-5.7.1/debian/control
--- rocm-hipamd-5.7.1/debian/control	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/control	2025-05-13 10:09:20.000000000 +0000
@@ -77,6 +77,7 @@
 Package: libamdhip64-5
 Section: libs
 Architecture: amd64 arm64 ppc64el
+Multi-Arch: same
 Depends: libamd-comgr2, ${misc:Depends}, ${shlibs:Depends}
 Description: Heterogeneous Interface for Portability - AMD GPUs implementation
  This package is central to the ROCm stack. It is at the exchange point between
@@ -86,7 +87,7 @@
 Package: libamdhip64-dev
 Section: libdevel
 Architecture: amd64 arm64 ppc64el
-Suggests: libamdhip64-doc
+Suggests: libamdhip64-doc, hipcc
 Depends: ${misc:Depends},
          libamdhip64-5 (= ${binary:Version}),
          libhiprtc-builtins5 (= ${binary:Version}),
@@ -103,6 +104,7 @@
 Package: libhiprtc-builtins5
 Section: libs
 Architecture: amd64 arm64 ppc64el
+Multi-Arch: same
 Depends: ${misc:Depends}, ${shlibs:Depends}
 Description: HIP Run Time Compilation libraries
  HIP allows one to compile kernels at runtime with its hiprtc* APIs.  hipRTC
@@ -127,6 +129,7 @@
 Package: rocm-opencl-icd
 Section: libs
 Architecture: amd64 arm64 ppc64el
+Multi-Arch: same
 Provides: opencl-icd
 Depends: ${misc:Depends}, ${shlibs:Depends}
 # Either will trigger LLVM double load bug
diff -Nru rocm-hipamd-5.7.1/debian/copyright rocm-hipamd-5.7.1/debian/copyright
--- rocm-hipamd-5.7.1/debian/copyright	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/copyright	2025-05-13 10:09:20.000000000 +0000
@@ -66,7 +66,7 @@
 Files: debian/*
 Copyright: 2022, Maxime Chambonnet <maxzor@maxzor.eu>
            2022-2023, Étienne Mollier <emollier@debian.org>
-           2022-2024, Cordell Bloor <cgmb@slerp.xyz>
+           2022-2025, Cordell Bloor <cgmb@slerp.xyz>
 License: Expat
 
 License: Apache-2
diff -Nru rocm-hipamd-5.7.1/debian/hipcc.1 rocm-hipamd-5.7.1/debian/hipcc.1
--- rocm-hipamd-5.7.1/debian/hipcc.1	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/hipcc.1	2025-05-13 11:24:13.000000000 +0000
@@ -0,0 +1,56 @@
+.TH HIPCONFIG "1" "May 2025" "hipcc 5.7.31921" "User Commands"
+.SH NAME
+hipcc \- HIP compiler driver
+.SH SYNOPSIS
+usage: hipcc [OPTIONS]
+.SH DESCRIPTION
+The hipcc script wraps clang or nvcc, depending on the value of the
+.RB $ HIP_PLATFORM
+reported by hipconfig. When building for the AMD platform, the options given to hipcc
+are passed through to clang. The hipcc script adds number of additional options to those
+explicitly given, including "\-x hip" to force the compilation language to HIP, "\-O3"
+when no optimization level is otherwise specified, and the autodetected target GPU
+architecture when no target has been otherwise specified.
+.SH ENVIRONMENT
+.TP
+.B HIPCC_VERBOSE
+The 
+.RB $ HIPCC_VERBOSE
+variable can enable additional output.
+.B 0x1 \- the clang command being invoked
+.B 0x2 \- the paths to HIP components
+.B 0x3 \- the arguments hipcc was called with
+.TP
+.B HIPCC_COMPILE_FLAGS_APPEND
+The contents of
+.B $ HIPCC_COMPILE_FLAGS_APPEND
+are added to the end of the argument list that is passed to clang when compiling.
+.TP
+The contents of
+.B $ HIPCC_LINK_FLAGS_APPEND
+are added to the end of the argument list that is passed to clang when linking.
+.TP
+.B DEVICE_LIB_PATH
+The 
+.RB $ DEVICE_LIB_PATH
+variable is used to override the path to the rocm\-device\-libs.
+.TP
+.B HIP_LIB_PATH
+The 
+.RB $ HIP_LIB_PATH
+variable is used to override the path to the HIP Runtime library directory.
+.TP
+.B HIP_CLANG_HCC_COMPAT_MODE
+The 
+.RB $ HIP_CLANG_HCC_COMPAT_MODE
+variable is used to specify if clang should allow half floats in arguments and return and
+if __HIP_HCC_COMPAT_MODE__ should be defined.
+.TP
+.B HIP_CLANG_LAUNCHER
+The 
+.RB $ HIP_CLANG_LAUNCHER
+variable specifies a path to an executable to use for launching HIP clang.
+This can be useful for making use of a compiler caching tool.
+.SH SEE ALSO
+.sp
+\fBhipconfig(1)\fP
diff -Nru rocm-hipamd-5.7.1/debian/hipcc.manpages rocm-hipamd-5.7.1/debian/hipcc.manpages
--- rocm-hipamd-5.7.1/debian/hipcc.manpages	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/hipcc.manpages	2025-05-13 11:50:15.000000000 +0000
@@ -0,0 +1,5 @@
+debian/hipcc.1
+debian/hipconfig.1
+debian/roc-obj.1
+debian/roc-obj-ls.1
+debian/roc-obj-extract.1
diff -Nru rocm-hipamd-5.7.1/debian/hipconfig.1 rocm-hipamd-5.7.1/debian/hipconfig.1
--- rocm-hipamd-5.7.1/debian/hipconfig.1	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/hipconfig.1	2025-05-13 10:51:31.000000000 +0000
@@ -0,0 +1,97 @@
+.TH HIPCONFIG "1" "May 2025" "hipconfig 5.7.31921" "User Commands"
+.SH NAME
+hipconfig \- HIP configuration information utility
+.SH SYNOPSIS
+usage: hipconfig [OPTIONS]
+.SH DESCRIPTION
+The hipconfig utility is used to query information about the HIP installation,
+such as the version, installation path, compiler, or target platform.
+.SH OPTIONS
+.TP
+\fB\-\-path\fR,  \fB\-p\fR
+: print HIP_PATH (use env var if set, else determine from hipconfig path)
+.TP
+\fB\-\-rocmpath\fR,  \fB\-R\fR
+: print ROCM_PATH (use env var if set, else determine from hip path or \fI\,/opt/rocm\/\fP)
+.TP
+\fB\-\-cpp_config\fR, \fB\-C\fR
+: print C++ compiler options
+.TP
+\fB\-\-compiler\fR, \fB\-c\fR
+: print compiler (clang or nvcc)
+.TP
+\fB\-\-platform\fR, \fB\-P\fR
+: print platform (amd or nvidia)
+.TP
+\fB\-\-runtime\fR, \fB\-r\fR
+: print runtime (rocclr or cuda)
+.HP
+\fB\-\-hipclangpath\fR, \fB\-l\fR : print HIP_CLANG_PATH
+.TP
+\fB\-\-full\fR, \fB\-f\fR
+: print full config
+.TP
+\fB\-\-version\fR, \fB\-v\fR
+: print hip version
+.TP
+\fB\-\-check\fR
+: check configuration
+.TP
+\fB\-\-newline\fR, \fB\-n\fR
+: print newline
+.TP
+\fB\-\-help\fR, \fB\-h\fR
+: print help message
+.SH ENVIRONMENT
+.TP
+.B HIP_PLATFORM
+The 
+.RB $ HIP_PLATFORM
+variable is used to explicitly specify the target platform for hipcc. Valid options are
+"amd" and "nvidia".
+.TP
+.B HIP_COMPILER
+The 
+.RB $ HIP_COMPILER
+variable is used to specify the target compiler for hipcc. Valid options are "clang" and "nvcc".
+This variable is usually set automatically based on the value of the
+.RB $ HIP_PLATFORM
+variable
+.TP
+.B HIP_RUNTIME
+The 
+.RB $ HIP_RUNTIME
+variable is used to specify the target runtime for hipcc. Valid options are "rocclr" and "cuda".
+This variable is usually set automatically based on the value of the
+.RB $ HIP_PLATFORM
+variable
+.TP
+.B ROCM_PATH
+The 
+.RB $ ROCM_PATH
+variable is used to specify the path to the AMD ROCm tools and libraries. This variable defaults
+to "/usr".
+.TP
+.B CUDA_PATH
+The 
+.RB $ CUDA_PATH
+variable is used to specify the path to the CUDA tools and libraries. This variable defaults to
+"/usr/local/cuda".
+.TP
+.B HIP_PATH
+The 
+.RB $ HIP_PATH
+variable is used to specify the path to the base directory of the HIP runtime library.
+This variable is not typically used when building on Debian.
+.TP
+.B HIP_ROCCLR_HOME
+The 
+.RB $ HIP_ROCCLR_HOME
+variable is used to specify the path to the base directory of the HIP runtime library.
+This variable is not typically used when building on Debian.
+.TP
+.B HIP_CLANG_PATH
+The 
+.RB $ HIP_CLANG_PATH
+variable is used to specify the path to the base directory of the HIP clang compiler.
+This variable is not typically used when building on Debian.
diff -Nru rocm-hipamd-5.7.1/debian/libamdhip64-dev.install rocm-hipamd-5.7.1/debian/libamdhip64-dev.install
--- rocm-hipamd-5.7.1/debian/libamdhip64-dev.install	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/libamdhip64-dev.install	2025-05-13 10:09:20.000000000 +0000
@@ -1,5 +1,6 @@
 usr/lib/${DEB_HOST_MULTIARCH}/libamdhip64.so
 usr/lib/${DEB_HOST_MULTIARCH}/libhiprtc-builtins.so
 usr/include/hip
-usr/lib/${DEB_HOST_MULTIARCH}/cmake
+usr/lib/${DEB_HOST_MULTIARCH}/cmake/hip
+usr/lib/${DEB_HOST_MULTIARCH}/cmake/hip-lang
 usr/share/hip/version
diff -Nru rocm-hipamd-5.7.1/debian/not-installed rocm-hipamd-5.7.1/debian/not-installed
--- rocm-hipamd-5.7.1/debian/not-installed	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/not-installed	2025-05-13 10:09:20.000000000 +0000
@@ -4,6 +4,7 @@
 usr/hip/*
 # libhiprtc symbols are also in libamdhip64
 usr/lib/*/libhiprtc.so*
+usr/lib/*/cmake/hiprtc
 # Duplicate files in multiarch unfriendly directory
 usr/lib/libamdhip64.so*
 usr/lib/libhiprtc-builtins.so*
diff -Nru rocm-hipamd-5.7.1/debian/patches/0031-find-package-minimum-policy.patch rocm-hipamd-5.7.1/debian/patches/0031-find-package-minimum-policy.patch
--- rocm-hipamd-5.7.1/debian/patches/0031-find-package-minimum-policy.patch	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/patches/0031-find-package-minimum-policy.patch	2025-05-13 10:09:20.000000000 +0000
@@ -11,7 +11,7 @@
  # THE SOFTWARE.
  
 -cmake_minimum_required(VERSION 3.3)
-+cmake_minimum_required(VERSION 3.3...3.5)
++cmake_minimum_required(VERSION 3.3...3.31)
  
  # Number of parallel jobs by default is 1
  if(NOT DEFINED HIP_CLANG_NUM_PARALLEL_JOBS)
@@ -22,7 +22,7 @@
  # THE SOFTWARE.
  
 -cmake_minimum_required(VERSION 3.3)
-+cmake_minimum_required(VERSION 3.3...3.5)
++cmake_minimum_required(VERSION 3.3...3.31)
  
  add_library(hip::device INTERFACE IMPORTED)
  add_library(hip::host INTERFACE IMPORTED)
@@ -33,7 +33,7 @@
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  # THE SOFTWARE.
 -cmake_minimum_required(VERSION 3.3)
-+cmake_minimum_required(VERSION 3.3...3.5)
++cmake_minimum_required(VERSION 3.3...3.31)
  
  @PACKAGE_INIT@
  include(CheckCXXCompilerFlag)
@@ -44,7 +44,7 @@
  # THE SOFTWARE.
  
 -cmake_minimum_required(VERSION 3.3)
-+cmake_minimum_required(VERSION 3.3...3.5)
++cmake_minimum_required(VERSION 3.3...3.31)
  @PACKAGE_INIT@
  include(CMakeFindDependencyMacro)
  set_and_check(hiprtc_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
diff -Nru rocm-hipamd-5.7.1/debian/patches/0038-fix-FindHIP-search-for-HIP_CLANG_PATH.patch rocm-hipamd-5.7.1/debian/patches/0038-fix-FindHIP-search-for-HIP_CLANG_PATH.patch
--- rocm-hipamd-5.7.1/debian/patches/0038-fix-FindHIP-search-for-HIP_CLANG_PATH.patch	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/patches/0038-fix-FindHIP-search-for-HIP_CLANG_PATH.patch	2025-05-13 10:09:20.000000000 +0000
@@ -0,0 +1,119 @@
+From: Cordell Bloor <cgmb@slerp.xyz>
+Date: Thu, 17 Apr 2025 22:05:44 -0600
+Subject: fix FindHIP search for HIP_CLANG_PATH
+
+Debian-Bug: https://bugs.debian.org/1099404
+Forwarded: no
+---
+ hip/cmake/FindHIP.cmake | 66 ++++++++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 57 insertions(+), 9 deletions(-)
+
+diff --git a/hip/cmake/FindHIP.cmake b/hip/cmake/FindHIP.cmake
+index 29abcd7..44ccacd 100644
+--- a/hip/cmake/FindHIP.cmake
++++ b/hip/cmake/FindHIP.cmake
+@@ -271,24 +271,48 @@ elseif("${HIP_COMPILER}" STREQUAL "clang")
+         if(DEFINED ENV{HIP_CLANG_PATH})
+             set(HIP_CLANG_PATH $ENV{HIP_CLANG_PATH})
+         elseif(DEFINED ENV{ROCM_PATH})
+-            set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/llvm/bin")
++            if(EXISTS "$ENV{ROCM_PATH}/llvm/bin")
++                set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/llvm/bin")
++            elseif(EXISTS "$ENV{ROCM_PATH}/bin")
++                set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/bin")
++            else()
++                message(FATAL_ERROR "Unable to find the clang compiler path")
++            endif()
+         elseif(DEFINED ENV{HIP_PATH})
+             if(EXISTS "$ENV{HIP_PATH}/llvm/bin") #File Reorg backward compatibility
+                 set(HIP_CLANG_PATH "$ENV{HIP_PATH}/llvm/bin")
+-            else()
++            elseif(EXISTS "$ENV{HIP_PATH}/../llvm/bin")
+                 set(HIP_CLANG_PATH "$ENV{HIP_PATH}/../llvm/bin")
++            elseif(EXISTS "$ENV{HIP_PATH}/bin")
++                set(HIP_CLANG_PATH "$ENV{HIP_PATH}/bin")
++            elseif(EXISTS "$ENV{HIP_PATH}/../bin")
++                set(HIP_CLANG_PATH "$ENV{HIP_PATH}/../bin")
++            else()
++                message(FATAL_ERROR "Unable to find the clang compiler path")
+             endif()
+         elseif(DEFINED HIP_PATH)
+             if(EXISTS "${HIP_PATH}/llvm/bin") #File Reorg backward compatibility
+                 set(HIP_CLANG_PATH "${HIP_PATH}/llvm/bin")
+-            else()
++            elseif(EXISTS "${HIP_PATH}/../llvm/bin")
+                 set(HIP_CLANG_PATH "${HIP_PATH}/../llvm/bin")
++            elseif(EXISTS "${HIP_PATH}/bin")
++                set(HIP_CLANG_PATH "${HIP_PATH}/bin")
++            elseif(EXISTS "${HIP_PATH}/../bin")
++                set(HIP_CLANG_PATH "${HIP_PATH}/../bin")
++            else()
++                message(FATAL_ERROR "Unable to find the clang compiler path")
+             endif()
+         # Handle the case where ROCM_PATH is defined and not set in ENV
+         elseif(DEFINED ROCM_PATH)
+-            set(HIP_CLANG_PATH "${ROCM_PATH}/llvm/bin")
++            if(EXISTS "${ROCM_PATH}/llvm/bin")
++                set(HIP_CLANG_PATH "${ROCM_PATH}/llvm/bin")
++            elseif(EXISTS "${ROCM_PATH}/bin")
++                set(HIP_CLANG_PATH "${ROCM_PATH}/bin")
++            else()
++                message(FATAL_ERROR "Unable to find the clang compiler path")
++            endif()
+         else()
+-            message(FATAL_ERROR "Unable to find the clang compiler path. Set ROCM_PATH or HIP_PATH in env ")
++            message(FATAL_ERROR "Unable to find the clang compiler path. Set ROCM_PATH or HIP_PATH in env")
+         endif()
+       endif() # HIP_CLANG_INSTALL_DIR Check
+     endif() # Set HIP_CLANG_PATH
+@@ -707,22 +731,46 @@ macro(HIP_ADD_EXECUTABLE hip_target)
+             if(DEFINED ENV{HIP_CLANG_PATH})
+                 set(HIP_CLANG_PATH $ENV{HIP_CLANG_PATH})
+             elseif(DEFINED ENV{ROCM_PATH})
+-                set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/llvm/bin")
++                if(EXISTS "$ENV{ROCM_PATH}/llvm/bin")
++                    set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/llvm/bin")
++                elseif(EXISTS "$ENV{ROCM_PATH}/bin")
++                    set(HIP_CLANG_PATH "$ENV{ROCM_PATH}/bin")
++                else()
++                    message(FATAL_ERROR "Unable to find the clang compiler path")
++                endif()
+             elseif(DEFINED ENV{HIP_PATH})
+                 if(EXISTS "$ENV{HIP_PATH}/llvm/bin") #file reorg backward compatibility
+                     set(HIP_CLANG_PATH "$ENV{HIP_PATH}/llvm/bin")
+-                else()
++                elseif(EXISTS "$ENV{HIP_PATH}/../llvm/bin")
+                     set(HIP_CLANG_PATH "$ENV{HIP_PATH}/../llvm/bin")
++                elseif(EXISTS "$ENV{HIP_PATH}/bin")
++                    set(HIP_CLANG_PATH "$ENV{HIP_PATH}/bin")
++                elseif(EXISTS "$ENV{HIP_PATH}/../bin")
++                    set(HIP_CLANG_PATH "$ENV{HIP_PATH}/../bin")
++                else()
++                    message(FATAL_ERROR "Unable to find the clang compiler path")
+                 endif()
+             elseif(DEFINED HIP_PATH)
+                 if(EXISTS "${HIP_PATH}/llvm/bin") #file reorg backward compatibility
+                     set(HIP_CLANG_PATH "${HIP_PATH}/llvm/bin")
+-                else()
++                elseif(EXISTS "${HIP_PATH}/../llvm/bin")
+                     set(HIP_CLANG_PATH "${HIP_PATH}/../llvm/bin")
++                elseif(EXISTS "${HIP_PATH}/bin")
++                    set(HIP_CLANG_PATH "${HIP_PATH}/bin")
++                elseif(EXISTS "${HIP_PATH}/../bin")
++                    set(HIP_CLANG_PATH "${HIP_PATH}/../bin")
++                else()
++                    message(FATAL_ERROR "Unable to find the clang compiler path")
+                 endif()
+             # Handle  the case where ROCM_PATH is defined and not set in ENV
+             elseif(DEFINED ROCM_PATH)
+-                set(HIP_CLANG_PATH "${ROCM_PATH}/llvm/bin")
++                if(EXISTS "${ROCM_PATH}/llvm/bin")
++                    set(HIP_CLANG_PATH "${ROCM_PATH}/llvm/bin")
++                elseif(EXISTS "${ROCM_PATH}/bin")
++                    set(HIP_CLANG_PATH "${ROCM_PATH}/bin")
++                else()
++                    message(FATAL_ERROR "Unable to find the clang compiler path")
++                endif()
+             else()
+                 message(FATAL_ERROR "Unable to find the clang compiler path. Set ROCM_PATH or HIP_PATH in env")
+             endif()
diff -Nru rocm-hipamd-5.7.1/debian/patches/0039-fix-roc-obj-help.patch rocm-hipamd-5.7.1/debian/patches/0039-fix-roc-obj-help.patch
--- rocm-hipamd-5.7.1/debian/patches/0039-fix-roc-obj-help.patch	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/patches/0039-fix-roc-obj-help.patch	2025-05-13 10:09:20.000000000 +0000
@@ -0,0 +1,62 @@
+From: Cordell Bloor <cgmb@slerp.xyz>
+Date: Fri, 18 Apr 2025 22:09:26 -0600
+Subject: fix roc-obj help
+
+Defining the appropriate Getopt::Std variables and functions prevents
+the --help command from printing this sort of weird output:
+
+    /usr/bin/roc-obj-ls version [unknown] calling Getopt::Std::getopts (version 1.14 [paranoid]),
+        running under Perl version 5.40.1.
+    <...>
+      [Now continuing due to backward compatibility and excessive paranoia.
+       See 'perldoc Getopt::Std' about $Getopt::Std::STANDARD_HELP_VERSION.]
+
+Forwarded: no
+Bug-Debian: https://bugs.debian.org/1103558
+---
+ hipamd/bin/roc-obj-extract | 10 ++++++++++
+ hipamd/bin/roc-obj-ls      | 10 ++++++++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/hipamd/bin/roc-obj-extract b/hipamd/bin/roc-obj-extract
+index 9420a4b..9ecaac7 100755
+--- a/hipamd/bin/roc-obj-extract
++++ b/hipamd/bin/roc-obj-extract
+@@ -41,6 +41,16 @@ my $verbose=0;
+ my $error=0;
+ my $output_to_stdout=0;
+ 
++$Getopt::Std::STANDARD_HELP_VERSION = 1;
++
++sub HELP_MESSAGE {
++  usage();
++}
++
++sub VERSION_MESSAGE {
++  print("roc-obj-extract " . `hipconfig --version` . "\n");
++}
++
+ sub usage {
+   print("Usage: $0 [-o|v|h] URI... \n");
+   print("  URIs can be read from STDIN, one per line.\n");
+diff --git a/hipamd/bin/roc-obj-ls b/hipamd/bin/roc-obj-ls
+index 7ce2019..94d38c0 100755
+--- a/hipamd/bin/roc-obj-ls
++++ b/hipamd/bin/roc-obj-ls
+@@ -29,6 +29,16 @@ use Getopt::Std;
+ use List::Util qw(max);
+ use URI::Encode;
+ 
++$Getopt::Std::STANDARD_HELP_VERSION = 1;
++
++sub HELP_MESSAGE {
++  usage();
++}
++
++sub VERSION_MESSAGE {
++  print("roc-obj-ls " . `hipconfig --version` . "\n");
++}
++
+ sub usage {
+   print("Usage: $0 [-v|h] executable...\n");
+   print("List the URIs of the code objects embedded in the specfied host executables.\n");
diff -Nru rocm-hipamd-5.7.1/debian/patches/0040-self-sufficient-bf16-header.patch rocm-hipamd-5.7.1/debian/patches/0040-self-sufficient-bf16-header.patch
--- rocm-hipamd-5.7.1/debian/patches/0040-self-sufficient-bf16-header.patch	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/patches/0040-self-sufficient-bf16-header.patch	2025-05-13 10:09:20.000000000 +0000
@@ -0,0 +1,29 @@
+From: Cordell Bloor <cgmb@slerp.xyz>
+Date: Fri, 18 Apr 2025 23:25:08 -0600
+Subject: self-sufficient bf16 header
+
+A program that just includes <hip/hip_bf16.h> and <hip/hip_runtime.h>
+will fail to compile without this fix, due to missing definitions
+when the vector types are defined.
+
+ROCm 6.4 upstream doesn't appear to have this problem, so I didn't
+forward the bug or the patch.
+
+Bug-Debian: https://bugs.debian.org/1099402
+Forwarded: not-needed
+---
+ hipamd/include/hip/amd_detail/amd_hip_bf16.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/hipamd/include/hip/amd_detail/amd_hip_bf16.h b/hipamd/include/hip/amd_detail/amd_hip_bf16.h
+index 3fb9b2d..50b8a18 100644
+--- a/hipamd/include/hip/amd_detail/amd_hip_bf16.h
++++ b/hipamd/include/hip/amd_detail/amd_hip_bf16.h
+@@ -85,6 +85,7 @@
+ #ifndef _HIP_INCLUDE_HIP_AMD_DETAIL_HIP_BF16_H_
+ #define _HIP_INCLUDE_HIP_AMD_DETAIL_HIP_BF16_H_
+ 
++#include "amd_hip_common.h"
+ #include "amd_hip_vector_types.h"  // float2 etc
+ #include "device_library_decls.h"  // ocml conversion functions
+ #include "math_fwd.h"              // ocml device functions
diff -Nru rocm-hipamd-5.7.1/debian/patches/series rocm-hipamd-5.7.1/debian/patches/series
--- rocm-hipamd-5.7.1/debian/patches/series	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/patches/series	2025-05-13 10:09:20.000000000 +0000
@@ -17,3 +17,6 @@
 0035-optional-device-libs-find-package.patch
 0036-fix-clangrt-check-for-c.patch
 0037-deduplicate-cmake-messages.patch
+0038-fix-FindHIP-search-for-HIP_CLANG_PATH.patch
+0039-fix-roc-obj-help.patch
+0040-self-sufficient-bf16-header.patch
diff -Nru rocm-hipamd-5.7.1/debian/roc-obj-extract.1 rocm-hipamd-5.7.1/debian/roc-obj-extract.1
--- rocm-hipamd-5.7.1/debian/roc-obj-extract.1	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/roc-obj-extract.1	2025-05-13 10:14:13.000000000 +0000
@@ -0,0 +1,25 @@
+.TH ROC-OBJ-EXTRACT "1" "April 2025" "roc-obj-extract 5.7.31921" "User Commands"
+.SH NAME
+roc-obj-extract \- ROCm code object extraction tool
+.SH SYNOPSIS
+.B roc-obj-extract
+[\fI\,-o|v|h\/\fR] \fI\,URI\/\fR...
+.SH DESCRIPTION
+roc-obj-extract copies code objects that are embedded within binaries and
+saves them to disk.
+.SH OPTIONS
+.TP
+\fB\-o\fR <path>
+Path for output. If "\-" specified, code object is printed to STDOUT.
+.TP
+\fB\-v\fR
+Verbose output to STDOUT.
+.TP
+\fB\-h\fR
+Show help message.
+.SH NOTES
+When specifying a URI in a shell command you will need to escape the '&' character in the range_specifier.
+If "size=" is not specified, the default is the remainder of the file from the given offset.
+.SH SEE ALSO
+.sp
+\fBroc-obj(1)\fP, \fBroc-obj-ls(1)\fP
diff -Nru rocm-hipamd-5.7.1/debian/roc-obj-ls.1 rocm-hipamd-5.7.1/debian/roc-obj-ls.1
--- rocm-hipamd-5.7.1/debian/roc-obj-ls.1	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/roc-obj-ls.1	2025-05-13 10:15:39.000000000 +0000
@@ -0,0 +1,15 @@
+.TH ROC-OBJ-LS "1" "April 2025" "roc-obj-ls 5.7.31921" "User Commands"
+.SH NAME
+roc-obj-ls \- ROCm code object query tool
+.SH SYNOPSIS
+.B roc-obj-ls
+[\fI\,-v|h\/\fR] \fI\,executable\/\fR...
+.SH DESCRIPTION
+List the URIs of the code objects embedded in the specfied host executables.
+.SH OPTIONS
+\fB\-v\fR      Verbose output (includes Entry ID)
+.TP
+\fB\-h\fR      Show help message
+.SH SEE ALSO
+.sp
+\fBroc-obj(1)\fP, \fBroc-obj-extract(1)\fP
diff -Nru rocm-hipamd-5.7.1/debian/roc-obj.1 rocm-hipamd-5.7.1/debian/roc-obj.1
--- rocm-hipamd-5.7.1/debian/roc-obj.1	1970-01-01 00:00:00.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/roc-obj.1	2025-05-13 10:15:38.000000000 +0000
@@ -0,0 +1,132 @@
+.TH ROC-OBJ "1" "April 2025" "roc-obj 5.7.31921" "User Commands"
+.SH NAME
+roc-obj \- ROCm code object extraction and scripting tool
+.SH SYNOPSIS
+.B roc-obj
+[\fI\,-h\/\fR] [\fI\,-t REGEXP\/\fR] [\fI\,-o OUTDIR\/\fR] [\fI\,-I REPLACE-STRING|-i\/\fR] [\fI\,-d\/\fR]
+EXECUTABLE... [: [SUFFIX COMMAND [ARGS...] ;]...]
+.SH DESCRIPTION
+.IP
+.PP
+Wrapper for roc\-obj\-ls and roc\-obj\-extract which extracts code objects
+embedded in each EXECUTABLE and optionally applies COMMANDs to them.
+.PP
+If the POSIX extended regular expression REGEXP is specified, only embedded
+code objects whose Target ID matches REGEXP are extracted; otherwise all
+code objects are extracted.
+.PP
+If the directory path OUTDIR is specified, it is created if it does not
+already exist, and the code objects are extracted into it; otherwise they
+are extracted into the current working directory.
+.PP
+The extracted files are named by appending a ":" followed by the Target ID
+of the extracted code object to the input filename EXECUTABLE they were
+extracted from.
+.PP
+If the list of EXECUTABLE arguments is terminated with ":" then after all
+selected files are successfully extracted, zero or more additional embedded
+command\-lines, separated by ";", are read from the command\-line starting
+after the ":". These must specify a SUFFIX used to name the output of the
+corresponding COMMAND, along with the COMMAND name and any ARGS to it.
+.PP
+Then each COMMAND is executed, as if by a POSIX "execvp" function, once for
+each embedded code object that was created in OUTDIR. (Note: Typically this
+means the user must ensure the commands are present in at least one
+directory of the "PATH" environment variable.) For each execution of
+COMMAND:
+.PP
+If REPLACE\-STRING is specified, all instances of REPLACE\-STRING in ARGS are
+replaced with the file path of the extracted code object before executing
+COMMAND.
+.PP
+The standard input is redirected from the extracted code object.
+.PP
+If SUFFIX is "\-" the standard output is not redirected. If SUFFIX is "!" the
+standard output is redirected to \fI\,/dev/null\/\fP. Otherwise, the standard output
+is redirected to files named by the file path of the extracted code object
+with SUFFIX appended.
+.PP
+.SH NOTES
+The executables roc\-obj\-ls, roc\-obj\-extract, and llvm\-objdump (in the
+case of disassembly requested using the \fB\-d\fR flag) are searched for in a
+unique way. A series of directories are searched, some conditionally, until
+a suitable executable is found. If all directories are searched without
+finding the executable, an error occurs. The first directory searched is the
+one containing the hard\-link to the roc\-obj being executed, known as the
+"base directory". Next, if the environment variable HIP_CLANG_PATH is set,
+it is searched; otherwise, the base directory path is appended with
+"../../llvm/bin" and it is searched. Finally, the PATH is searched as if by
+a POSIX "execvp" function.
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+print this help text and exit
+.TP
+\fB\-t\fR, \fB\-\-target\-id\fR
+only extract code objects from EXECUTABLE whose Target ID
+matches the POSIX extended regular expression REGEXP
+.TP
+\fB\-o\fR, \fB\-\-outdir\fR
+set the output directory, which is created if it
+does not exist
+.TP
+\fB\-I\fR, \fB\-\-replace\-string\fR
+replace all occurrences of the literal string
+REPLACE\-STRING in ARGS with the input filename
+.TP
+\fB\-i\fR, \fB\-\-replace\fR
+equivalent to \fB\-I\fR{}
+.TP
+\fB\-d\fR, \fB\-\-disassemble\fR
+diassemble extracted code objects; equivalent to
+: .s llvm\-objdump \fB\-d\fR \- ;
+.PP
+.SH EXAMPLES
+.PP
+Extract all code objects embedded in a.so:
+$ roc\-obj a.so
+.PP
+Extract all code objects embedded in a.so, b.so, and c.so:
+$ roc\-obj a.so b.so c.so
+.PP
+Extract all code objects embedded in a.so with "gfx9" in their Target ID:
+$ roc\-obj \fB\-t\fR gfx9 a.so
+.PP
+Extract all code objects embedded in a.so into output/ (creating it if needed):
+$ roc\-obj \fB\-o\fR output/ a.so
+.PP
+Extract all code objects embedded in a.so with "gfx9" in their Target ID
+into output/ (creating it if needed):
+$ roc\-obj \fB\-t\fR gfx9 \fB\-o\fR output/ a.so
+.PP
+Extract all code objects embedded in a.so, and then disassemble each of them
+to files ending with .s:
+$ roc\-obj \fB\-d\fR a.so
+.PP
+Extract all code objects embedded in a.so, and count the number of bytes in
+each, writing the results to files ending with .count:
+$ roc\-obj a.so : .count wc \fB\-c\fR
+.PP
+Extract all code objects embedded in a.so, and inspect their ELF headers
+using llvm\-readelf (which will not read from standard input), writing to
+files ending with .hdr:
+$ roc\-obj \fB\-I\fR'{}' a.so : .hdr llvm\-readelf \fB\-h\fR '{}'
+.PP
+Extract all code objects embedded in a.so, and then extract each of their
+\&.text sections using llvm\-objcopy (which won't read from standard input
+or write to standard output):
+$ roc\-obj \fB\-I\fR'{}' a.so : ! llvm\-objcopy \fB\-O\fR binary :only\-section=.text '{}' '{}.text'
+.PP
+Extract all code objects embedded in a.so, b.so, and c.so with target
+feature xnack disabled into directory out/. Then, for each:
+Write the size in bytes into a file ending with .count, and
+Write a textual description of the ELF headers to a file ending with .hdr, and
+Extract the .text section to a file ending with .text
+$ roc\-obj \fB\-I\fR'{}' \fB\-t\fR xnack\- \fB\-o\fR out/ a.so b.so c.so : \e
+.IP
+\&.count wc \fB\-c\fR \e;
+\&.hdr llvm\-readelf \fB\-h\fR '{}' \e;
+! llvm\-objcopy \fB\-O\fR binary \fB\-\-only\-section=\fR.text '{}' '{}.text'
+.SH SEE ALSO
+.sp
+\fBroc-obj-ls(1)\fP, \fBroc-obj-extract(1)\fP
diff -Nru rocm-hipamd-5.7.1/debian/tests/control rocm-hipamd-5.7.1/debian/tests/control
--- rocm-hipamd-5.7.1/debian/tests/control	2025-04-12 10:51:52.000000000 +0000
+++ rocm-hipamd-5.7.1/debian/tests/control	2025-05-13 10:09:20.000000000 +0000
@@ -1,3 +1,3 @@
 Tests: clang, cmake-hip-config, cmake-hip-lang, g++, gcc, hipconfig, hipcc
 Depends: @, cmake, make, gcc, g++, rocminfo (>= 5.7.1~)
-Restrictions: superficial, skippable, allow-stderr
+Restrictions: superficial, skippable

Reply to: