[Openmp-commits] [openmp] b09953a - [Libomptarget] Fix AMDGPU Note handling after D150022

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Wed May 10 12:12:50 PDT 2023


Author: Joseph Huber
Date: 2023-05-10T14:12:39-05:00
New Revision: b09953a4a3ef70fdfb58503b3301d4441045c86b

URL: https://github.com/llvm/llvm-project/commit/b09953a4a3ef70fdfb58503b3301d4441045c86b
DIFF: https://github.com/llvm/llvm-project/commit/b09953a4a3ef70fdfb58503b3301d4441045c86b.diff

LOG: [Libomptarget] Fix AMDGPU Note handling after D150022

Summary:
The changes in https://reviews.llvm.org/D150022 changed the API for this
function that we query. Simply pass in the alignment from the associated
header to fix.

Added: 
    

Modified: 
    openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
    openmp/libomptarget/plugins/amdgpu/impl/system.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
index cdf1d10980e9a..ba2262a59b604 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
@@ -160,13 +160,13 @@ class KernelInfoReader {
 
   /// Process ELF note to read AMDGPU metadata from respective information
   /// fields.
-  Error processNote(const object::ELF64LE::Note &Note) {
+  Error processNote(const object::ELF64LE::Note &Note, size_t Align) {
     if (Note.getName() != "AMDGPU")
       return Error::success(); // We are not interested in other things
 
     assert(Note.getType() == ELF::NT_AMDGPU_METADATA &&
            "Parse AMDGPU MetaData");
-    auto Desc = Note.getDesc();
+    auto Desc = Note.getDesc(Align);
     StringRef MsgPackString =
         StringRef(reinterpret_cast<const char *>(Desc.data()), Desc.size());
     msgpack::Document MsgPackDoc;
@@ -313,7 +313,7 @@ Error readAMDGPUMetaDataFromImage(MemoryBufferRef MemBuffer,
       if (Err)
         return Err;
       // Fills the KernelInfoTabel entries in the reader
-      if ((Err = Reader.processNote(N)))
+      if ((Err = Reader.processNote(N, S.sh_addralign)))
         return Err;
     }
   }

diff  --git a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
index e8dba47b6cde0..a678bad55e2d1 100644
--- a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
@@ -197,7 +197,7 @@ findMetadata(const ELFObjectFile<ELF64LE> &ELFObj) {
       if (Note.getType() == NT_AMDGPU_METADATA && Note.getName() != "AMDGPU")
         return Failure;
 
-      ArrayRef<uint8_t> Desc = Note.getDesc();
+      ArrayRef<uint8_t> Desc = Note.getDesc(Phdr.p_align);
       return {Desc.data(), Desc.data() + Desc.size()};
     }
 


        


More information about the Openmp-commits mailing list