[PATCH] D95313: [WIP] Move part of nvptx devicertl under clang

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 24 10:36:40 PST 2021


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, tianshilei1992.
Herald added subscribers: mgorny, jvesely.
JonChesterfield requested review of this revision.
Herald added subscribers: openmp-commits, cfe-commits, sstefan1.
Herald added projects: clang, OpenMP.

[WIP] Move part of nvptx devicertl under clang

Example of moving the devicertl functions that depend on cuda
version under clang, so they can be injected at application
build time.

The original idea was to use the intrinsic definitions from
__clang_cuda_intrinsics, but that header needs a lot of cuda
specific setup to compile and includes part of the cuda sdk.
It's therefore difficult to compile as openmp.

This implements the code in headers and will work for c++ with
openmp, but not necessarily for C as the inline functions may not
be instantiated. It will also be a problem for fortran openmp.

I'm inclined to do something broadly equivalent to this, but in
the library. It means clang would need to link against devicertl.bc
and against a small cuda version specific devicertl_tbd.bc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95313

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/openmp_wrappers/__clang_openmp_devicertl_cuda_ge90.h
  clang/lib/Headers/openmp_wrappers/__clang_openmp_devicertl_cuda_lt90.h
  openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
  openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.hip
  openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
  openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95313.318850.patch
Type: text/x-patch
Size: 11500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210124/d60965eb/attachment-0001.bin>


More information about the cfe-commits mailing list