This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][amdgpu] Mark alloc, free weak to facilitate local experimentation
ClosedPublic

Authored by JonChesterfield on May 14 2021, 7:46 AM.

Details

Summary

[libomptarget][amdgpu] Mark alloc, free weak to facilitate local experimentation

There are a lot of different ways we might implement the devicertl local alloc
and free functions. Via host, local buffers (stack or arena), specialising per
kernel etc. It is not yet clear what the right design is. This change makes the
alloc and free functions weak, so one can override them from local tests while
comparing options.

Not strictly necessary, as a comparable patch can be applied locally each time,
but would be convenient for out of tree dev. Plan would be to drop the weak
attribute at the same time as introducing a working allocator to trunk.

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.May 14 2021, 7:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 7:46 AM
tianshilei1992 accepted this revision.May 20 2021, 3:17 PM

The change itself looks good to me, but I'm just curious where you would expect to have a more definitive definition later, especially the two functions are so target specific.

openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.hip
55

unrelated change

This revision is now accepted and ready to land.May 20 2021, 3:17 PM

I'm expecting to have a few in flight locally while trying different designs. I don't expect this to be a long lasting patch.

There's some chance trunk will end up using a different allocator to rocm, at least temporarily, in which case this might make @ronlieb's merging slightly easier.

Longer term I'm hopeful that we can drop the heap allocation from the runtime entirely, but we'll still need malloc() for applications so local experimentation would not be wasted.

openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.hip
55

git-clang-format appears to ignore *.hip . Really should get around to renaming these