[PATCH] D120273: [OpenMP] Allow CUDA to be linked with OpenMP using the new driver

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 21 11:47:26 PST 2022


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield.
Herald added subscribers: guansong, yaxunl.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

After basic support for embedding and handling CUDA files was added to
the new driver, we should be able to call CUDA functions from OpenMP
code. This patch makes the necessary changes to successfuly link in CUDA
programs that were compiled using the new driver. With this patch it
should be possible to compile device-only CUDA code (no kernels) and
call it from OpenMP as follows:

  $ clang++ cuda.cu -fopenmp-new-driver -offload-arch=sm_70 -c
  $ clang++ openmp.cpp cuda.o -fopenmp-new-driver -fopenmp -fopenmp-targets=nvptx64 -Xopenmp-target=nvptx64 -march=sm_70

Currently this requires using a host variant to suppress the generation
of a CPU-side fallback call.

Depends on D120272 <https://reviews.llvm.org/D120272>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120273

Files:
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120273.410355.patch
Type: text/x-patch
Size: 4593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220221/4107f1e6/attachment.bin>


More information about the cfe-commits mailing list