[Openmp-commits] [PATCH] D123827: [libomptarget] [amdgpu] Hostcall offset check should consider implicit args

Dhruva Chakrabarti via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Apr 14 17:54:42 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7086a1db80e1: [libomptarget] [amdgpu] Hostcall offset check should consider implicit args (authored by dhruvachak).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123827/new/

https://reviews.llvm.org/D123827

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


Index: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -1240,6 +1240,8 @@
           return OFFLOAD_FAIL;
         }
 
+        DP("Implicit argument count: %d\n",
+           KernelInfoEntry.implicit_argument_count);
         if (KernelInfoEntry.implicit_argument_count >= 4) {
           // Initialise pointer for implicit_argument_count != 0 ABI
           // Guess that the right implicit argument is at offset 24 after
@@ -1247,8 +1249,10 @@
           // the offset from msgpack. Clang is not annotating it at present.
           uint64_t Offset =
               sizeof(void *) * (KernelInfoEntry.explicit_argument_count + 3);
-          if ((Offset + 8) > (ArgPool->kernarg_segment_size)) {
-            DP("Bad offset of hostcall, exceeds kernarg segment size\n");
+          if ((Offset + 8) > ArgPool->kernarg_size_including_implicit()) {
+            DP("Bad offset of hostcall: %lu, exceeds kernarg size w/ implicit "
+               "args: %d\n",
+               Offset + 8, ArgPool->kernarg_size_including_implicit());
           } else {
             memcpy(static_cast<char *>(kernarg) + Offset, &buffer, 8);
           }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123827.422989.patch
Type: text/x-patch
Size: 1310 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220415/f92d1309/attachment-0001.bin>


More information about the Openmp-commits mailing list