CANN/asc-devkit线程排名函数文档

CANN/asc-devkit线程排名函数文档 thread_rank【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品/Atlas A3 推理系列产品xAtlas A2 训练系列产品/Atlas A2 推理系列产品xAtlas 200I/500 A2 推理产品xAtlas 推理系列产品AI CorexAtlas 推理系列产品Vector CorexAtlas 训练系列产品x功能说明获取当前线程在所属的thread_block_tile组内的排名排名从0开始。函数原型unsigned long long thread_rank() const参数说明无返回值说明当前线程在所属的thread_block_tile组内的排名。约束说明无调用示例示例代码中以4个线程为一组划分线程块各线程在所属的thread_block_tile组内的排名如下图所示。图 1thread_rank接口返回值示意图![](https://raw.gitcode.com/cann/asc-devkit/raw/b5b3c746878b37aed704087f508055a267508b02/docs/api/figures/thread_block_tile_rank.png thread_block_tile_rank?utm_sourcegitcode_repo_files)SIMT编程场景using namespace cooperative_groups; __global__ void simt_kernel(...) { ... thread_block block this_thread_block(); auto tile4 tiled_partition4(block); unsigned long long rank tile4.thread_rank(); ... }SIMD与SIMT混合编程场景using namespace cooperative_groups; __simt_vf__ inline void simt_kernel(...) { ... thread_block block this_thread_block(); auto tile4 tiled_partition4(block); unsigned long long rank tile4.thread_rank(); ... }【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考