[Openmp-commits] [PATCH] D142819: [OpenMP][NVPTX] Added `__tgt_rtl_launch_kernel` in old CUDA plugin

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Jan 28 15:40:50 PST 2023


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, ye-luo.
Herald added subscribers: mattd, gchakrabarti, asavonic, guansong, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Fix #60248.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142819

Files:
  openmp/libomptarget/plugins/cuda/src/rtl.cpp


Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -1901,6 +1901,21 @@
   return DeviceRTL.initDeviceInfo(DeviceId, DeviceInfoPtr, ErrStr);
 }
 
+int32_t __tgt_rtl_launch_kernel(int32_t DeviceId, void *TgtEntryPtr,
+                                void **TgtArgs, ptrdiff_t *TgtOffsets,
+                                KernelArgsTy *KernelArgs,
+                                __tgt_async_info *AsyncInfo) {
+  assert(DeviceRTL.isValidDeviceId(DeviceId) && "device_id is invalid");
+
+  if (DeviceRTL.setContext(DeviceId) != OFFLOAD_SUCCESS)
+    return OFFLOAD_FAIL;
+
+  return DeviceRTL.runTargetTeamRegion(
+      DeviceId, TgtEntryPtr, TgtArgs, TgtOffsets, KernelArgs->NumArgs,
+      KernelArgs->NumTeams[0], KernelArgs->ThreadLimit[0],
+      KernelArgs->Tripcount, AsyncInfo);
+}
+
 #ifdef __cplusplus
 }
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142819.493036.patch
Type: text/x-patch
Size: 993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230128/7c8c4123/attachment.bin>


More information about the Openmp-commits mailing list