gpt4 book ai didi

c++ - CUDA 中的非事件线程与断言线程

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:10:14 30 4
gpt4 key购买 nike

我正在使用 Visual Profiler 6.0 分析我的 CUDA 内核,几乎每一行都有一个栏显示非事件线程Predicated off threads的百分比。

我想知道这两个值到底是什么意思,它们有多“坏”?

据我所知,Inactive threads(以红色显示)是发散的非事件线程(由于某些 if 语句)和 Predicated off threads(以蓝色显示)被编译器正确预测为不活动。对吗?

如果那是真的,我不明白为什么我的内核中的以下一堆行有 95% 的非事件线程,唯一的 ifs 是循环:

Inactive threads print-screen

TFloatfloatdouble 类型的模板。是什么导致那里的线程不活动?

我正在使用 CUDA 6.0,代码在计算能力为 3.5 的 Tesla K40c 上运行。

最佳答案

来自following link :

There are two reasons threads within a warp can be disabled: being inactive, and being predicated off. If the block size is not a multiple of the warp size, the last warp in the block will have inactive threads. When some threads within a warp exit the kernel while others continue, the exiting threads become inactive. Threads become predicated off when divergent branches occur, because the separate paths taken by the threads must be serialized, and threads are disabled for paths they do not take.

所以看起来您的 dimensionsCount 在大多数线程上为零(或接近),并且它们在其他一些线程仍在计算之前退出。

另一方面,当实际分支条件被击中时,“predicated off”可能会被记录——一些线程跳转到退出(但仍然活跃!),其他线程跳转到循环。快照右侧的 SASS 代码也表明了这一点:唯一的蓝色条出现在 BRA 指令处。

关于c++ - CUDA 中的非事件线程与断言线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23283625/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com