Cilk portability to non Intel processors

Cilk portability to non Intel processors

Hi,

I'm investigating the use of Cilk in embedded computer environment.

I've understood that Cilk is only supported on Intel processors for Linux and MacOS X. Is it right?

Cilk also requires some specific compilers. Such compilers are available from Intel, GCC and LLVM.

What should be the effort to port Cilk to a different processor (i.e. ARM or Sparc)?

I assume that it involves some non trivial adaptation of the compiler backend?

Regards, Dominique T

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

We support Cilk Plus on Windows, Linux and Mac OS for the x86 architecture (both 32-bit and 64-bit).

How hard it is to port Cilk Plus depends on how close you are to the existing implemenations.

If you're going to a Unix variant, the runtime should port without much problem.  If you're going to a completely different environment (comparable to Windows, say) then there's a lot of work you'll need to do there.

If you're going to use GCC or LLVM, you can leverage off of the work that we've already done.  We did a trial with the ARM version of GCC for Linux and managed to run fib correctly.  But we only proved that it was possible.  Once we got that one test working, we moved onto other tasks.  We made no attempt to do a full port.

On non-x86 architectures you'll need to consider whether the memory model assumptions in the handling of the deque (spawning, stealing and returning from a spawned function) are correct.  The x86 architecture makes guarantees about the consistency of memory between processors that may not hold true on other architectures.  The THE protocol (which is depending on the memory model) is discussed in scheduler.c.  Details of the THE protocol  are available in The Implementation of the Cilk-5 Multithreaded Language by Frigo, Leiserson and Randall.

If you're interested in working on this, we'd be happy to consult with you and merge the changes into the source pool.  The sources and specifications for Cilk Plus are available from the Cilk Plus Downloads page.  See the Cilk Plus Contribution page for the details on how to contribute sources.

A further comment is that the usability of the array notation depends on compiler extensions that are available in Intel C++ but not GNU C++; specifically, variably modified arrays.  If you need to write generic n-D array functions (e.g. LU decomposition),  you should check that out; it may or may not be relevant to you.  Exactly how C++ (i.e. WG21) is going to proceed with that requirement is a matter of debate ....

Leave a Comment

Please sign in to add a comment. Not a member? Join today