assembly - PTX "bit bucket"寄存器

标签 assembly cuda gpgpu ptx

...刚刚在 PTX manual 中提到.没有关于它们有什么好处或如何使用它们的提示。

有人知道更多吗?我只是缺少一个共同的概念吗?

最佳答案

巴特的评论基本正确。更详细地,如 PTX ISA 3.1 manual 中所述,

For some instructions the destination operand is optional. A “bit bucket” operand denoted with an underscore (_) may be used in place of a destination register.



实际上在 3.1 PTX 规范中只列出了一类指令 _是一个有效的目的地:atom .以下是 atom 的语义:

Atomically loads the original value at location a into destination register d, performs a reduction operation with operand b and the value in location a, and stores the result of the specified operation at location a, overwriting the original value.



还有一个关于 atom 的说明:

Simple reductions may be specified by using the “bit bucket” destination operand ‘_’.



所以,我们可以构造一个例子:
atom.global.add.s32 _, [a], 4

这会将 4 添加到内存位置 a 处的有符号整数。 ,并且不返回位置 a 的先前值在一个寄存器中。所以如果你不需要以前的值,你可以使用这个。我假设编译器会为此代码生成这个
atomicAdd(&a, 4);

因为 atomicAdd 的返回值没有存储到变量中。

关于assembly - PTX "bit bucket"寄存器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12945991/

相关文章:

在arm gcc中控制函数的prelog和epilog

C 内联汇编 - 'fst' 的操作数类型不匹配

c++ - CUDA 对 CPU 和 GPU 具有相同的功能

CUDA 或可用于英特尔图形卡的相同功能?

assembly - 错误 LNK2019 : unresolved external symbol __imp____acrt_iob_func referenced in function _printf in VS2019

assembly - NASM 调用函数后我应该弹出函数参数吗?

c++ - JCuda全局共享内存导致错误

cuda - 使用 cuSPARSE 在 CUDA 中进行稀疏矩阵矩阵乘法

ubuntu - 如何从远程计算机运行CUDA/OpenGL互操作(粒子)示例

kernel - 有关 OpenCL 内核编程的教程或书籍?