Epiphany OpenJDK support

Moderator: michal.warecki

Epiphany OpenJDK support

Postby michal.warecki » Sat Aug 03, 2013 5:30 pm

Hi guys!

I'd like to start OpenJDK Epiphany architecture support. The idea is to compile only specified part of a bytecode and send it to epiphany cores. The rest of the code will be executed on a host CPU.

Here is a simple example:

Code: Select all
Streams.intRange(0, in.length).parallel().forEach( id -> {c[id]=a[id]+b[id];});
// c[id]=a[id]+b[id];     -> This code will be executed on Epiphany. "id" is the identifier of a core.


This will enable Epiphany to be used by Java programs including Hadoop, Cassandra, Akka etc. etc.

I've made a simple plan for this project:
1. Create code dispatcher which should be invokable from Java (so probably JNI will be involved).
2. Create bytecode -> Epiphany asm compiler in Graal [1] project.
3. Add support to Sumatra [2] project. "This primary goal of this project is to enable Java applications to take advantage of graphics processing units (GPUs) and accelerated processing units (APUs)--whether they are discrete devices or integrated with a CPU--to improve performance."

This is a major undertaking so if anyone is interested in the contribution, please send me message. Code will be available in github as soon as I'll get Paralella board.

[1] http://openjdk.java.net/projects/graal/
[2] http://openjdk.java.net/projects/sumatra/
michal.warecki
 
Posts: 5
Joined: Fri Jun 28, 2013 12:47 pm

Re: Epiphany OpenJDK support

Postby michal.warecki » Sun Aug 11, 2013 7:20 pm

Hi,

I've created repos for two OpenJDK projects extensions:
https://bitbucket.org/michal_warecki/graal-epiphany
https://bitbucket.org/michal_warecki/su ... v-epiphany

Best,
Michał
michal.warecki
 
Posts: 5
Joined: Fri Jun 28, 2013 12:47 pm

Re: Epiphany OpenJDK support

Postby Tomo » Fri Sep 06, 2013 5:55 pm

Hi Michal,

I am also interested to see Java running on the Epiphany cores.

What happens if in your forEach lambda expression another function is called? Is function executed on ARM core or on the Epiphany core. If the function is executed on the ARM core then the resources will be hoping from epiphany core -> ARM core -> epiphany core once or several times probably slowing down the cores and filling the eMesh network.
If the function is executed on the Epiphany core what happens if other bigger libraries are used.

It would be nice to see the epiphany cores to execute the normal threads (each executed servlet, map/reduce of hadoop) while the main thread, gui thread, gc thread would be executed on the ARM cores and also all the intensive IO processes (disk IO, TCP/IP stack) and error handling would also run on the ARM cores. If that would be supported the adoption of epiphany for web servers and data storage/databases/cloud and business applications would skyrocket. The Epiphany cores would still run the libraries, but the libraries would be loaded in the bigger SDR memory. The hard part would be the balancing act of execution of the jvm machine on the epiphany cores.
It would be nice to see write once, run everywhere even on the epiphany core.

I will probably first try to run openCL on the board - will see if jogamp, javacl or jocl work on the Epiphany cores.

But I think It would be useful to create an API framework which would directly use the sdk framework through JNI. The framework could use predefined processes which would shield the user from writing direct code for the cores and would also handle the concurrency correctly.

I don't have the overview yet, found out about parallella two weeks ago, still reading the docs (epiphanny reference files).
I will also have to look into the graal and sumatra projects. I see it won't be easy, but through the process we will learn a lot.

I am also waiting for the parallella board.

Best,
Tomo
Tomo
 
Posts: 10
Joined: Fri Sep 06, 2013 4:36 pm

Re: Epiphany OpenJDK support

Postby notzed » Mon Sep 16, 2013 12:34 am

Count me in on the interested stakes here. I'm pretty familiar & experienced with most of the technlogy involved ... except compilers. I'm not sure time will let me help much mind you but i'll be interested to see it progress. Definitely a major undertaking.

I'm still pretty much waiting for the jdk8 GA release before delving into lambdas myself (and personally i'm happy enough with C/ASM or opencl from Java) but they look like a promising way for "normal" programmers to exploit concurrent accelerators or and/or SIMD units in a way that non-jvm languages can't easily replicate.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Epiphany OpenJDK support

Postby over9000 » Mon Sep 16, 2013 2:34 am

notzed wrote: Definitely a major undertaking.


Yes, it definitely is. I spent some time researching this when I was developing things for the PS3. I think that a lot of the insights that people gained on that platform could definitely be applicable to the Epiphany. I don't have a full list of the most interesting papers I read to hand, but I seem to remember that this was one of them:
http://www.mendeley.com/catalog/hera-jvm-runtime-system-heterogeneous-multi-core-architectures/#
I can try to find links to PDFs of the other docs that stood out for me at the time, if it will help. I do remember one other of them was based on Jikes, and that various parallelism strategies (from thread-based to method-based offloads) were tried. There were also some very funky bits of self-modifying code (trampolines, at any rate) in one of the implementations that allowed for dynamic overlays--something that could definitely be useful on the Epiphany given its extremely constrained memory space...
over9000
 
Posts: 98
Joined: Tue Aug 06, 2013 1:49 am

Re: Epiphany OpenJDK support

Postby notzed » Mon Sep 16, 2013 11:15 am

over9000 wrote:
notzed wrote: Definitely a major undertaking.


Yes, it definitely is. I spent some time researching this when I was developing things for the PS3. I think that a lot of the insights that people gained on that platform could definitely be applicable to the Epiphany. I don't have a full list of the most interesting papers I read to hand, but I seem to remember that this was one of them:
http://www.mendeley.com/catalog/hera-jvm-runtime-system-heterogeneous-multi-core-architectures/#
I can try to find links to PDFs of the other docs that stood out for me at the time, if it will help. I do remember one other of them was based on Jikes, and that various parallelism strategies (from thread-based to method-based offloads) were tried. There were also some very funky bits of self-modifying code (trampolines, at any rate) in one of the implementations that allowed for dynamic overlays--something that could definitely be useful on the Epiphany given its extremely constrained memory space...


Yeah it's very much like CELL without the SIMD (yay!) and some of the cool bits (bummer).

I think the lambda approach (from what i know about it) makes the problem much more manageable both in terms of the compiler and the end-user trying to use it. No need to get a full jvm and threading model - just a way to crunch numbers and move some memory around.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Epiphany OpenJDK support

Postby Tomo » Mon Sep 16, 2013 1:17 pm

Hi,

It would be great if we could get Hera JVM to work on the Epiphany cores (+ARM).

I went looking which engine should we adopt:
http://en.wikipedia.org/wiki/Comparison ... l_machines

Taurus JVM http://www.tsac.co.uk/javavm/index.php
Avian http://oss.readytalk.com/avian/index.html
Jikes RVM http://jikesrvm.org/
Jelatine JVM http://jelatine.sourceforge.net/

Taurus and Jelatine are interesting because they use little memory, Jelatine requires as little as 32 KiB of RAM.

Avian, Jikes have more permissive licenses than GPL.
Taurus has not been worked on for years as I can see from uploaded files.
Avian and Jikes have active repositories.

It would probably be overkill to try to implement the complete openJDK on the epiphany cores, therefore it would be better if at first we would implement only a small jvm and then look into Hera JVM. The question is what implementation would be used as a starting point.

I am strongly leaning towards Avian which can be compiled as standalone, be used with openJDK and has some kind of support for Android.
Hera JVM is using Jikes as its VM.
Jikes supports GNU Classpath, openJDK is not yet fully supported, supports Apache Harmoiny.

I hope I am not starting war about which JVM should be implemented. Anyone would probably be good as long as it stays in the memory footprint of Epiphany core.

Michal Warecki cloned the graal and sumatra projects, but I am not sure if that is what is needed.
One possibility would be creating clean implementation from scratch, but I would prefer more an implementation which leans a bit on Avian or Jikes.
Tomo
 
Posts: 10
Joined: Fri Sep 06, 2013 4:36 pm

Re: Epiphany OpenJDK support

Postby michal.warecki » Mon Sep 16, 2013 2:03 pm

Sorry, I was on vacations.

OpenJDK support has the highest priority because it contains projects that fits Epiphany support (Graal, Sumatra). Another reason is that 99% of JVM instances are OpenJDK/Oracle hotspot.

I finished definition of Epiphany architecture in Graal. This week I'm going to finish article and start work on LIR in Graal. Stay tuned.
Next month I'll have much more time for this project.

@Tomo - I don't think that this would work well (because of synchronization points). Firstly we need to be able to execute very simple blocks of code with algorithms prepared for parallelization.

Best,
Michał
michal.warecki
 
Posts: 5
Joined: Fri Jun 28, 2013 12:47 pm

Re: Epiphany OpenJDK support

Postby notzed » Tue Sep 17, 2013 2:00 am

Tomo wrote:It would be great if we could get Hera JVM to work on the Epiphany cores (+ARM).


Michal seems to be head-long into the graal/sumatra approach so I think we should just let him follow that and see where it leads him. I'm excited to see how it turns out not only for epiphany but for gpu backends in general and the potential to break-free of the cpu performance bottleneck.

My take is that a "full JVM" based approach will be too much work, too hard to programme, and wont provide any usable performance. Lambdas and the concurrency stuff was added to Java specifically because writing threaded code is difficult and doesn't scale to highy-parallel or SIMD processors. i.e. where techonlogy is already at and continuing to head for the foreseeable future.

If you want some more detailed arguments of why I think those things then perhaps we can start another thread to discuss it?
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Epiphany OpenJDK support

Postby Tomo » Tue Sep 24, 2013 9:09 am

Michal: I agree best bet is on OpenJDK.

I contacted Ross McIlroy and he agreed to share his code on github: https://github.com/rmcilroy/HeraJVM
Thanks Ross.
But the code was made on the old Jikes RVM( version 2.9.3) and the second problem is that Jikes RVM does not run on ARM processors. But there might be some precious gems to pick out.
Tomo
 
Posts: 10
Joined: Fri Sep 06, 2013 4:36 pm

Next

Return to Java

Who is online

Users browsing this forum: No registered users and 1 guest

cron