Google Summer of Code : OpenCL in GEGL

Hello everyone, I`m going to use my personal blog to register my steps in the wonderful world of my GSoC project. I`m going to implement OpenCL support in the Generic Graphics Library.

For those who doesn`t know, OpenCL is a language which allows parallel and high-performance code to run in different platforms, like GPUs and Multi-Core CPUs. By the end of the project, I want GEGL`s (and GIMP) plugins/operations to be able to use OpenCL.

My proposal:

OpenCL in GEGL

“OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of CPUs, GPUs, and other processors. OpenCL includes a language (based on C99) for writing kernels (functions that execute on OpenCL devices), plus APIs that are used to define and then control the platforms. OpenCL provides parallel computing using task-based and data-based parallelism.” [wikipedia]

My proposal is about making possible to write GEGL plug-ins in OpenCL. Of course you can always write your plug-in using any technology inside it (nothing forbides you from using OpenMP to parallelize a composition operation, for example). But the main point of the work is extending GeglBuffer to automatically make the memory transferences between the CPU and GPU.

An example:

So let’s suppose you have defined a graph in GEGL with a path of operations A, B and C. A and C can run at GPU, but we don’t have a GPU version for B.

input -> A (GPU) -> B (CPU) -> C (GPU) -> output

So, before entering A, we have to copy the input data to the GPU and do the processing in the GPU plug-in. After that, we copy data back to the main memory in order to B have its data, then we copy B’s output to the GPU again and run C, we need to have the output in the CPU of course, so we copy back C’s output to the main memory and finish.

Our objective is doing these memory transfers in a transparent way to the end-user of GEGL and implementing some operations in OpenCL.

This entry was posted in gsoc and tagged . Bookmark the permalink.

3 Responses to Google Summer of Code : OpenCL in GEGL

  1. Carolina Gomes says:

    Muito legal a proposta, Vitor! Tenho interesse em aprender OpenCL faz um tempo (na verdade sei o basicao de como funciona mas nunca peguei firme). Se voce puder, publique mais coisas sobre o projeto. Como atualmente funciona o GEGL? Eh tudo rasterizado por software com rasterizador proprio ou usa, por exemplo, OpenGL? Uma boa inspiracao eh voce dar uma olhada como o projeto do Qt faz a parte de renderizacao, eu mexi um bom tempo com essa parte e principalmente a organizacao da API deles eh inspiradora! Fora que no ano passado comecou o projeto do QtOpenCL, talvez fosse uma boa voce olhar.


    • Victor Oliveira says:

      Valeu pela dica, vou olhar sim!
      Quanto à GEGL, tudo é rasterizado por software mesmo. eu estou me baseando em um projeto antigo de GSoC que implementou suporte a GLSL, mas não deu pra terminar porque GLSL é complexo e só é útil pra casos de operações pixel-a-pixel na imagem.
      A API da OpenCL é mais fácil de usar e tenho esperança que logo surja um driver open-source 🙂

  2. Bat'O says:

    I wish you the best of luck for your project !

    Remember that there are people ready to help you if you ask … =)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s