Page MenuHomePhabricator

Preserve param alignment in NVPTXLowerArgs pass.
ClosedPublic

Authored by jlebar on Oct 14 2020, 9:59 AM.

Details

Summary

Preserve param alignment in NVPTXLowerArgs pass.

NVPTXLowerArgs works as follows.

  • Create a regular alloca with alignment identical to arg.
  • Copy arg from param space (and ASC'ing it from generic AS first) to the alloca (it's still in generic AS).
  • Replace loads of arg with loads of alloca.

The bug here is that we did not preserve the arg's alignment when
loading from the alloca.

The impact of this bug is that sometimes param loads would be lowered as
a series of u8 loads, because we're incorrectly assuming everything has
alignment 1.

Diff Detail

Event Timeline

jlebar created this revision.Oct 14 2020, 9:59 AM
jlebar requested review of this revision.Oct 14 2020, 9:59 AM
tra accepted this revision.Oct 14 2020, 10:32 AM

NVPTXLowerArgs takes a load of an argument and converts it to

make alloca with appropriate alignment.
store into alloca
addrspacecast to param address space
load from alloca in param addrspace

It does not quite match what we do here.
It's more of a

  • create a regular alloca with alignment identical to arg
  • RAU Arg->Alloca
  • copy Arg from param space (and ASC'ing it from generic AS first) to the alloca (it's still in generic AS)

That said, the change itself appears to be correct.

This revision is now accepted and ready to land.Oct 14 2020, 10:32 AM

It does not quite match what we do here.

Fixed, thanks.

Thanks for the quick review, Art.

jlebar updated this revision to Diff 298195.Oct 14 2020, 11:09 AM

Fix bug in test command line, and fix commit message.

jlebar edited the summary of this revision. (Show Details)Oct 14 2020, 11:10 AM
This revision was landed with ongoing or failed builds.Oct 14 2020, 11:15 AM
This revision was automatically updated to reflect the committed changes.