This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][nfc] Group environment variables, drop accesses to DeviceInfo global
ClosedPublic

Authored by JonChesterfield on Jun 30 2021, 3:52 PM.

Details

Summary

[libomptarget][nfc] Group environment variables, drop accesses to DeviceInfo global

Folds some duplicates logic into a helper function, passes the new environment
struct into getLaunchVals which no longer reads the DeviceInfo global.

Implemented on top of D105237

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Jun 30 2021, 3:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2021, 3:52 PM
dhruvachak added inline comments.Jun 30 2021, 11:16 PM
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
1875–1876

Since we are cleaning up, let's use the same style for all parameters, e.g. CamelCase.

2099

Since we already computed num_groups within getLaunchVals, should we return that as well? Otherwise, we have duplicate computation of num_groups and they may go out of sync. Basically, the structure launchVals can have 3 fields including NumGroups.

JonChesterfield added inline comments.Jul 1 2021, 1:33 AM
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
1875–1876

The parameter rename is in D105237. Renaming the parameters will cause a lot of delta in the function body, making it much harder to review the semantic change, do I'd rather do the rename separately.

2099

It isn't used for anything aside from printing, and the printing will need to change if we start using a value that isn't a multiple of workgroup size anyway.

Adding a redundant third return field that is ~unused would make the function harder to test. Suggest changing the print statement if it's the division you'd like to remove.

JonChesterfield added inline comments.Jul 1 2021, 1:34 AM
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
2099

Oh, and this part is also in the smaller patch proposed before this one. I was hoping we could review the base first, then rebase this for better signal to noise. I can't remember how to build stacked diffs in phab

Rebased, suggest CamelCaseRename in a separate patch

dhruvachak accepted this revision.Jul 1 2021, 8:55 AM

Yes, I was concerned about the num_groups computation getting out of sync when the grid size is not a multiple of the num_threads. But I understand your response that we will have to change the print at that point anyways, so let's go ahead with this.

This revision is now accepted and ready to land.Jul 1 2021, 8:55 AM
This revision was landed with ongoing or failed builds.Jul 6 2021, 9:06 AM
This revision was automatically updated to reflect the committed changes.

Didn't proof read the commit message on landing, apologies