Page MenuHomePhabricator

[libomptarget] Implement get_device_num for amdgcn, nvptx
AcceptedPublic

Authored by JonChesterfield on Wed, Nov 18, 8:07 AM.

Details

Summary

[libomptarget] Implement get_device_num for amdgcn, nvptx

Adds a field to the existing environment struct which is used for debug_level.

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Wed, Nov 18, 8:07 AM
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
529–530

I forgot to remove the extra fields from this to match the deviceRTL in trunk when adding amdgpu/src/rtl.cpp. This brings them back in sync.

openmp/libomptarget/plugins/cuda/src/rtl.cpp
83

We have a dedicated header now, in "../../../deviceRTLs/common/device_environment.h".

Options:
1/ keep the copy & paste, plugins & deviceRTL are totally separate
2/ Include from the deviceRTL
3/ Move header to somewhere else, openmp/libomptarget/include looks reasonable

tianshilei1992 accepted this revision.Wed, Nov 18, 11:16 AM
tianshilei1992 added a subscriber: tianshilei1992.

Overall LGTM.

openmp/libomptarget/plugins/cuda/src/rtl.cpp
83

Option 3 sounds more reasonable. We might have data structures used by both device and host runtime.

This revision is now accepted and ready to land.Wed, Nov 18, 11:16 AM

Please also add test case(s) for this. However, it actually depends on the native runtime that which device should be 0, 1, etc., which is probably hard to determine in OpenMP.

Open to suggestions on testing. Calling it from a target region on amdgcn with multiple GPUs works. I don't have a cuda machine with multiple cards. A machine with one target returns 0 with or without this patch.

Do we have any runtime tests for openmp in tree? Would need a CI machine with GPUs

Open to suggestions on testing. Calling it from a target region on amdgcn with multiple GPUs works. I don't have a cuda machine with multiple cards. A machine with one target returns 0 with or without this patch.

Do we have any runtime tests for openmp in tree? Would need a CI machine with GPUs

I wrote a simple program to test this patch and it works as expected. Please add the test case into this patch.

  • Use header from include, add test case
Herald added a reviewer: bollu. · View Herald Transcript
Herald added a reviewer: andreadb. · View Herald Transcript
Herald added a reviewer: alexshap. · View Herald Transcript
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a reviewer: herhut. · View Herald Transcript
Herald added a reviewer: rriddle. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: MaskRay. · View Herald Transcript
Herald added a reviewer: jpienaar. · View Herald Transcript
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: silvas. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
This revision now requires review to proceed.Mon, Nov 23, 4:34 PM
JonChesterfield removed projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project.
This revision is now accepted and ready to land.Mon, Nov 23, 4:36 PM
Herald added a reviewer: andreadb. · View Herald Transcript
Herald added a reviewer: alexshap. · View Herald Transcript
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a reviewer: herhut. · View Herald Transcript
Herald added a reviewer: rriddle. · View Herald Transcript
Herald added a reviewer: MaskRay. · View Herald Transcript
Herald added a reviewer: jpienaar. · View Herald Transcript
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a reviewer: silvas. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
This revision now requires review to proceed.Mon, Nov 23, 4:36 PM
  • Use header from include, add test case
  • rebase
JonChesterfield removed projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project.
JonChesterfield removed a subscriber: JDevlieghere.
This revision is now accepted and ready to land.Mon, Nov 23, 4:38 PM

Apologies to the hundreds of reviewers who have just been spammed.

Today I learned that 'arc diff --update' is not relative to the patch one is updating, but is relative to master as exists on github. Also that phabricator will not let one delete some automatically added reviewers before fixing the diff.

This needs an implementation for x86_64 offloading or a change to the test to only run on nvptx. Intend to do the former.