0

I have seen OpenCL is widely supported by CPU implementation as well as some GPU implementations.

For the cases there is a GPU, but no GPU implementation available, would it be feasable to implement OpenCL using OpenGL?

Maybe most operations would map quite well to GLSL fragment shader or even compute shaders.

If this is feasable, where to begin? Is there any 'minimal' CPU OpenCL implementation, that one could start off?

asked Apr 27, 2016 at 9:24
2
  • 3
    You'll hardly find a GPU with the required capabilities for OpenCL but the drivers not implementing OpenCL. This is a non-issue. Commented Apr 27, 2016 at 9:32
  • Those gpu would have few pipelines, MMX/SSE on two cores could be better at performance/effort ratio. Commented Apr 27, 2016 at 12:00

2 Answers 2

1

For the cases there is a GPU, but no GPU implementation available, would it be feasable to implement OpenCL using OpenGL?

Possible: Yes, certainly. Every Turing complete machine can emulate any other Turing complete machine.

Feasible: OpenGL implementations' GLSL compilers are already primadonnas, each implementation's compiler behaving a little different. OpenGL itself has tons of heuristics in it to select the codepath. Shoehorning a makeshift OpenCL on top of OpenGL + GLSL will be an exercise in lots of pain.

Required: Absolutely not: For every GPU which has the required capabilities to actually support OpenCL the drivers do support OpenCL anyway, so this is a moot non-issue.

answered Apr 27, 2016 at 9:35
Sign up to request clarification or add additional context in comments.

2 Comments

In short: If there is no OpenCL driver available for the GPU, it wouldn't turn out very useful to use it for OpenCL tasks?
@dronus: Indeed. But the actual deterrent from doing this is, that it'd be a major nightmare to pull off. You'd have to implement a transpiler, OpenGL host code generator, probably implemented as a JIT; you'd have to deal with context state management and so on, and so on.
1

OpenCL has certain very explicit requirements on the precision of floating-point operations. GLSL's requirements are far more lax. So even if you implemented the OpenCL API on top of OpenGL, you would never be able to get the same behavior.

Oh and in case you start thinking otherwise, Vulkan is no better in this regard.

answered Apr 27, 2016 at 14:24

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.