RFC: /usr/bin/hipcxx for system default HIP compiler
I'd like to propose adding a symlink for the system HIP compiler at
/usr/bin/hipcxx that can be managed through the Debian Alternatives
system [1]. The purpose of this is twofold. First, it would provide a
constant name for the system HIP compiler so that packages are tools no
longer need to know which amdclang++ / clang++ / clang++-NN compiler is
used for building HIP programs on that particular version of Debian.
Second, it would allow for the possibility of supporting multiple
different HIP compilers (e.g., both upstream LLVM and the AMD fork).
This mechanism would be quite similar to the C, C++, and Fortran, where
the following compilers are available through the alternatives mechanism:
/usr/bin/cc
/usr/bin/c89
/usr/bin/c99
/usr/bin/c++
/usr/bin/f77
/usr/bin/f95
The HIP language compiler would fit right in as:
/usr/bin/hipcxx
This path avoids conflicts with the /usr/bin/hipcc wrapper script. The
hipcxx name is consistent with the HIPCXX environment variable used to
manually specify which clang++ compiler for CMake to use for the HIP
language [2]. If this name is chosen, I would contribute a patch to
CMake to add hipcxx to the list of compiler names considered when
enable_language(hip) is called.
At the moment, users and packagers need to manually specify the HIPCXX
environment variable to let CMake know the name of the clang++ compiler
to use for HIP. This is very confusing, because the name is different on
every release of Debian. Users currently must know to specify clang++-15
in Debian 12, clang++-17 in Debian 13, and soon something new in Debian
14. It would be nice to get enable_language(hip) to 'just work' and
thereby make it easier for folks to transition from using hipcc to using
the built-in support for HIP in CMake. A stable name for the system HIP
compiler would allow us to achieve that.
When CMake understands that it's building HIP code, there's a lot of
things that will become better for us in packaging HIP libraries and
applications. It then means that we can use mechanisms like HIPFLAGS set
globally in dpkg-buildflags for all HIP language packages, rather than
having to fuss with modifying CXXFLAGS when the CXX compiler is hipcc. I
believe this enhancement would help to make the HIP language a
first-class citizen within Debian tooling.
Sincerely,
Cory Bloor
[1]: https://wiki.debian.org/DebianAlternatives
[2]: https://cmake.org/cmake/help/v4.1/envvar/HIPCXX.html
Reply to: