Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6517

New optimization and interface for either automatically or manually vectorizing Java programs with SSE instructions



    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DRLVM
    • Environment:
      OS: Linux or Windows
      Hardware: X86 or X86_64 with SSE4.2
    • Patch Info:
      Patch Available


      The patch file "javavect.patch" for DRLVM provides new features for vectorizing Java programs either automatically or manually. The work consists of four parts:

      1) IR extension for vector types and operators (middle-end);
      2) vector instruction (SSE) description and code generation (back-end);
      3) optimization pass of automatic vectorization for loops (middle-end);
      4) Java vector interface (JVI, see below) translator for manually writing vectorized Java programs with JVI (front-end).

      Parts 1) and 2) provides the basic facility for internally representing vectorized code and generating SSE instructions. Based on that, part 3) provides an automatic approach and part 4) provides a manual approach for vectorizing Java programs.

      The patch file "jvi.patch" for vmmagic provides a Java class library for programmers to write vectorized Java program explicitly. It contains 6 classes representing the types of vectors of 8-, 16-, 32- and 64-bit integers, and 32- and 64-bit floating point numbers. Each class contains appropriate methods representing supported vector operators on that type. The JVI class references and method callings in a Java program are translated into appropriate internal vector IR by the extended front-end, i.e. the work of part 4).

      The Java source file "jvi_basic.java" provides a simple test suite for JVI, covering all implemented JVI operations. It can also be used as examples of the usage of JVI.

            • Hardware requirement ****

      X86 or X86_64 with SSE4.2 instruction set

            • Usage of automatic vectorization ****

      The patch file contains two new configuration files: server_autovect.emconf and server_static_autovect.emconf, which are copied from server.emconf and servre_static.emconf, and inserted "autovect" optimization pass into their optimization paths. To try automatic vectorization, only need to add one of the following arguments: "-Xem:server_autovect" or "-Xem:server_static_autovect" to run the VM.

            • Usage of JVI ****

      Write programs with JVI (see jvi_basic.java), compile them and run them with the argument "-Xem:server_static" (This is must because the JVI code cannot be executed without being translated into the vector IR by Jitrino's optimizing compiler).

            • Performance improvement ****

      The performance of two computation intensive workloads (LU and FFT) is improved by 30% to 100%.

            • Testing of the patch based on the Harmony revision 935818 (2010-04-20) ****

      Automatic vectorization testing with SPECjvm2008:

      • Argument: -Xem:server_static_autovect
      • On 64-bit linux machine: All workloads except crypto.aes, derby and xml.transform have passed.
      • On 32-bit linux machine: All workloads except derby have passed.
      • All the above failed workloads also fail when autovect is disabled (-Xem:server_static), meaning that the failures are caused by bugs of the original code base.
      • Argument: -Xem:server_autovect
      • On both 64-bit and 32-bit linux machines: All workloads except xml.transform and serial have passed.
      • All the above failed workloads also fail when autovect is disabled (-Xem:server), meaning that the failures are caused by bugs of the original code base.

      JVI-based vectorization testing with jvi_basic.java:

      • Argument: -Xem:server_static
      • On both 64-bit and 32-bit linux machines: all test cases have passed.


        1. jvi.patch
          20 kB
          Jiutao Nie
        2. jvi_basic.java
          104 kB
          Jiutao Nie
        3. javavect.patch
          367 kB
          Jiutao Nie



            • Assignee:
              hindessm Mark Hindess
              niejiutao Jiutao Nie
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: