OSL for GPU?

Why can’t OSL be enabled on GPU? Is it not enhanced for speed or something? I’d rather render on GPU even if the OSL parts take a little longer it would still be better than all CPU… It is possible to enable it somehow? Thanks!

http://www.systemagnostic.com/faqs/can-i-use-my-gpu-to-render-scenes-with-open-shading-language-osl-shaders/

That didn’t help. I was wondering why it couldn’t be enabled. Why can you just not push a button and it works? (Which sounds totally illogical, I know, but… :P)

It can’t be enabled because it doesn’t work, nobody has spent the time to get OSL to compile code that runs on the GPU.

Though someone (AMD maybe?) did semi-recently add an openCL backend to LLVM so it may be possible sometime in the future, depends on the OSL folks really.

Actually… you could always make a backend plugin that translates code back and forth if the OSL people do not make the code FOR GPU. It works about the same way as a wrapper for OpenGL from FX.

…maybe.

You’d need to both translate the code to something the GPU can run and modify cycles to be able to call the code from the GPU.

Once you go to all that trouble you may as well just implement it all within OSL/LLVM so there wouldn’t be a whole separate OSL lib to maintain.

OSL is maintained by the good folks over at SPI and they have absolutely no interest in using the GPU for rendering.

For what it’s worth, spectral studio implements OSL (although I’m not sure what the limitations are) and (presumably) generates OpenCL code from it at runtime, something that isn’t really feasible with CUDA. OSL is just a spec, the “official” implementation is just one option for using it.

From https://developer.nvidia.com/opencl
“OpenCL™ (Open Computing Language) is a low-level API for heterogeneous computing that runs on CUDA-powered GPUs. Using the OpenCL API, developers can launch compute kernels written using a limited subset of the C programming language on a GPU.
OpenCL support is included in the latest NVIDIA GPU drivers…”

So where’s the catch?

There’s no catch, nobody said it couldn’t be done just that it hasn’t been done.

Uncle Entity, that’s quite clear.
However, i was referring more to Zalamander’s post understanding that there are problems to generate on the fly OSL code into something “CUDA-powered” GPUs are able to chew, namely CUDA provided instruction set.

Both OpenCL and CUDA are compiled to PTX on NVIDIA hardware, however OpenCL is designed to always be compiled on-the-fly, whereas CUDA is designed to be compiled ahead-of-time. Compiling and loading CUDA code at runtime isn’t impossible, but would require users to have the CUDA SDK + a compiler infrastructure to be installed.

Thanks Zalamander, i wasn’t aware of that.
Still, earlier, when installing blender, we had this first time kernel compile time; was that a part of the same base shader compiling process or that was different? Afaik we did not need CUDA SDK installed, or did we?
Then again, they say “OpenCL support is included in the latest NVIDIA GPU drivers…”; nothing abut SDK being needed.
After seeing nvidia examples code, there is check of installed CUDA (SDK?), i see.

Well, anyhow, thanks for clarifications; not that i’m into of programming it, call it simply cause of death of my mascot…