[PATCH] D146829: [AMDGPU] Remove unnecessary waitcnts

Tony Tye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 09:57:47 PDT 2023


t-tye added a comment.

The waitcnt's serve two purposes. They notify that the result of the operation is available to the thread that requested it, and they ensure that the effect of the operation is visible to other threads before this thread continues to do other operations. This latter purpose is used to ensure the happens-before relationship in the memory model. So for example, if a VMEM release atomic is done at workgroup scope, should these operations be visible to other threads before the result that is store-released onto VMEM?

If these operations go down the LDS queues (even if they are not performed in the LDS itself), then there are 2 queues for the waves of a workgroup, but a single L1 <https://reviews.llvm.org/L1> shared by all waves of a workgroup for VMEM. So to ensure visibility to all waves in the workgroup the LDS operation must be waited to complete before starting the VMEM operation if there needs to be a happens-before relation. That waiting is achieved by the waitcnt on LGKM before executing the VMEM instruction.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146829/new/

https://reviews.llvm.org/D146829



More information about the llvm-commits mailing list