[PATCH] D113359: [Libomptarget][WIP] Introduce VGPU Plugin

Atmn Patel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 6 19:41:10 PDT 2021


atmnpatel created this revision.
atmnpatel added reviewers: jdoerfert, tianshilei1992, JonChesterfield.
Herald added subscribers: ormris, dexonsmith, pengfei, hiraditya, mgorny.
atmnpatel requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, cfe-commits, sstefan1.
Herald added projects: clang, OpenMP, LLVM.

This patch introduces a virtual GPU (x86) plugin. This allows for the
emulation of the GPU environment on the host. This re-uses the same
execution model, compilation paths, runtimes as a physical GPU. The
number of threads, warps, and CTAs are set through the environment
variables `VGPU_{NUM_THREADS,NUM_WARPS,WARPS_PER_CTA}` respectively.

Known Bugs (hence WIP):

- In the rebase from LLVM 12, larger applications started segfaulting. Small programs still work with this patch.
- The virtual GPU should be able to execute kernels asynchronously using the streams - but there is an unknown lifetime issue around the `ffi_call` that prevents the removal of the await after the `scheduleAsync` call.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113359

Files:
  clang/lib/Basic/Targets/X86.h
  clang/lib/CodeGen/CGOpenMPRuntimeVirtualGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeVirtualGPU.h
  clang/lib/CodeGen/CMakeLists.txt
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Support/Triple.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
  openmp/CMakeLists.txt
  openmp/libomptarget/DeviceRTL/CMakeLists.txt
  openmp/libomptarget/DeviceRTL/include/Interface.h
  openmp/libomptarget/DeviceRTL/src/Kernel.cpp
  openmp/libomptarget/DeviceRTL/src/Mapping.cpp
  openmp/libomptarget/DeviceRTL/src/Misc.cpp
  openmp/libomptarget/DeviceRTL/src/Synchronization.cpp
  openmp/libomptarget/DeviceRTL/src/Utils.cpp
  openmp/libomptarget/include/DeviceEnvironment.h
  openmp/libomptarget/plugins/CMakeLists.txt
  openmp/libomptarget/plugins/vgpu/CMakeLists.txt
  openmp/libomptarget/plugins/vgpu/src/DeviceEnvironment.cpp
  openmp/libomptarget/plugins/vgpu/src/DeviceEnvironmentImpl.h
  openmp/libomptarget/plugins/vgpu/src/rtl.cpp
  openmp/libomptarget/src/rtl.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113359.385318.patch
Type: text/x-patch
Size: 64291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211107/498f81d2/attachment-0001.bin>


More information about the cfe-commits mailing list