_DK
May 9, 2009, 6:29pm
1
Hi,
I had a simple question. I have a kernel which fills an array in global memory. I’d like the kernel executed after that to read the data generated by the previous kernel and produce something else. Is it worth binding this global array to texture each frame? Is it even valid and do I need to unbind the texture each time I update global memory?
It could look like this:
unbindTexture(resultTexture);
launch_firstKernel(); // fills mem d_result
bindTexture(d_result, resultTexture);
launch_secondKernel();// uses tex1dfetch(resultTexture)
I thought this could be beneficial since the texture cache could be enabled, but is it worth the effort? I don’t know what’s really going on behind the scene when texture binding is performed.
Thanks!
unbindTexture(resultTexture);
launch_firstKernel(); // fills mem d_result
bindTexture(d_result, resultTexture);
launch_secondKernel();// uses tex1dfetch(resultTexture)
I thought this could be beneficial since the texture cache could be enabled, but is it worth the effort? I don’t know what’s really going on behind the scene when texture binding is performed.
Thanks!
I havent tried this but this seems valid and possible. As far as I saw binding/unbinding shouldn’t take time/too much time.
I guess the best answer is to test it on your code :)
Its all a matter of how much it will take oppose to the time your kernels run.
would be interesting to see what you got though :)
eyal
It is a lot of trouble for little reason. You can write to device memory that is bound to a texture, leave it bound and read it in the next kernel.
Tovi
May 10, 2009, 12:20am
4
Hi,
I had a simple question. I have a kernel which fills an array in global memory. I’d like the kernel executed after that to read the data generated by the previous kernel and produce something else. Is it worth binding this global array to texture each frame? Is it even valid and do I need to unbind the texture each time I update global memory?
It could look like this:
unbindTexture(resultTexture);
launch_firstKernel(); // fills mem d_result
bindTexture(d_result, resultTexture);
launch_secondKernel();// uses tex1dfetch(resultTexture)
I thought this could be beneficial since the texture cache could be enabled, but is it worth the effort? I don’t know what’s really going on behind the scene when texture binding is performed.
Thanks!
I asked myself the same thing a few days ago
http://forums.nvidia.com/index.php?showtopic=96101
_DK
May 11, 2009, 9:10am
5
Thanks Tovi, looks like it’s worth giving textures a try.