[flang-commits] [clang] [flang] [Flang-new][OpenMP] Add offload related flags for AMDGPU (PR #96742)

Andrzej WarzyƄski via flang-commits flang-commits at lists.llvm.org
Thu Jun 27 03:37:41 PDT 2024


banach-space wrote:

> Clang for AMDGPU supports OpenMP and [HIP](https://clang.llvm.org/docs/HIPSupport.html) and it reuses the same code. For example `-fcuda-is-device` flag needs to be checked for [legacy HIP host code](https://github.com/llvm/llvm-project/blob/2033b1cf16f040e1369d8efba8439dcd3e36ed31/clang/lib/Basic/Targets/AMDGPU.cpp#L278). 

Thanks! I'm still puzzled though:

> In the future it will be needed for Flang equivalent functions: AMDGPUTargetCodeGenInfo::getGlobalVarAddressSpace AMDGPUTargetInfo::getTargetDefines

Why would `-fcuda-is-device` be required? From your link I gather that the AMD logic in Clang simply makes sure that `-fcuda-is-device` wasn't used?

> I would like to reuse the same part of the AMD GPU toolchain for Flang.

That would be great - what's the plan here then? Simply to rely on the code in Clang? Also, note that that's `TargetInfo` (which lives in `clangBasic`) rather than `Toolchain` (that lives in `clangDriver`). This is actually key because it makes the coupling between Flang and Clang even stronger. 

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


More information about the flang-commits mailing list