Fetching CUDA texture problems

只愿长相守 提交于 2019-12-06 06:08:47
ArchaeaSoftware

There is definitely a constraint on the pitch, and unfortunately there is no device properties query to ask CUDA what it is.

But if you allocate the memory with cudaMallocPitch() and use the pitch passed back, that is guaranteed to work.

Nvidia reply to bug report:

"The problem here is that the memory bound to the 2D texture does not have the proper alignment restrictions. Both the base offset of the texture memory, and the pitch, have certain HW dependant alignment restrictions. However, currently in the CUDA API, we only expose the base offset restriction as a device property, and not the pitch restriction.

The pitch restriction will be addressed in a future CUDA release. Meanwhile, it's recommended that apps use cudaMallocPitch() when allocating pitched memory, so that the driver takes care of satisfying all restrictions."

pQB

Did you get the structure associated to the texture using the cudaGetTextureReference function?

From version 3.2 of the NVIDIA C Programming Guide (page 32, last paragraph):

The format specified when binding a texture to a texture reference must match the parameters specified when declaring the texture reference; otherwise, the results of texture fetches are undefined.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!