質問

Warp voting functions can be invoked within a diverging branch and its effects are considered only among active threads. However, I am unsure how ballot works in that case? Are inactive threads always contributing 0? Or maybe the result is undefined?


Similar question: Do warp vote functions synchronize threads in the warp?

One answer quotes PTX ISA, which contains a sentence

In the ballot form, vote.ballot.b32 simply copies the predicate from each thread in a warp into the corresponding bit position of destination register d, where the bit position corresponds to the thread's lane id.

but it does not explain how inactive threads are treated.

役に立ちましたか?

解決

From the documentation:

For each of these warp vote operations, the result excludes threads that are inactive (e.g., due to warp divergence). Inactive threads are represented by 0 bits in the value returned by __ballot() and are not considered in the reductions performed by __all() and __any().

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top