SPA 5.0:
RTT{.op}
{&req_6}
{?sched>=?WAIT5}
;
.op: {.POPCRS*, .TERMINATE, .FALLTHROUGH}
.POPCRS Unwind the call return stack (default)
.TERMINATE Normal warp termination
.FALLTHROUGH Do not unwind the call return stack
RTT is designed to have a warp exit its trap handler. RTT is a synchronizing operation (all warps in the SM must either reach a RTT instruction or a BPT.PAUSE instruction before they are allowed to leave the trap handler and resume normal execution).
When RTT.POPCRS is executed, the stack will be unwound to restore the saved state. Active masks and disable masks found on the stack will be applied and any other stack tokens (divergence, sync, continue, etc.) will be ignored.
When RTT.FALLTHROUGH is executed, the stack will not be unwound. The current active mask and disable masks are maintained and program execution falls through to the next instruction.
RTT will clear the "Traps" bit (set via the BPT.TRAP instruction and read via S2R SR64 and S2R SR66).
RTT.TERMINATE causes normal warp termination. RTT.POPCRS is default behavior and does not cause warp termination.
Because the RTT.POPCRS and RTT.FALLTHROUGH instructions are synchronizing, they interact with synchronizing barriers instructions in the trap handler: In Kepler, a CTA that has executed a BAR.SYNCALL instruction in any of its warps must execute either a BAR.SYNCALL or a RTT.TERMINATE instruction in all its other warps. RTT.POPCRS and RTT.FALLTHROUGH, cannot be used with an active SYNCALL barrier without causing a deadlock in the SM. RTT.TERMINATE is non synchronizing operations and can be mixed with BAR.SYNCALL without deadlocking. However, since they modify barrier state, they need to be protected in the save.
RTT does not interact with user-mode barriers, since user-mode barriers are not active in trap mode.
After returning from the trap handler using RTT, there are several possible outcomes, depending on the state of the machine. They will occur with the following priority:
//Inside Trap Handler RTT; RTT.TERMINATE; RTT.POPCRS; RTT.FALLTHROUGH;