This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][True16] Support disassembling .h registers.
ClosedPublic

Authored by kosarev on Aug 2 2023, 1:53 PM.

Diff Detail

Event Timeline

kosarev created this revision.Aug 2 2023, 1:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 1:53 PM
kosarev requested review of this revision.Aug 2 2023, 1:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 1:53 PM

The encoding is a bit different from what we use downstream, because I don't like the idea of assigning the is-high flag to the LSB. This makes encodings that we get from getEncodingValue() for the non-16bit registers effectively incorrect and thus requiring additional treatment. Placing the flag in one of the MSBs feels like it extends the existing encoding conventions more naturally.

Joe_Nash requested changes to this revision.Aug 3 2023, 8:08 AM

The hi/lo bit was specifically chosen to be the LSB in the Register encoding so that subtracting registers creates a logical register range. This is used for True16 codegen support SIInsertWaitcnts, and likely elsewhere.
I do not think it is a good idea to introduce changes while upstreaming the feature because they cannot be tested against the codegen implementation downstream. There is not enough context for code inspection or test coverage upstream to support whether that bit layout change is a good idea.

This revision now requires changes to proceed.Aug 3 2023, 8:08 AM

The hi/lo bit was specifically chosen to be the LSB in the Register encoding so that subtracting registers creates a logical register range. This is used for True16 codegen support SIInsertWaitcnts, and likely elsewhere.

Why do SIInsertWaitcnts intervals need to represent individual 16-bit registers?

@Joe_Nash Joe, do you still request changes for this?

Joe_Nash accepted this revision.Aug 22 2023, 6:19 AM

After seeing the changes to SIInsertWaitcnts and testing this downstream, I think it will work fine.
LGTM

This revision is now accepted and ready to land.Aug 22 2023, 6:19 AM
rampitec added inline comments.Sep 19 2023, 11:00 AM
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
508–509

Why not to call TRI->getHWRegIndex(AMDGPU::getMCReg(Op.getReg(), *ST)) here and remove any dependency on the encoding?

llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop2.txt
70

Does it just break fake16 and these can be removed completely at this point?

kosarev added inline comments.Sep 21 2023, 3:00 AM
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
508–509

For these initial patches I would like to keep changes minimal and avoid any immediate reworks and refinements. We can always do that later (it's in my TODO list).

llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_vop2.txt
70

Well, it just exposes the current level of support for these instructions, and gives them some coverage. I believe we didn't break anything here.

rampitec accepted this revision.Sep 21 2023, 10:12 AM
This revision was landed with ongoing or failed builds.Sep 27 2023, 4:03 AM
This revision was automatically updated to reflect the committed changes.