SPA 5.0:
{@{!}Pg}
B2R.BAR
Rd, #BarNameU4
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
{@{!}Pg}
B2R.WARP
Rd
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
mode: { .BAR*, .WARP, .RESULT }
{@{!}Pg}
B2R.RESULT
Rd{, Pd}
{&req_6}
{&rdN}
{&wrN}
{?sched}
;
B2R.BAR and B2R.WARP can be used to read out in-progress barrier state for context save. Use R2B to restore barrier state. B2R.BAR reads the state associated with Barrier specified by #BarNameU4 while B2R.WARP reads per-warp barrier state.
B2R.RESULT is used to read the result of BAR.RED, BAR.ARV, or BAR.SCAN.
B2R.BAR returns the barrier state BarrierState_t that contains counts associated with the given barrier. These counts will be for those threads that contributed to the barrier but did not stop (BAR.ARV/BAR.SCAN as opposed to BAR.SYNC/BAR.RED).
If the BarInUse field is 0, the rest of the values are 0.
Note: Behavior when mixed with execution of target barriers in the same region is UNPREDICTABLE.
B2R.WARP returns per warp barrier state which includes:
B2R.RESULT writes the previous barrier reduction result for that warp into a register and/or predicate. BAR.SYNC and BAR.RED generate barrier results upon barrier release. For boolean .RED operations, RedCntResult is 0xffff_ffff if .AND/.OR are true, and 0x0000_0000 otherwise. BAR.SCAN generates a barrier result upon barrier execution. BAR.ARV contributes to the reduction but does not return a result. The barrier result format is defined in the BAR instruction. B2R.RESULT returns the barrier result in the following format:
31:0 RedCntResult
B2R R5, 0; // R5 = Barrier[0]; B2R R0, 3; // R0 = Barrier[3];