[Bf-cycles] Questions about CUDA and OpenCL images

Sergey Sharybin sergey.vfx at gmail.com
Fri May 13 22:16:02 CEST 2016


Hi,

Answers are inlined,

On Fri, May 13, 2016 at 9:42 PM, Thomas Dinges <blender at dingto.org> wrote:

> 1) For CUDA Bindless textures, I need to create an array of
> type "cudaTextureObject_t".
>
> I cannot find that inside of CUEW, am I missing something? The additional
> data types for cudaCreateTextureObject() are available (CUDA_RESOURCE_DESC
> and CUDA_TEXTURE_DESC) though.
>

CUEW is only covering the CUDA runtime API, it does not and can not cover
CUDA runtime API. As the name suggests, cudaTextureObject_t is a part of
runtime API, so will not be available in the wrangler.
cudaCreateTextureObject() is also apart of runtime api, you can not use.

You have to use forget about runtime API completely and do all the job
using driver API. Runtime API is just a wrapper around driver API anyway,
and all low-level communication is done via driver API. In this case it
seems you have to look into cuTexObjectCreate(). Manual of this function
will also give you an idea why CUDA_RESOURCE_DESC/CUDA_TEXTURE_DESC structs
are in driver API.


> 2) In all the examples I find online, people pass
> "cudaTextureObject_t" directly into the kernel. Can we do that differently?
> (e.g. via kg?). Otherwise I have to pass around the tex array through the
> entire path tracing kernel?
>

It is just an unsigned long long, you can pass it inside of a struct. From
real quick googling you'll end up with [1].

Don't know if you'll really need this tho, because as mentioned, it's part
of API you can not use. See comment about performance tho.

3) I also started to look into OpenCL Texture arrays, same question as 2)
> basically here. If thats also solvable, I might give this a try too. The
> current texture packing is not optimal performance wise, and we could
> reduce code a bit, if we don't handle OpenCL differently.
>

As far as i remember, that's still cl_mem as far as the host side is
concerned. That must be sent to kernel via an argument, you can't wrap it
into a structure.

[1]
http://stackoverflow.com/questions/33987381/how-to-embed-cuda-texture-objects-in-structs


-- 
With best regards, Sergey Sharybin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20160513/4c7c9ebc/attachment.htm 


More information about the Bf-cycles mailing list