More command queues work

Published on lun 13 juin 2011 in Clover, (Comments)

Hello,

During these past days, I studied my math exam I had on Friday and I also worked a bit on Clover. The good news is that even if I didn't do anything very exciting like kernels, I highly stabilized my previous work.

If you go on the clover git page, you'll see 8 new commits :

  • The first avoids potential crashes when an event is released by a worker thread. This commit removes code and makes Clover leak events, but also begins a correct implementation, finished by a later commit.
  • The second is a simple fix for a bug introduced by the previous commit. It was found by my testsuite, so write unit tests !
  • Then, a new OpenCL function : clEnqueueWriteBuffer, built upon ReadBuffer. A simple function added to see that what I've done actually works.
  • To be able to write good unit tests, I needed support for UserEvents. I had the bad surprise to discover that these events aren't bound to a command queue, so the implementation is a bit hackish.
  • Then, finally, a heavy test suite for nearly 2000 lines of code added this week and the previous one. The test suite tests the functions, the buffer operations, how a command queue works when we use user events and do asynchronous things, etc.
  • This morning (10 a.m GMT+2), I applied a small modification suggested by someone on this blog, the first “external contribution” to Clover :) .
  • Then, I continued and fixed the leak of events. With a few instrumentation, I could see that events got properly deleted.
  • I finished my day (before studying a bit for my exam of tomorrow) with the implementation of profiling.

Timing

If we refer to my original schedule, I'm a bit late, I should have begin my work on the compiler before the start of June, and we are already nearly at the middle of June.

In fact, I'm not late, I'm just doing things in advance. My original plan was to do as little as possible before the compiler. I wanted to implement only Context, Devices, Platforms and Command Queues. Then, I discovered how the command queues work, and I decided to do a proper implementation of them before.

I will begin working on kernels (at first native kernels) soon, but I have one or two things I want to see implemented before, for example support for clEnqueueMapBuffer (needs a hook in the abstraction layer that will be used by the kernels), and maybe support for images, to have a complete buffer implementation. I could even go as far as samplers, given the fact they are only bitfields.

By the end of June, Clover should be able to launch native kernels, so I will be able to test my command queues under heavy load. During my holidays of early July, I will use a notebook with a single core, so I want to be able to test all the implementation details related to multithreading before I left my main dual core computer.

So, I invite you to read the code and to launch the test suite. The “commandqueue” one takes one second, because I inserted a sleep to be sure everything continues to go well if the main thread of an application does something.

« Command queues, mutexes and threads   Use OpenCL to execute native kernels »