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

Dominik Adamski via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 27 03:07:57 PDT 2024


================
@@ -333,6 +333,9 @@ void Flang::AddAMDGPUTargetArgs(const ArgList &Args,
     StringRef Val = A->getValue();
     CmdArgs.push_back(Args.MakeArgString("-mcode-object-version=" + Val));
   }
+
+  const ToolChain &TC = getToolChain();
+  TC.addClangTargetOptions(Args, CmdArgs, Action::OffloadKind::OFK_OpenMP);
----------------
DominikAdamski wrote:

No. My change does not imply any changes for Nvidia GPUs support.

Flang and Clang share the same LLVM backend which consumes generated LLVM IR. For AMD GPU we need to embed bitcode definitions of GPU math functions. AMD toolchain adds all required options to the compiler invocation for AMD GPU and IMO can be reused between Flang and Clang.

I don't know if Nvidia also want to reuse their toolchain between Clang and Flang to fully support OpenMP offloading.

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


More information about the cfe-commits mailing list