[PATCH] D96980: [amdgpu] Revert agnostic SGPR spill.

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 4 01:18:23 PST 2021


rampitec added a comment.

In D96980#2602610 <https://reviews.llvm.org/D96980#2602610>, @sebastian-ne wrote:

> I think I found a way how exec can get zero before a restore (disclaimer: I’m not sure if that is valid code in any of the graphics APIs or if something similar can happen in compute. It should be valid LLVM IR, however).
> Imagine the following pseudocode:
>
>   function main() {
>     // exec = 0xff
>     if (<divergent condition>) {
>       // exec = 0xf0
>       foo();
>     }
>     // continue doing things
>   }
>   
>   function foo() {
>     // exec = 0xf0
>     <spill s0>
>   
>     // Kills all currently active lanes
>     // However, more lanes are active outside the call, so we can’t s_endpgm
>     llvm.amdgcn.kill(false);
>   
>     // exec = 0x00
>     // We still need to restore s0 (if it is a callee-save register)
>     <restore s0>
>   }

We don't use kills at compute side and I personally don't believe it can be legal under any high level labguage model to do so. There are things like throw and even abort, but those lead to immediate control transfer and backed by the HW.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96980



More information about the llvm-commits mailing list