Skip to content

Commit

Permalink
[Libomptarget] Fix AMDGPU Note handling after D150022
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jhuber6 committed May 10, 2023
1 parent d878603 commit b09953a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion openmp/libomptarget/plugins/amdgpu/impl/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
}

Expand Down

0 comments on commit b09953a

Please sign in to comment.