[Openmp-commits] [PATCH] D155886: [OpenMP][Plugin] Update the global address calculation

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Jul 23 14:18:19 PDT 2023


tianshilei1992 updated this revision to Diff 543330.
tianshilei1992 added a comment.
Herald added subscribers: kerbowa, jvesely.

remove the overloaded AMDGPU version


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155886

Files:
  openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp


Index: openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp
===================================================================
--- openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp
+++ openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp
@@ -53,8 +53,8 @@
 
   // The global's address is computed as the image begin + the ELF section
   // offset + the ELF symbol value.
-  ImageGlobal.setPtr(
-      advanceVoidPtr(Image.getStart(), Section.sh_offset + Symbol.st_value));
+  ImageGlobal.setPtr(advanceVoidPtr(
+      Image.getStart(), Section.sh_offset - Section.sh_addr + Symbol.st_value));
 
   // Set the global's size.
   ImageGlobal.setSize(Symbol.st_size);
Index: openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -2583,22 +2583,6 @@
     // Store the symbol address on the device global metadata.
     DeviceGlobal.setPtr(reinterpret_cast<void *>(SymbolAddr));
 
-    return Plugin::success();
-  }
-
-private:
-  /// Extract the global's information from the ELF image, section, and symbol.
-  Error getGlobalMetadataFromELF(const DeviceImageTy &Image,
-                                 const ELF64LE::Sym &Symbol,
-                                 const ELF64LE::Shdr &Section,
-                                 GlobalTy &ImageGlobal) override {
-    // The global's address in AMDGPU is computed as the image begin + the ELF
-    // symbol value. Notice we do not add the ELF section offset.
-    ImageGlobal.setPtr(advanceVoidPtr(Image.getStart(), Symbol.st_value));
-
-    // Set the global's size.
-    ImageGlobal.setSize(Symbol.st_size);
-
     return Plugin::success();
   }
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155886.543330.patch
Type: text/x-patch
Size: 1866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230723/586929f8/attachment.bin>


More information about the Openmp-commits mailing list