claw-project / claw-compiler

CLAW Compiler for Performance Portability
https://claw-project.github.io
BSD 2-Clause "Simplified" License
40 stars 15 forks source link

Separate the CLAW Compiler and the transformations set #44

Closed clementval closed 7 years ago

clementval commented 7 years ago

It would be nice to be able to have several transformations set that are packaged in different jar file and being able to use the same CLAW Compiler infrastructure.

The configuration has been totally reviewed and the transformations are now belonging to a transformation set. The main configuration then describe which transformation set to use and specify the order of application.

The transformation set configuration file holds all information about the class, the type and the trigger of the transformation itself. This file also specify if an external JAR has to be loaded in order to load the transformation class.

The user can partially or totally overwrite the default configuration but not the transformation sets configurations. Those are distributed by the developers of the transformations.

Example of a transformation set configuration file:

<!--
This file describes CLAW internal transformation not triggered by the user.
-->
<transformations>
  <transformation name="internal-xcodeml"
    type="independent" trigger="translation_unit"
    class="cx2x.translator.transformation.utility.XcodeMLWorkaround" />

  <transformation name="openacc-continuation"
    type="independent" trigger="directive"
    class="cx2x.translator.transformation.openacc.OpenAccContinuation" />
</transformations>

Example of a the main default configuration file:

<!--
CLAW default configuration. This file should not be edited!
For more information about the configuration file and its extension, please
refer to the developer's guide
-->
<claw version="0.4">
  <!-- Global transformation parameters -->
  <global type="root">
    <!-- Define the transformer to be used. -->
    <parameter key="transformer" value="cx2x.translator.transformer.ClawTransformer" />

    <!-- Default general values -->
    <parameter key="default_target" value="gpu" />
    <parameter key="default_directive" value="openacc" />

    <!-- OpenACC default information -->
    <!-- Define the default values to be used for the clauses. If value set to 0, compiler default value used. -->
    <parameter key="openacc_vector_length" value="128" /> <!-- vector_length(128) -->
    <parameter key="openacc_num_gangs" value="8" />       <!-- num_gangs(8) -->
    <parameter key="openacc_num_workers" value="8" />     <!-- num_workers(8) -->
    <!-- Specify the order of generation of clauses when nested loops are generated -->
    <!-- possible values are vector_gang, gang_vector, vector, gang, none -->
    <parameter key="openacc_execution_mode" value="vector_gang" />
  </global>

  <!-- Transformation sets -->
  <sets>
    <set name="claw-internal-set" />
    <set name="claw-low-level-set" />
    <set name="claw-high-level-set" />
  </sets>

  <!-- Transformation groups and order -->
  <groups>
    <group name="internal-xcodeml" />
    <!-- Low-level transformations -->
    <group name="remove" />
    <group name="primitive" />
    <group name="array-transform" />
    <group name="loop-extract" />
    <group name="loop-hoist" />
    <group name="loop-fusion" />
    <group name="loop-interchange" />
    <group name="on-the-fly" />
    <group name="kcache" />
    <group name="if-extract" />
    <!-- High-level transformations -->
    <group name="parallelize" />
    <group name="parallelize-forward" />
  </groups>
</claw>

Example of a partial overwrite of the default configuration by a user defined configuration:

<claw version="0.4">
  <global type="extension"/>
  <groups>
    <group name="internal-xcodeml"/>
    <group name="remove"/>
    <group name="primitive"/>
    <group name="array-transform"/>
    <group name="loop-extract"/>
    <group name="loop-fusion"/>
    <group name="loop-hoist"/>
    <group name="loop-interchange"/>
    <group name="on-the-fly"/>
    <group name="kcache"/>
    <group name="if-extract"/>
    <group name="parallelize"/>
    <group name="parallelize-forward"/>
  </groups>
</claw>

In this case, only the application order is overwritten.

clementval commented 7 years ago

Related PRs

198

222

clementval commented 7 years ago

closed by #222