gpt4 book ai didi

assembly - PTX "bit bucket"寄存器

转载 作者:行者123 更新时间:2023-12-04 11:41:05 25 4
gpt4 key购买 nike

...刚刚在 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/

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