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

Bug#1065439: dpkg-buildflags: add HIPFLAGS to supported flags



Package: dpkg-dev
Version: 1.22.5
Severity: wishlist
X-Debbugs-Cc: cgmb@slerp.xyz, debian-ai@lists.debian.org

Dear Maintainer,

When packaging the AMD ROCm GPU libraries for Debian, we are currently
using CXX=hipcc or CXX=clang++ to build libraries written in HIP as if
they were written in C++.

This necessitates filtering out flags that are not supported when
building HIP language code. For example, the rocsparse d/rules include:

    export CXX=hipcc
    export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-fortify optimize=-lto

    # filter incompatible options from affecting device code
    CXXFLAGS := $(subst -fstack-protector-strong,-Xarch_host -fstack-protector-strong,$(CXXFLAGS))
    CXXFLAGS := $(subst -fcf-protection,-Xarch_host -fcf-protection,$(CXXFLAGS))

In the lines above, we are prepending `-Xarch_host` to prevent certain
flags from being applied to device code (i.e., GPU code) while still
ensuring that they are applied to host code (i.e., CPU code).

However, there is HIP language support in CMake. We should use it!
dpkg-buildflags should set HIPFLAGS [1]. The CXXFLAGS make a good
starting place for the HIPFLAGS values, but `-Xarch_host` should be
added to `-fstack-protector-strong` and `-fcf-protection`, like in the
example above.

Sincerely,
Cory Bloor

[1]: https://cmake.org/cmake/help/v3.28/envvar/HIPFLAGS.html

-- Package-specific info:

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.6.15-amd64 (SMP w/32 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages dpkg-dev depends on:
ii  binutils      2.42-3
ii  bzip2         1.0.8-5+b2
ii  libdpkg-perl  1.22.5
ii  make          4.3-4.1
ii  patch         2.7.6-7
ii  perl          5.38.2-3
ii  tar           1.35+dfsg-3
ii  xz-utils      5.6.0-0.1

Versions of packages dpkg-dev recommends:
ii  build-essential          12.10
ii  clang-17 [c-compiler]    1:17.0.6-5
ii  fakeroot                 1.33-1
ii  gcc [c-compiler]         4:13.2.0-7
ii  gcc-13 [c-compiler]      13.2.0-16.1
ii  gnupg                    2.2.40-1.1
ii  gpgv                     2.2.40-1.1+b1
ii  libalgorithm-merge-perl  0.08-5

Versions of packages dpkg-dev suggests:
ii  debian-keyring  2023.12.24

-- no debconf information


Reply to: