This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Bit of code clean-up around collection of LDS globals which requires lowering
AbandonedPublic

Authored by hsmhsm on Apr 15 2021, 12:24 PM.

Details

Diff Detail

Event Timeline

hsmhsm created this revision.Apr 15 2021, 12:24 PM
hsmhsm requested review of this revision.Apr 15 2021, 12:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2021, 12:24 PM
hsmhsm updated this revision to Diff 337983.Apr 15 2021, 9:51 PM

Have made some cosmetic changes and added comments.

hsmhsm updated this revision to Diff 338042.Apr 16 2021, 2:51 AM

Have done further cosmetic changes.

Some comments inline.

If this corrects behaviour as described in the comment, it needs tests. I can't see a behaviour change in the diff.

If it's a non functional refactor, I think it makes the code substantially less legible than it was before. Especially dislike using multiple booleans for control flow.

llvm/lib/Target/AMDGPU/Utils/AMDGPULDSUtils.cpp
59

Changing from User to GlobalVariable seems reasonable in itself

61

Why all these booleans? They make the control flow more complicated, but after staring at it for a while, don't appear to do anything different to the 'continue' we had before.

68

Do you know of prior art for this style of commenting? In general I like comments to describe the 'why', and only the 'what' if the implementation is very complicated. I don't think llvm does much of the /* this code will do foo */ do_foo() style.

112

this comment is worse than the equivalent code immediately above since it refers to 3 instead of the named value

115

Moving the predicate (the long sequence of tests) into a separate function seems OK. Should be s/continue/return false/g

136

Changing from none of (use requires lowering) to if (can skip) seems ok, not sure if makes any difference

llvm/lib/Target/AMDGPU/Utils/AMDGPULDSUtils.h
25–26

I don't think these benefit from comments. Not sure what 'required' can mean in the context of getAlign. Perhaps the clearer thing to do is put the one line functions in the header directly

Some comments inline.

If this corrects behaviour as described in the comment, it needs tests. I can't see a behaviour change in the diff.

If it's a non functional refactor, I think it makes the code substantially less legible than it was before. Especially dislike using multiple booleans for control flow.

I am confused myself now. I am not able to recollect what was forced me to change the code here. When, I was working on the changes for D91516, there was some test it forced my to re-arrange the code as I did here. Anyhow, let's hold this patch for now, and come back to it, when D91516 necessitates it.

hsmhsm updated this revision to Diff 338106.Apr 16 2021, 7:26 AM

Fixed review comments by Jon - Removed all the new code changes, and have made a small cosmetic
changes to original code.

hsmhsm updated this revision to Diff 338108.Apr 16 2021, 7:29 AM

Removed redundant comments.

hsmhsm marked 7 inline comments as done.Apr 16 2021, 7:29 AM
hsmhsm retitled this revision from [AMDGPU] Strengthen the logic behind collection of LDS globals for lowering. to [AMDGPU] Bit of code clean-up around collection of LDS globals which requires lowering.Apr 16 2021, 7:35 AM
hsmhsm edited the summary of this revision. (Show Details)
hsmhsm abandoned this revision.Apr 18 2021, 8:27 PM

I will be abondaning this patch for now, since there is no much clarity about this patch at the moment. I will reopen a new patch when the need arises with much clarity and needed lit tests.