SPA 5.0:
{@{!}Pg}
KIL
{CC.test}
{&req_6}
{?sched>=?WAIT5}
;
.test: { .F, .LT, .EQ, .LE, .GT, .NE, .GE, .NUM, Signed numeric tests
.NAN, .LTU, .EQU, .LEU, .GTU, .NEU, .GEU, .T, Signed or Unordered tests
.OFF, .LO, .SFF, .LS, .HI, .SFT, .HS, .OFT, Unsigned integer tests
.CSM_TA, .CSM_TR, .CSM_MX, .FCSM_TA, .FCSM_TR, .FCSM_MX, .RLE, .RGT } Clip State Machine tests
Kill the pixel shader program. If KIL condition is TRUE for thread, final color and Z output is suppressed.
Killed threads may continue execution on the processor to provide fully covered quads, even though their final pixel output will be ignored. This can be significant if killed threads perform conditional branches or memory operations that affect the performance or correctness of other non-killed threads.
Killed threads are prevented from executing ST instructions. Once a thread has been killed, it is no longer allowed to write global memory. However, the HW takes no action to rollback previous global stores (so a thread that is eventually killed could impact the final images before the KIL instruction is executed). Care should be taken by the compiler's optimizer when relocating KIL instructions
While threads that have been killed often have to continue running to participate in texture LOD calculations on a quad-thread basis, there is no other reason to keep them active (since they cannot otherwise change the outputs of a pixel shader). To take advantage of this fact, HW employs a zombie-optimization. This optimization watches for threads that have been killed but are still running (creatively named zombie-threads). If it notices an entire quad of threads in this state, it will move them into an exited state (to stop them running).
This optimization could save some lane power, and also might allow the warp to exit earlier or spend less time in divergent code paths that killed threads are trying to execute. This means that if the zombie optimization is enabled, the KIL instruction can trigger a stack-unwind. When used inside the trap handler, the zombie-optimization is disabled. Entire quads that are cleared will not be placed in the exit state until a KIL instruction in normal user code is executed.
Note: When some threads in a quad have executed KIL while all remaining threads in the quad have already finished through EXIT, the zombie optimization may still apply. This corner case affects virtually no real applications.
KIL CC.LT;