[PATCH] D87674: [AMDGPU] Insert waitcnt after returning from call

Marek Olšák via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 09:57:57 PDT 2020


mareko added a comment.

In D87674#2290419 <https://reviews.llvm.org/D87674#2290419>, @arsenm wrote:

> In D87674#2290418 <https://reviews.llvm.org/D87674#2290418>, @madhur13490 wrote:
>
>> In D87674#2290396 <https://reviews.llvm.org/D87674#2290396>, @mareko wrote:
>>
>>> Yes, this commit is incorrect. It completely breaks code linking in Mesa OpenGL. s_waitcnt is required at the end of all global functions that return values.
>>>
>>> Please revert. @nhaehnle
>>
>> I don't understand why would it fail. This patch just moves s_waitcnt to the caller so they would be executed anyway. I think I am missing something. It would be helpful to root cause if we can isolate to a small test case.
>
> Shader returns aren't real returns and the "caller" doesn't wait

That's right. There are no callers. Functions that return SGPRs and VGPRs don't jump anywhere. Instead, return means that another function will be appended at the shader binary level after the last instruction, consuming those SGPRs and VGPRs. The other function doesn't know that whether it was appended at the end of another shader binary, or whether it's the real beginning of the shader and the SGPRs and VGPRs were initialized by the register init machines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87674



More information about the llvm-commits mailing list