OpenCL中的私有内存是否有最大限制? [英] Is there a maximum limit to private memory in OpenCL?

查看:166
本文介绍了OpenCL中的私有内存是否有最大限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenCL规范是否对可使用的专用内存量设置了最大限制?如果是这样,我怎么得到这个号码?

Does the OpenCL specification set any maximum limit on the amount of private memory that can be used? If so, how do I get this number?

我有一个函数,可以在OpenCL之外运行时给出正确的结果,但是当转换为内核时,它会产生垃圾.我使用CL_KERNEL_PRIVATE_MEM_SIZE标志检查了每个工作项正在使用的私有内存量,它约为4000字节.我怀疑我使用了过多的私有内存,这在某种程度上导致了垃圾计算.

I have a function which gives the correct result when run outside OpenCL, but when converted to a kernel, it spews out garbage. I checked the amount of private memory being used per work item using the CL_KERNEL_PRIVATE_MEM_SIZE flag and it is ~ 4000 bytes. I suspect that I am using too much private memory and this is somehow leading to junk computation.

推荐答案

对于不同的拱门,它是不同的.例如,hd7870的每个计算单元的专用内存为256kB,如果您的设置为每个计算单元64个线程,则每个线程将具有4kB的专用内存,这意味着1000个浮点值.如果进一步增加每个计算单元的线程数,则私有/线程数将下降到甚至1kB范围.您应该添加一些本地内存使用量来平衡它.

Its different for different archs. For example, a hd7870's private memory per compute-unit is 256kB and if your setting is 64 threads per compute unit, then each thread will have 4kB private memory which means 1000 float values. If you increase threads per compute unit further, privates/thread will drop to even 1kB range. You should add some local memory usage to balance it.

更重要的是,您不能全部使用它.编译器将很大一部分用于自己的优化和一些我不知道的事情.如果没有探查器,您将无法确定.

More importantly, you can not use all of it. Compiler uses big portion for its own optimizations and some things that I dont know. You can never be sure without a profiler.

这篇关于OpenCL中的私有内存是否有最大限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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