ClearSpeed logo

Home Applications Technology Partners Investors News & Events

Technology banner - chip plot

Software Development

The processor can work in conjunction with or as a standalone processor for embedded DSP applications such as radar pulse compression or image processing or act as a coprocessor sitting alongside a general purpose CPU within a high performance workstation, blade server or cluster configuration.

Although the processor is programmed in C and assembler, host libraries allow C, C++ or Fortran applications to communicate with it.

Programming model

The processor has a simple programming model based on the Cn language, which is ANSI C with simple extensions for data-parallel programming. Variables can be marked with the keyword poly to indicate that they exist on every Processing Element (PE) in the CSX processor. Each PE operates on a different value for the variable. The code below highlights the processing done on the PE array (shown on the left). In many cases this is the only change needed to parallelize a function.

 

 

void cn_fft(poly float *xy, poly float *w, int n) {

    int n1,n2,ie,ia,i,j,k,l;

    poly float xt,yt,c,s;

    n2 = n;

    ie = 1;

    for (k=n; k > 1; k = (k >> 1) ) {

        n1 = n2;

        n2 = n2>>1;

        ia = 0;

        for (j=0; j < n2; j++) {

            c = w[2*ia];

            s = w[2*ia+1];

            ia = ia + ie;

            for (i=j; i < n; i += n1) {

                l         = i + n2;

                xt        = xy[2*l] - xy[2*i];

                xy[2*i]   = xy[2*i] + xy[2*l];

                yt        = xy[2*l+1] - xy[2*i+1];

                xy[2*i+1] = xy[2*i+1] + xy[2*l+1];

                xy[2*l]   = (c*xt + s*yt);

                xy[2*l+1] = (c*yt - s*xt);

            }

        }

        ie = ie<<1;

    }

}

Control Processor API

An application is typically split between code running on the control processor and code running on one or more accelerators. It is essential to have a simple but flexible software interface between these.

ClearSpeed’s CSPX control processor API provides a simple model with processes which can be on either the control processor or an accelerator. An object migration model is used for transferring data between these processes and synchronizing access.

The Remote Procedure Call (RPC) mechanism in CSPX allows a control processor program to call an accelerated function as if it were running on the control processor:

Control Processor Code Cn Code

#include <cspx.h>
#include "interface.h"


double inData[SIZE], outData[SIZE];


// call accelerator function
func(inData, SIZE, outData, SIZE);

#include <cspx.h>


#pragma cspx_rpc write(inputs[i_size])
                 read(results[r_size])


// define accelerator function
func(double* inputs, unsigned i_size, double* results, unsigned r_size){


... operate on data

}

 

 

 

Read more

Cedric Bastoul (et al) at Reservoir Labs Inc, published a paper on:

Extended Static Control Programs as a Programming Model for Accelerators. A Case Study: Targetting ClearSpeed CSX700 with the R-Stream Compiler