[clang] [flang] [Flang][Driver] Enable gpulibc/nogpulibc options for Flang, which allows linking of GPU LIBC for the fortran and OpenMP runtime (PR #77135)

Andrzej WarzyƄski via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 7 06:53:36 PST 2024


banach-space wrote:

Thanks for the discussion!

> It defaults to on if it finds the `libc` wrapper headers in the `clang` resource directory, `lib/clang/18/include/llvm_libc_wrappers/llvm-libc-decls`. I'm assuming that Fortran doesn't have this?

It shouldn't, which means that the semantics of `-gpulibc` will be a bit different in Flang, right? That's something that could be tested.

> I'm not familiar with how Fortran handles stuff here. It's tested in the clang portion at least. The handling of this is in CommonArgs somewhere I believe. If Fortran shares that it should be inherited, so it's at least tested in the clang version so it might be fine.

Some bits in "CommonArgs" will be shared, but we do specialise for Flang in various places. Also, tests in Clang check the driver in the "Clang" mode - it would be good to verify this option in the "Flang" mode as well. There's [driver-help.f90](https://github.com/llvm/llvm-project/pull/77135/files#diff-4c4771b20e711ab7224825cfe3902f57465195797c39a29d8a59027360f6bf30), but it is not that helpful (it only makes sure that we don't pollute `flang-new -help` with options from Clang that are not supported).


> However, i am a little bit of a driver and build environment/system noob 

Not true, you've already landed a few patches :) 

> ill defer to everyone else's better judgement in this case!

Replicating the following would be sufficient: https://github.com/llvm/llvm-project/blob/main/clang/test/Driver/openmp-offload-gpu.c#L392.


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


More information about the cfe-commits mailing list