__constant内存的访问性能是否与OpenCL上的__global内存相同 [英] Is the access performance of __constant memory as same as __global memory on OpenCL

查看:89
本文介绍了__constant内存的访问性能是否与OpenCL上的__global内存相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知. CUDA上的恒定内存是特定的内存.而且它比全局内存快. 但是在OpenCL的规范中.我得到以下话.

As I know. Constant memory on CUDA is a specific memory. And it is faster than global memory. But in OpenCL's Spec. I get the following words.

__constant或常量地址空间名称用于描述在全局内存中分配的变量,这些变量在内核中作为只读变量被访问

The __constant or constant address space name is used to describe variables allocated in global memory and which are accessed inside a kernel(s) as read-only variables

因此,__constant内存来自__global内存.这是否意味着它与__global内存具有相同的访问性能?

So the __constant memory is from the __global memory. Does that mean it have the same accessing performance with the __global memory?

推荐答案

这取决于您使用的OpenCL平台的硬件和软件体系结构.例如,可以设想一种具有只读高速缓存的体系结构,该体系不需要参与高速缓存一致性.这些高速缓存可用于常量内存,但不能用于全局内存.因此,您可能会看到对恒定内存的更快访问.

It depends on the hardware and software architecture of the OpenCL platform you are using. For example, one can envision an architecture with read-only caches that don't need to participate in cache coherency. These caches could be used for constant memory but not global memory. So you might see faster accesses to constant memory.

话虽这么说,但我不熟悉的架构都无法以这种方式运行.因此,这只是假设.

That being said, none of the architectures I'm familiar with operate this way. So that's just hypothetical.

这篇关于__constant内存的访问性能是否与OpenCL上的__global内存相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆