passlab / rexompiler

REX OpenMP Compiler
https://passlab.github.io/rexompiler/
Other
1 stars 1 forks source link

Add directive-name-modifer to all OpenMP clauses #142

Open ouankou opened 1 year ago

ouankou commented 1 year ago

According to the recent email from Dr. Yan, OpenMP spec will make directive-name-modifer available to all clauses. So, we'll need to update the parser and transformation to reflect the change.

Bronis R. de Supinski:

In preparation for rationalizing the available combined and composite constructs, we need to make directive-name-modifier available on any clause that may appear on a combined or composite construct. Attempting to limit that availability to just those clauses would be confusing and likely error prone (and would be counter to the general idea of how to rationalize the availability of those constructs). Thus, this issue will move the description of directive-name-modifier out of the if clause section into section immediately preceding it. In addition, it will change the text to state that applies to all clauses (perhaps "unless explicitly specified otherwise").

The changes to the specification should be fairly simple although the changes for implementations are that they must accept the modifier universally, so front-end changes will be necessary (and the front-end should recognize if an inappropriate directive name is specified, as they currently already should for its use on the if clause).

This change will also be usef to issue #3427 (or a follow on to it) in that it will allow the target data construct to be extended to allow specification of directive names that apply clauses only to specific constituent constructs (e.g., depend could be applied only to the target enter data or target exit data or to the task associated with the structured block).

Currently, the syntax of if clause is as follows: if([directive-name-modifier :] scalar-expression). We should add this modifier to all clauses in ompparser. For example, the current syntax of reduction clause is reduction([ reduction-modifier,] reduction-identifier : list). With the new change, it could be reduction([directive-name-modifier,] [ reduction-modifier,] reduction-identifier : list).

To enforce the correctness of directive-name-modifer, we first implement the checking in ompparser. On top of that, optionally, we could also implement the checking in the transformation. In the REX compiler, we could add a field named directive-name-modifier to all OpenMP clause nodes. Its type should be SgStatement*, which points to an OpenMP directive node. This field is fulfilled in the AST constructor.