This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Work around GFX11 flat scratch SVS swizzling bug
ClosedPublic

Authored by foad on Jun 13 2022, 5:39 AM.

Diff Detail

Event Timeline

foad created this revision.Jun 13 2022, 5:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2022, 5:39 AM
foad requested review of this revision.Jun 13 2022, 5:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2022, 5:39 AM
foad added reviewers: piotr, Restricted Project.Jun 13 2022, 5:40 AM

I note that this includes global isel changes - but none of the tests are testing it?

foad added a comment.Jun 13 2022, 6:00 AM

I note that this includes global isel changes - but none of the tests are testing it?

Well spotted. The problem is that it's difficult or impossible to persuade globalisel to use the svs addressing mode in the first place, because it assumes that frame offsets are divergent so doesn't put them in an sgpr for us. See AMDGPURegisterBankInfo.cpp:

case AMDGPU::G_FRAME_INDEX: {
  // TODO: This should be the same as other constants, but eliminateFrameIndex
  // currently assumes VALU uses.
  unsigned Size = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits();
  OpdsMapping[0] = AMDGPU::getValueMapping(AMDGPU::VGPRRegBankID, Size);
  break;
}

Well spotted. The problem is that it's difficult or impossible to persuade globalisel to use the svs addressing mode in the first place, because it assumes that frame offsets are divergent so doesn't put them in an sgpr for us. See AMDGPURegisterBankInfo.cpp:

Fair enough

This revision is now accepted and ready to land.Jun 13 2022, 12:39 PM
This revision was landed with ongoing or failed builds.Jun 13 2022, 1:03 PM
This revision was automatically updated to reflect the committed changes.