[Openmp-commits] [PATCH] D102691: [AMDGPU][Libomptarget] Move KernelNameMap to function scope

Pushpinder Singh via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed May 19 00:52:12 PDT 2021


pdhaliwal updated this revision to Diff 346354.
pdhaliwal added a comment.

Removed KernelNameMap.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102691

Files:
  openmp/libomptarget/plugins/amdgpu/impl/system.cpp


Index: openmp/libomptarget/plugins/amdgpu/impl/system.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/impl/system.cpp
+++ openmp/libomptarget/plugins/amdgpu/impl/system.cpp
@@ -132,7 +132,6 @@
 
 std::vector<hsa_amd_memory_pool_t> atl_gpu_kernarg_pools;
 
-std::map<std::string, std::string> KernelNameMap;
 std::vector<std::map<std::string, atl_kernel_info_t>> KernelInfoTable;
 std::vector<std::map<std::string, atl_symbol_info_t>> SymbolInfoTable;
 
@@ -932,7 +931,6 @@
     // create a map from symbol to name
     DEBUG_PRINT("Kernel symbol %s; Name: %s; Size: %lu\n", symbolName.c_str(),
                 kernelName.c_str(), kernel_segment_size);
-    KernelNameMap[symbolName] = kernelName;
 
     bool hasHiddenArgs = false;
     if (kernel_segment_size > 0) {
@@ -1039,19 +1037,12 @@
     }
     name[name_length] = 0;
 
-    if (KernelNameMap.find(std::string(name)) == KernelNameMap.end()) {
-      // did not find kernel name in the kernel map; this can happen only
-      // if the ROCr API for getting symbol info (name) is different from
-      // the comgr method of getting symbol info
-      if (HSA_STATUS_ERROR_INVALID_CODE_OBJECT != HSA_STATUS_SUCCESS) {
-        printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__,
-               "Invalid kernel name",
-               get_error_string(HSA_STATUS_ERROR_INVALID_CODE_OBJECT));
-        exit(1);
-      }
-    }
     atl_kernel_info_t info;
-    std::string kernelName = KernelNameMap[std::string(name)];
+
+    // Kernel name can be derived from symbol by removing the .kd suffix
+    const std::string Suffix = ".kd";
+    std::string kernelName(name);
+    kernelName.erase(kernelName.end() - Suffix.length(), kernelName.end());
     // by now, the kernel info table should already have an entry
     // because the non-ROCr custom code object parsing is called before
     // iterating over the code object symbols using ROCr


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102691.346354.patch
Type: text/x-patch
Size: 1966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210519/e84eb946/attachment.bin>


More information about the Openmp-commits mailing list