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

Shilei Tian via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 06:11:46 PST 2021


tianshilei1992 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp:193
   CC1Args.push_back("-emit-llvm-bc");
+
+  std::string BitcodeSuffix = "amdgcn-" + GpuArch.str();
----------------
JonChesterfield wrote:
> 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.
`cuda-device-only` is only for CUDA compilation. We don’t have an option to invoke device compilation only.


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