[clang-tools-extra] [libc] [llvm] [compiler-rt] [lld] [libcxx] [lldb] [flang] [clang] [NVPTX] Add support for -march=native in standalone NVPTX (PR #79373)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 11:39:46 PST 2024


Artem-B wrote:

> This is what we already do for `--offload-arch=native` on CUDA, but this is somewhat tangential. I've updated this patch to present the warning in the case of multiply GPUs being detected, so I don't think there's a concern here with the user being confused. If they have two GPUs, the warning will tell them which one it's using with the correct `sm_` value to specify it manually if they so wish. 

User confusion is only part of the issue here. With any single GPU choice we would still potentially produce a nonworking binary, if our GPU choice does not match what the user wants.

"all GPUs" has the advantage of always producing the binary that's guaranteed to work. Granted, in the case of multiple GPUs it comes with the compilation time overhead, but I think it's a better trade-off than compiling faster, but not working. If the overhead is unacceptable, *then* we can tweak the build, but in that case, the user may as well just specify the desired architectures explicitly.

> If there is only one GPU on the system, it should be obvious that it's going to be targeted.
This case works the same with either approach.


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


More information about the cfe-commits mailing list