This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Clarify calling conv about inactive lanes
ClosedPublic

Authored by sebastian-ne on Jan 28 2021, 6:05 AM.

Details

Summary

So far, it was not specified what happens with the VGPRs of inactive
lanes when functions are called. This patch explicitely mentions that
the VGPR values of inactive lanes need to be preserved for all
registers.

This describes the current behavior, as only active lanes of registers
are saved to scratch. Also, as the multi-lane nature of VGPRs is not
properly modeled, we cannot determine the live VGPRs from inactive lanes
at calls. So we cannot save them, even if we intended to do so.

Diff Detail

Event Timeline

sebastian-ne created this revision.Jan 28 2021, 6:05 AM
sebastian-ne requested review of this revision.Jan 28 2021, 6:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2021, 6:05 AM
arsenm accepted this revision.Jan 28 2021, 6:29 AM
This revision is now accepted and ready to land.Jan 28 2021, 6:29 AM
t-tye requested changes to this revision.Jan 28 2021, 10:42 AM
t-tye added inline comments.
llvm/docs/AMDGPUUsage.rst
8242–8264

Suggest re-wording to:

` 
    * VGPR40-47
    * VGPR56-63
    * VGPR72-79
    * VGPR88-95
    * VGPR104-111
    * VGPR120-127
    * VGPR136-143
    * VGPR152-159
    * VGPR168-175
    * VGPR184-191
    * VGPR200-207
    * VGPR216-223
    * VGPR232-239
    * VGPR248-255

       .. note::

          Except the argument registers, the VGPR clobbered and the
          preserved registers are intermixed at regular intervals in
          order to keep a similar ratio independent of the number of
          allocated VGPRs.

    * Lanes of all VGPRs that are inactive at the call site.
`
8257–8263

... keep a similar ratio independent of the number of allocated VGPRs.

This revision now requires changes to proceed.Jan 28 2021, 10:42 AM

Reword as suggested

Reword as suggested

I only saw part of the rewording incorporated. Was that intentional? The suggested text would replace the entire VGPR parts.

I missed the change in the VGPRs, it’s also included now.

t-tye added inline comments.Feb 1 2021, 8:15 AM
llvm/docs/AMDGPUUsage.rst
8275

the number of

t-tye accepted this revision.Feb 1 2021, 9:41 AM

LGTM Thanks.

This revision is now accepted and ready to land.Feb 1 2021, 9:41 AM
madhur13490 added inline comments.Feb 1 2021, 9:56 AM
llvm/docs/AMDGPUUsage.rst
8277

I am confused by the wording "Lanes of all VGPRs". The word "lane" is used in the context of workitems and not VGPRs. Do you mean to say - "All VGPRs of inactive lanes at the call site"?

t-tye added inline comments.Feb 1 2021, 10:08 AM
llvm/docs/AMDGPUUsage.rst
8277

One view of VGPRs is that that comprises a separate dword for each lane. This sentence is stating that the VGPR lanes corresponding to inactive lanes must be preserved.

This revision was landed with ongoing or failed builds.Feb 2 2021, 1:15 AM
This revision was automatically updated to reflect the committed changes.