[clang] [HIP] change default offload archs (PR #139281)

Cory Bloor via cfe-commits cfe-commits at lists.llvm.org
Fri May 9 11:33:53 PDT 2025


https://github.com/cgmb commented:

Thanks @yxsamliu! To add a bit more context, this was my original email that raised the topic:

> I wonder if we should consider revisiting the decision to default clang to gfx906 [1]. I came across how that decision was made shortly after it was implemented, and at the time I thought it was silly not to default to `native`. The decision was made to change the default from gfx803 to gfx906 because the former wasn’t supported, but AMD dropped support for the latter shortly thereafter. Using the same criteria as that previous decision, we should be changing the default again to something newer.
> 
> However, the default of "some random GPU architecture that changes every few releases" is just plain bad. If a user tries to run a program that was built for gfx906 only because nothing else was specified, the most likely result will be that the program doesn’t work on their machine. I’m not sure what the current behaviour of the HIP Runtime is, but historically, running a program built for a different GPU than your own would result in a crash that might not even include an error message.
> 
> My workstations all have gfx906 GPUs, but this is arguably worse! It means that when I work on build scripts, if I make a mistake and fail to specify the target architecture somewhere, the built result will still work on my machine! This hides errors in my build scripts, which then become a problem when I share those scripts with others working on different hardware. Even for my own work, I wouldn’t want to depend on gfx906 being the default target. My scripts would all break when I update clang to some future version.
> 
> I would suggest that we should either (a) change the default GPU target to `native` and make the failure to detect the user’s GPU into a hard compiler error, or (b) change the default GPU target to SPIR-V so that it works on every machine.
> 
> [1]: https://discourse.llvm.org/t/rfc-let-clang-use-system-gpu-as-default-offload-arch-for-hip/66950/5

https://github.com/llvm/llvm-project/pull/139281


More information about the cfe-commits mailing list