Currently, clang uses gfx803 as the offload arch for compiling HIP programs if not specified. This is not convenient for command line users as the compiled program will not work unless the system happens to have a gfx803 GPU. To compile a program for the current GPU on the system, users need to use some GPU detection tools and explicitly pass the --offload-arch option to clang.
One way to improve user experience is to let clang detect system GPUs and use them as default offload arch for HIP programs. A Phabricator review is opened: ⚙ D139045 [HIP] use detected GPU in --offload-arch
One concern is that this may cause dependence of clang’s behaviour on which GPU is available on a system. An alternative approach is to let clang detect GPU only if --offload-arch=auto or --offload-arch=native is specified.
I’d prefer an explicit --offload-arch=auto or =host. I still think the correct thing to do is have a separate tool that prints the command flags to use for the detected host devices the build system can choose to invoke.
Looks like most people prefer detecting system GPU under certain --offload-arch.
I will update the Phabricator review to let clang detect system GPU when --offload-arch=native is specified. The reason to use native is that -march=native is a well-known gcc option for a similar use case: