ballot
产 品 支 持 情 况
- Ascend 950PR/Ascend 950DT:支 持
- Atlas A3 训 练 系 列 产 品/Atlas A3 推 理 系 列 产 品:不 支 持
- Atlas A2 训 练 系 列 产 品/Atlas A2 推 理 系 列 产 品:不 支 持
- Atlas 200I/500 A2 推 理 产 品:不 支 持
- Atlas 推 理 系 列 产 品AI Core:不 支 持
- Atlas 推 理 系 列 产 品Vector Core:不 支 持
- Atlas 训 练 系 列 产 品:不 支 持
功 能 说 明
判 断thread_block_tile组 内 每 个 线 程 的 输 入 是 否 非 零。
函 数 原 型
C++
unsigned int ballot(int predicate) const
参 数 说 明
表 1 参 数 说 明
| 参 数 名 | 输 入/输 出 | 描 述 |
|---|---|---|
| predicate | 输 入 | 操 作 数。 |
返 回 值 说 明
32-bit的 无 符 号 整 数:若thread_block_tile组 内 线 程 输 入 的predicate不 为0,则 返 回 值 中 与 线 程rank对 应 的bit位 为1,否 则 为0。
约 束 说 明
无
调 用 示 例
SIMT编 程 场 景:
C++using namespace cooperative_groups; __global__ void simt_kernel(...) { ... thread_block block = this_thread_block(); auto tile4 = tiled_partition<4>(block); uint32_t result = tile4.ballot(1); // 返 回0xf ... }SIMD与SIMT混 合 编 程 场 景:
C++using namespace cooperative_groups; __simt_vf__ inline void simt_kernel(...) { ... thread_block block = this_thread_block(); auto tile4 = tiled_partition<4>(block); uint32_t result = tile4.ballot(1); // 返 回0xf ... }