This section describes Digital Fortran 90's differences from the High Performance Fortran Language Specification regarding passing array arguments through the subprogram argument interface. It also discusses how certain procedure interface issues that are incompletely or ambiguously specified in the High Performance Fortran Language Specification are interpreted in Digital Fortran 90.
Digital Fortran 90 includes some changes from the published HPF language definition relating to passing array arguments through the subprogram argument interface. The first two of these changes are restrictions that may be relaxed in a future release of the compiler.
Rationale: These directives describe various agreements between the calling procedure and the called procedure on data layout of arguments. An explicit interface is necessary for both sides to have information about what the agreement is. In particular, this may make an explicit interface necessary even if without a mapping on the dummy argument it would not have been necessary. This happens, for instance, with a mapped explicit- shape dummy. (In Fortran 90, an explicit interface is not needed to support an explicit-shape dummy.)
This restriction is a change to the language. The High Performance Fortran Language Specification refers to the possibility of directives being used without an explicit interface (Section 3.10, paragraph 2). Also, the High Performance Fortran Handbook gives examples of directives used on dummies with no explicit interface. In Digital Fortran 90, all those examples are illegal language constructs.
Rationale: The conventional way of passing arguments explicit-shape is to pass the address of the argument. Assumed- shape arguments, on the other hand, are conventionally passed using a dope vector, which can contain other information about the actual argument. It is only by passing a dope vector that the compiler can arrange to have the calling procedure pass information about the data layout of the actual argument to the called procedure. The rationale for introducing assumed-shape dummies in Fortran 90 was to provide a mechanism for passing information the base address of the actual argument. So this restriction also has the effect of encouraging the programmer to use the preferred Fortran 90 method of parameter passing.
This restriction is a change to the language. In particular, it makes illegal the example in Section 3.9 of the High Performance Fortran Language Specification (even if there were an explicit interface in that example, which there does not appear to be).
This is a change to the language. The way the language is now worded, a descriptive directive in an explicit interface is treated as if it were prescriptive (Section 3.10, paragraph 2 together with the rationale which follows it).
Rationale: In this implementation, the calling procedure is responsible for all remapping over procedure calls. Although the High Performance Fortran Language Specification supports this implementation, its interpretation of the language as stated in Section 3.10 has two consequences:
Rationale: This is a consequence of the previous item. The intent here is to emphasize that you should not be able to describe (by means of a descriptive directive) an unmapped argument. An unmapped argument should be thought of as having a definite mapping which is distinct from any mapping capable of being specified by HPF directives.
Similarly, if two dummies are ultimately aligned to the same template, one can be passed descriptively only if the other is also passed descriptively.
For example, the following specification is not allowed in Digital Fortran 90:
SUBROUTINE foo(A, B)
INTEGER A(:), B(:)
!HPF$ ALIGN A(i) WITH *B(i)
!HPF$ DISTRIBUTE B (BLOCK)
Rationale: The intent of descriptive directives and of the INHERIT attribute is to indicate that motion is not needed over the procedure interface. This is contrary to the spirit of a prescriptive directive.
This section does not contain restrictions to the HPF language. Rather, it specifies how certain incomplete or ambiguous specifications are handled by the Digital Fortran 90 compiler.
This section can be considered a replacement for section 3.10 of the High Performance Fortran Language Specification.
HPF directives can specify four properties of an array:
There are two problems that have to be addressed in finding a consistent way of dealing with possible combinations of these directives:
The High Performance Fortran Language Specification and the High Performance Fortran Handbook consider a number of these possibilities at length.
The discussion can be simplified as follows: Either there is motion or there is none. If motion is needed for alignment, it is generally just as expensive as if it is also needed for distribution, and conversely. Therefore, combinations of directives are considered according to whether they indicate that motion is or is not necessary, without worrying about what kind of motion it is.
A mapping of a data object (a combination of directives pertaining to that object) is "completely specified" if and only if the alignment, distribution, and relevant processor arrangement are all explicitly specified (a separate named template may or may not be specified). If the dummy is not aligned with a template but is instead distributed directly, the alignment is also considered to be explicit; this point is explained in following sections.
If the directives pertaining to a data object are not completely specified, the compiler must use default mappings. There is a default alignment (which is actually specified by the language), a default distribution (determined by the compiler), and a default processor arrangement (also determined by the compiler).
An important restriction is introduced on the use of default layouts:
Distribution directives applied to templates are always syntactically prescriptive. A way of telling whether these directives (and the templates and processor arrangements they mention) should be considered descriptive or not is necessary:
These two items are just matters of clarification, to make the remaining interpretations make sense.
Next, consider the meaning of incompletely specified sets of directives:
In Digital Fortran 90, a dummy array that is aligned descriptively with another dummy that has the INHERIT attribute is said to have a transcriptive (inherited) alignment, not a descriptive alignment.
The following is a specification of the conditions under which motion is generated at a procedure call in Digital Fortran 90:
For instance, if a is a dummy array argument, the following is a completely specified set of directives for the array a which is fully descriptive:
!HPF$ PROCESSORS p(4, 3) !HPF$ TEMPLATE t(100, 100) !HPF$ DISTRIBUTE T(BLOCK, BLOCK) ONTO p !HPF$ ALIGN a(i, j) WITH *t(i, j)
Similarly, the following is completely specified and fully descriptive:
!HPF$ PROCESSORS p(4, 3) !HPF$ DISTRIBUTE a *(BLOCK, BLOCK) ONTO p
On the other hand, the following is completely specified but not fully descriptive:
!HPF$ PROCESSORS p(4, 3) !HPF$ DISTRIBUTE a(BLOCK, BLOCK) ONTO p
And finally, if b is another dummy array conformant with a, the following is not even completely specified, since it omits mention of the relevant processor arrangement:
!HPF$ DISTRIBUTE b(BLOCK, BLOCK) !HPF$ ALIGN a(i, j) WITH *b(i, j)
Any combination of directives that includes at least one prescriptive directive is treated as if it were completely prescriptive.