Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JIT Compilation heuristics and parallelism expl...

JIT Compilation heuristics and parallelism exploitation for Sulong

Virtual Machine Meetup

October 02, 2017
Tweet

More Decks by Virtual Machine Meetup

Other Decks in Education

Transcript

  1. JIT Compilation heuristics and parallelism exploitation for Sulong Swapnil Gaikwad,

    Andy Nisbet, Mikel Luján 29 September, 2017 VMM’17
  2. Outline 2 • Sulong Project – Bitcode Parser • Ongoing

    work – Trace Based approach to help tuning compilation heuristics • Future Plan – Executing OpenMP programs on JVM using Sulong
  3. Outline 2 • Sulong Project – Bitcode Parser • Ongoing

    work – Trace Based approach to help tuning compilation heuristics • Future Plan – Executing OpenMP programs on JVM using Sulong
  4. Sulong Project Overview 3 LLVM IR Parser Truffle JVM Graal

    LLVM IR C C++ Fortran* Operating System *Fortran code is converted to LLVM IR using DragonEgg plugin of GCC
  5. Sulong Execution Lifecycle 4 LLVM Tools LLVM IR LLVM Bitcode

    parser Truffle AST Generation Truffle Representation (AST form) Graal Compiled hot path code Sulong .c .cpp .f90 Interpretation
  6. Contributions to BitCode parser 5 • Initiated work on the

    parser for binary bitcode files – Faster parsing compared to textual parser (for .ll files) • To support the latest LLVM IR the parser is improved to parse LLVM IR version 3.9 partially – Benefit from new static optimizations to LLVM IR – Sulong developer community led this work to completion
  7. Outline • Sulong Project – Bitcode Parser • Ongoing work

    – Trace Based approach to help tuning compilation heuristics • Future Plan – Executing OpenMP programs on JVM using Sulong
  8. Motivation 6 LLVM Tools LLVM IR LLVM Bitcode parser Truffle

    AST Generation Truffle Representation (AST form) Graal Compiled hot path code Sulong .c .cpp .f90 Interpretation
  9. Motivation 7 • For automotive benchmarks from MiBench benchmark suite

    a speedups up to 41% (GeoMean 7.3%) is observed in execution time for the small input data set.
  10. Trace based approach 7 a b c d e f

    g h j k l i … for( i=0; i<1000000; i++){ … switch(option){ case 1: …… case 2: …… if(isTrue){ func(); } break; default: …… } } …… LLVM IR
  11. Trace based approach 7 a b c d e f

    g h j k l i … for( i=0; i<1000000; i++){ … switch(option){ case 1: …… case 2: …… if(isTrue){ func(); } break; default: …… } } …… LLVM IR
  12. Trace based approach 7 a b c d e f

    g h j k l i a c f l i • Generate a trace when tracing threshold is crossed
  13. Trace based approach 7 a b c d e f

    g h j k l i a c f l i • Use a trace for execution instead of original code
  14. Outline • Sulong Project – Bitcode Parser • Ongoing work

    – Trace Based approach to help tuning compilation heuristics • Future Plan – Executing OpenMP programs on JVM using Sulong
  15. What is OpenMP? and why? 9 • Directive based parallel

    programming approach • Standardized specifications • Possible to get LLVM IR for OpenMP supported languages – C, C++ and Fortran • OpenMP supports accelerator directives
  16. LLVM IR for OpenMP pragmas 10 void foo() { #pragma

    omp parallel for for(i = 0; i < n; i++){ … //Computation … } } LLVM IR define @foo { call @__kmpc_fork_call (@.omp_outlined.) } define @.omp_outlined.() { … //get loop bounds call @__kmpc_for() //LLVM IR for Computation … }
  17. Implementation Challenges 11 • Mapping OpenMP memory model using Java

    threads • Thread scheduling in Java • Porting OpenMP runtime
  18. Summary 12 • Described the bitcode parser work at University

    of Manchester • Trace based approach to help tuning the compilation heuristics • Utilize multicore CPU for running OpenMP parallel programs using JVM in Sulong