Execution of a simple Lambda Method on GPU

S. Bharadwaj Yadavalli bharadwaj.yadavalli at oracle.com
Mon Jan 20 16:34:24 PST 2014


Hi Tom,

Thank you for looking at the changes.

On 01/20/2014 11:45 AM, Deneau, Tom wrote:
> There is a bug in Method::is_lambda() in that it does not return false
> if methodPrefix == 0.  Actually I don't understand why the gcc
> compiler would not complain about this.
Yes, that was a coding error. I notice that a fix has already been 
pushed for this.

> Also, I noticed the CompilationPolicy::must_be_compiled, is_lambda path
> is not hit in the debug build.  Is this by design?

I am not sure I understand your observation/question. Using a debug 
build, I am able to see that is_lambda() is executed in the debugger, 
e.g., for a lambda method as well as for a non-lambda method [1].

However, the test is currently too restrictive and only picks on lambda 
methods in main method. There is no real reason to be that restrictive. 
The code is just a first cut and I expect to improve on the criteria to 
select lambda methods to be offloaded to GPUs.

Thanks,

Bharadwaj

[1]
....
(gdb) b 117
Breakpoint 3 at 0x7ffff68186e5: file 
/home/bharadwaj/graal/src/share/vm/runtime/compilationPolicy.cpp, line 117.
(gdb) c
Continuing.
CUDA driver initialization: Success
[CUDA] Number of compute-capable devices found: 2
[CUDA] Got the handle of first compute-device
[CUDA] Unified addressing support on device 0: 1
[CUDA] Using GeForce GTX 780
Compiling Lambda method FindSumL::lambda$main$0
Breakpoint 3, CompilationPolicy::must_be_compiled (m=..., comp_level=-1)
     at /home/bharadwaj/graal/src/share/vm/runtime/compilationPolicy.cpp:117
117            switch (gpu::get_target_il_type()) {
(gdb) n
119              tty->print_cr(" to PTX");
(gdb)
  to PTX
120              break;
(gdb) n
128          return true;
(gdb) b 110
Breakpoint 4 at 0x7ffff6818652: file 
/home/bharadwaj/graal/src/share/vm/runtime/compilationPolicy.cpp, line 110.
(gdb) c
Continuing.

Breakpoint 4, CompilationPolicy::must_be_compiled (m=..., comp_level=-1)
     at /home/bharadwaj/graal/src/share/vm/runtime/compilationPolicy.cpp:110
110      if (m->is_lambda()) {
(gdb) n
133      if (!can_be_compiled(m, comp_level)) return false;
(gdb) call m->print_value()
{method} {0x00007fffe9e264f0} 'compileMethod' '(JIZ)V' in 
'com/oracle/graal/hotspot/bridge/VMToCompilerImpl'(gdb)

...



More information about the graal-dev mailing list