9.7.15.10. Parallel Synchronization and Communication Instructions: vote.sync
vote.sync
Vote across thread group.
Syntax
vote.sync.mode.pred d, {!}a, membermask;
vote.sync.ballot.b32 d, {!}a, membermask; // 'ballot' form, returns bitmask
.mode = { .all, .any, .uni };Description
vote.sync will cause executing thread to wait until all non-exited threads corresponding to membermask have executed vote.sync with the same qualifiers and same membermask value before resuming execution.
Operand membermask specifies a 32-bit integer which is a mask indicating threads participating in this instruction where the bit position corresponds to thread's laneid. Operand a is a predicate register.
In the mode form, vote.sync performs a reduction of the source predicate across all non-exited threads in membermask. The destination operand d is a predicate register and its value is the same across all threads in membermask.
The reduction modes are:
.all
True if source predicate is True for all non-exited threads in membermask. Negate the source predicate to compute .none.
.any
True if source predicate is True for some thread in membermask. Negate the source predicate to compute .not_all.
.uni
True if source predicate has the same value in all non-exited threads in membermask. Negating the source predicate also computes .uni.
In the ballot form, the destination operand d is a .b32 register. In this form, vote.sync.ballot.b32 simply copies the predicate from each thread in membermask into the corresponding bit position of destination register d, where the bit position corresponds to the thread's lane id.
A thread not specified in membermask will contribute a 0 for its entry in vote.sync.ballot.b32.
The behavior of vote.sync is undefined if the executing thread is not in the membermask.
Note: For
.targetsm_6xor below, all threads inmembermaskmust execute the samevote.syncinstruction in convergence, and only threads belonging to somemembermaskcan be active when thevote.syncinstruction is executed. Otherwise, the behavior is undefined.
PTX ISA Notes
Introduced in PTX ISA version 6.0.
Target ISA Notes
Requires sm_30 or higher.
Examples
vote.sync.all.pred p,q,0xffffffff;
vote.sync.ballot.b32 r1,p,0xffffffff; // get 'ballot' across warp