This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Avoid offset register in MUBUF for direct stack object accesses
ClosedPublic

Authored by cdevadas on Oct 12 2020, 4:37 AM.

Details

Summary

We use an absolute address for stack objects and
it would be necessary to have a constant 0 for soffset field.

Diff Detail

Event Timeline

cdevadas created this revision.Oct 12 2020, 4:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2020, 4:37 AM
cdevadas requested review of this revision.Oct 12 2020, 4:37 AM

Should make corresponding globalisel change. I think there are some missing assert changes too that were checking the soffset

arsenm requested changes to this revision.Oct 12 2020, 7:45 AM
This revision now requires changes to proceed.Oct 12 2020, 7:45 AM

At global-isel, it has already been taken care of.
The asserts - the cases where it is expecting a register is specifically for sp relative accesses and won't cause a problem after this patch.

At global-isel, it has already been taken care of.
The asserts - the cases where it is expecting a register is specifically for sp relative accesses and won't cause a problem after this patch.

It's not:

[=](MachineInstrBuilder &MIB) { // soffset
  // If we don't know this private access is a local stack object, it
  // needs to be relative to the entry point's scratch wave offset.
  // TODO: Should split large offsets that don't fit like above.
  // TODO: Don't use scratch wave offset just because the offset
  // didn't fit.
  if (!Info->isEntryFunction() && FI.hasValue())
    MIB.addReg(Info->getStackPtrOffsetReg());
  else
    MIB.addImm(0);
},
arsenm added inline comments.Oct 13 2020, 7:20 AM
llvm/test/CodeGen/AMDGPU/stack-pointer-offset-relative-frameindex.ll
43–46 ↗(On Diff #297559)

This is worse. Why did this break the local stack offset optimization?

This should also remove my recent change to SIRegisterInfo::resolveFrameIndex and switch it to an assert

cdevadas updated this revision to Diff 299268.Oct 19 2020, 11:34 PM

Used the FI directly in MI if available during ISel. Fixed an unhandled case during eliminateFrameIndex.
Also fixed the assertions to make sure the soffset field is relevant.

arsenm accepted this revision.Oct 23 2020, 7:55 AM
This revision is now accepted and ready to land.Oct 23 2020, 7:55 AM
This revision was landed with ongoing or failed builds.Oct 25 2020, 10:58 PM
This revision was automatically updated to reflect the committed changes.