This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][Libomptarget] Move allow_access_to_all_gpu_agents to rtl.cpp
ClosedPublic

Authored by pdhaliwal on Jun 21 2021, 11:27 PM.

Details

Diff Detail

Event Timeline

pdhaliwal created this revision.Jun 21 2021, 11:27 PM
pdhaliwal requested review of this revision.Jun 21 2021, 11:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2021, 11:27 PM

Moving the function is good, nice that we don't have to re-assemble the list of agents. The change to Malloc is (probably, I haven't checked all the call sites) correct but will make it easy to forget the register call in a later change, so I think we want to route all calls through HostMalloc and DeviceMalloc and make Runtime::Malloc harder to call by accident, e.g. scope it to the file and rename it MallocImpl or similar

openmp/libomptarget/plugins/amdgpu/impl/data.cpp
66

it's not obvious this is dead - if Runtime::Malloc is called with DEVTYPE_CPU, but not from HostMalloc (where the follow on handling is added), then we miss the allow_access call. Can this Runtime::Malloc be made local to this TU, so that we can't accidentally call it instead of one of the DeviceMalloc or HostMalloc wrappers?

openmp/libomptarget/plugins/amdgpu/impl/system.cpp
940

this was dead because it passes DEVTYPE_GPU which register_allocation ignores

pdhaliwal added inline comments.Jun 22 2021, 4:16 AM
openmp/libomptarget/plugins/amdgpu/impl/data.cpp
66

Malloc is already declared inside Runtime class as private static method.

JonChesterfield accepted this revision.Jun 22 2021, 4:21 AM

Ah yes, so it is. Not sure we're getting much value from the static member functions in rt.h, relative to the free functions found elsewhere, but that's unrelated to this change.

This revision is now accepted and ready to land.Jun 22 2021, 4:21 AM
This revision was landed with ongoing or failed builds.Jun 22 2021, 4:45 AM
This revision was automatically updated to reflect the committed changes.