cuda内核参数

发布于 2024-09-26 13:52:38 字数 129 浏览 1 评论 0原文

cuda 内核

__global__ foo (int a, int b)
{
    ... ...
}

假设我有一个存储 a 和 b 的 。这是否占用每个线程的寄存器空间?

say I have a cuda kernel

__global__ foo (int a, int b)
{
    ... ...
}

where a and b are stored. Does this takes register space for each thread?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丢了幸福的猪 2024-10-03 13:52:39

不,这不会占用每个线程的寄存器空间,而是在常量空间(只读空间)中分配一次 ab ,所有线程都可以从中读取。

请注意,该空间由常量寄存器缓存并由所有线程共享:

只读常量缓存
由所有标量处理器核心共享
并加快常数的读取速度
内存空间,这是一个只读的
设备内存区域 [PTX ISA 版本 2.1 第 3 章]。

No this doesn't take register space for each thread, instead a and b are allocated once in a constant space - a read only space - from which all thread can read.

Note that this space is cached by constant registers and shared by all threads:

A read-only constant cache that is
shared by all scalar processor cores
and speeds up reads from the constant
memory space, which is a read-only
region of device memory [PTX ISA Version 2.1 Chapter 3].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文