执行warp投票功能同步线程在warp? [英] Do warp vote functions synchronize threads in the warp?

查看:369
本文介绍了执行warp投票功能同步线程在warp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用CUDA warp投票函数(例如__ any()和__ all())同步线程?

Do CUDA warp vote functions, such as __any() and __all(), synchronize threads in the warp?

换句话说,是否有任何保证,warp内部的所有线程执行warp表函数之前的指令,特别是操作谓词的指令?

In other words, is there any guarantee that all threads inside the warp execute instructions preceding warp vote function, especially the instruction(s) that manipulate the predicate?

推荐答案

同步是隐式的,因为warp中的线程在lockstep中执行。 [*]

The synchronization is implicit, since threads within a warp execute in lockstep. [*]

依赖此行为的代码称为warp同步。

Code that relies on this behavior is known as "warp synchronous."

如果你认为条件代码会使线程在一个warp内遵循不同的执行路径,你有更多的了解CUDA硬件的工作原理。发散条件代码(即条件代码,其中条件对于某些线程为真,而对于其他线程不成立)导致warp内的某些线程被预测或分支同步栈禁用,但是每个线程仍然占据经线可用的32条车道之一。

[*] If you are thinking that conditional code will cause threads within a warp to follow different execution paths, you have more to learn about how CUDA hardware works. Divergent conditional code (i.e. conditional code where the condition is true for some threads but not for others) causes certain threads within the warp to be disabled (either by predication or the branch synchronization stack), but each thread still occupies one of the 32 lanes available in the warp.

这篇关于执行warp投票功能同步线程在warp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆