More command queues work

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.

Advertisements

3 responses to “More command queues work

  • William Blackburn

    hello, I am having some trouble compiling the test suite. I just did a fresh git clone and the example is working but how do I build/compile the test suite?

    • steckdenis

      Hello,

      To compile the test suite, you need to install Check (available on openSUSE and others, it’s check.sourceforge.net). Then, reconfigure cmake with :

      cd build
      cmake . -DBUILD_TESTS
      make

      And then, run the tests

      make test

  • kjslag

    Hi. I had to modify a few things to compile the tests.

    mkdir build
    cd build
    cmake ../ -DBUILD_TESTS=1 # note the =1
    make

    and then to run:
    for t in platform device context commandqueue mem kernel; do ./tests/tests $t; done

    I also had to modify two blocks of code in tests/test_mem.cpp from
    cl_buffer_region create_info = { // “Hello, [world] !”
    .origin = 7,
    .size = 5
    };
    to
    cl_buffer_region create_info;
    create_info.origin = 7;
    create_info.size = 5;
    I think this is because the first syntax isn’t allowed in c++. I could easily be wrong, but I don’t think it’s allowed in c++0x either.

    Great work by the way! I can’t wait until it’s usable.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: