This is an archive of the discontinued LLVM Phabricator instance.

[Libomptarget] Add basic support for dynamic shared memory on AMDGPU
ClosedPublic

Authored by jhuber6 on May 9 2022, 11:36 AM.

Details

Summary

This patchs adds the arguments necessary to allocate the size of the
dynamic shared memory via the LIBOMPTARGET_SHARED_MEMORY_SIZE
environment variable. This patch only allocates the memory, AMDGPU has a
limitation that shared memory can only be accessed from the kernel
directly. So this will currently only work with optimizations to inline
the accessor function.

Diff Detail

Event Timeline

jhuber6 created this revision.May 9 2022, 11:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 11:36 AM
Herald added subscribers: kerbowa, t-tye, tpr and 4 others. · View Herald Transcript
jhuber6 requested review of this revision.May 9 2022, 11:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 11:36 AM
jdoerfert added inline comments.May 18 2022, 7:04 AM
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
1189

+ KernelInfoEntry.group_segment_size;

Looks about as expected, modulo Johannes' comment above. Could we do the getenv call once, instead of per-launch? Somewhere in the massive class constructor perhaps.

openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
1189

Yep, need the sum. Possibly worth checking the stoi result is positive and < 64k or so.

jhuber6 updated this revision to Diff 433448.Jun 1 2022, 10:24 AM

Updating to use environment structure and append instead of write.

JonChesterfield accepted this revision.Jun 1 2022, 10:31 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 1 2022, 10:31 AM
This revision was landed with ongoing or failed builds.Jun 1 2022, 10:33 AM
This revision was automatically updated to reflect the committed changes.