Package: dpkg-dev
Version: 1.22.5
Severity: wishlist
X-Debbugs-Cc: cgmb@slerp.xyz, debian-ai@lists.debian.org
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.
[1]: https://cmake.org/cmake/help/v3.28/envvar/HIPFLAGS.html
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++.
I guess we should also add HIPCXX (defaulting to <host-triplet>-hipcc
and HIPCXX_FOR_BUILD (defaulting to <build-triplet>-hipcc when cross compiling, otherwise to hipcc) like with the other toolchains? An
apt-file query seems to indicate thee hipcc package provides no triplet-qualified toolchains? Which means automatic cross-compiling
is going to be painful given our current infrastructure.
If support for this is really missing from the looks of it, we can
always postpone adding the compiler tool variables for now until this
is implemented (we can still add the HIPFLAGS variables though). I'm
CCing the debian-cross list for further insight.
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).
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 163:29:03 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,057 |
Messages: | 6,416,510 |