[PATCH] D96248: [OpenMP][AMDGPU] Add support for linking libomptarget bitcode

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 23:48:24 PST 2021


JonChesterfield added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp:193
   CC1Args.push_back("-emit-llvm-bc");
+
+  std::string BitcodeSuffix = "amdgcn-" + GpuArch.str();
----------------
tianshilei1992 wrote:
> JonChesterfield wrote:
> > Need `if (DriverArgs.hasArg(options::OPT_nogpulib)) return;` here or we can't build the deviceRTL without already having one on disk
> FWIW, NVPTX `deviceRTLs` is built by directly calling FE, not via clang driver. `clang -fopenmp -fopenmp-targets=xxx` basically consists of two passes, and therefore generates two IRs, which is not what we expect. I'm not sure we really need the if statement.
That explains what I was missing about the ptx cmake I think. I've had to locally hack around clang creating a bundle, which llvm-link chokes on, because cuda-device-only et al are ignored by openmp.

I think this check is right - it means nogpulib will exclude the rtl on both GPUs. Nvptx already has it in the control flow.

Whether RTL cmake should bypass the driver is interesting, but I think separate to this patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96248/new/

https://reviews.llvm.org/D96248



More information about the cfe-commits mailing list