there are so many cores

Just another WordPress.com site

visiting multiple dispatch hell

Hacked together an interpreter back-end, enough to run a simple PeakStream example.

Arrayf64 C;
{
    // eagerly create buffers/images on compute device
    Arrayf64 A = make1(100, cpuA);
    Arrayf64 B = make1(100, cpuB);

    // lazy boxed calculation
    C = sum(A + B);
}
double c = C.read_scalar(); // force evaluation, read back

I want a full implementation of the language in an interpreter before starting work on the JIT. That will make debugging and testing much easier. After the interpreter, work will start on the JIT and OpenCL back-end.

Another thing done last week is puzzling out the PeakStream grammar. It’s almost all there now.  The API is missing special flags like SP_ALL_DIMS and SP_MEMORY_NORMAL. I’m also unsure how stream resizing works in the gather1_floor() and gather2_floor() operations.

Several engineers have independently asked the same two questions, implying the following must be mutually exclusive.

  • Is PeakStream a language? Answer: Yes
  • Or is PeakStream a library? Answer: Yes

PeakStream is a DSL that calls a foreign virtual machine from C++. Lua is an example of another language that works this way. I think the confusion comes from the usual pattern for a managed platform like Java. The foreign call interface is from Java to native code using JNI. PeakStream works in the opposite direction. You can also do that with Java, create a JVM inside a native C/C++ application and call into it, but no one ever does.

Advertisements

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: