[PATCH] D139045: [HIP] use detected GPU in --offload-arch

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 30 19:29:13 PST 2022


yaxunl added a comment.

In D139045#3961931 <https://reviews.llvm.org/D139045#3961931>, @tra wrote:

>> This patch detects system GPU and use them in --offload-arch if not specified. If system GPU cannot be detected clang will fall back to gfx803.
>
> I don't think auto-probing is something we want to do by default.
>
> IMO, we should be following `-march=native` behavior here and check the available hardware variant only when the user requested it. Otherwise, the same compiler command line will produce different outputs, without the user requesting or even being aware of that.

I understand your point. However, when users use gcc or clang and do not specify target or CPU, the compiled program will execute on their system. This is because gcc or clang has a default target and CPU that works for the system. This is not the case for HIP since the default gfx803 will not work for the system unless the system happens to have a gfx803. To let the users have a similar experience with the default target/CPU as gcc/clang, HIP needs to assume the system GPU as the default. Users could specify --offload-arch explicitly if they want to compile for certain GPU's.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139045/new/

https://reviews.llvm.org/D139045



More information about the cfe-commits mailing list