[all-commits] [llvm/llvm-project] d9c64d: [OpenMP] Allow CUDA to be linked with OpenMP using...

Joseph Huber via All-commits all-commits at lists.llvm.org
Fri Apr 29 08:38:57 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9c64d33b98be695fc78a65624242033058ed117
      https://github.com/llvm/llvm-project/commit/d9c64d33b98be695fc78a65624242033058ed117
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-04-29 (Fri, 29 Apr 2022)

  Changed paths:
    M clang/test/Driver/linker-wrapper.c
    M clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

  Log Message:
  -----------
  [OpenMP] Allow CUDA to be linked with OpenMP using the new driver

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

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D120273




More information about the All-commits mailing list