next up previous contents
Next: Examples of INDEPENDENT Up: The INDEPENDENT Directive Previous: The INDEPENDENT Directive

Visualization of INDEPENDENT Directives

 







  
Figure 5.1: Dependences in DO and FORALL without INDEPENDENT assertions

  
Figure 5.2: Dependences in DO and FORALL with INDEPENDENT assertions

Graphically, the INDEPENDENT directive can be visualized as eliminating edges from a precedence graph representing the program. Figure 5.1 shows some of the dependences that may normally be present in a DO and a FORALL. (Most of the transitive dependences are not shown.) An arrow from a left-hand-side node (for example, ``lhsa(1)'') to a right-hand-side node (``rhsb(1)'') means that the right-hand side computation might use values assigned in the left-hand-side node; thus the right-hand side must be computed after the left-hand side completes its store. Similarly, an arrow from a right-hand-side node to a left-hand-side node means that the left-hand side may overwrite a value needed by the right-hand side computation, again forcing an ordering. Edges from the BEGIN and to the END nodes represent control dependences. The INDEPENDENT directive asserts that the only dependences that a compiler need enforce are those in Figure 5.2. That is, the programmer who uses INDEPENDENT is certifying that if the compiler enforces only these edges, then the resulting program will be equivalent to the one in which all the edges are present. Note that the set of asserted dependences is identical for INDEPENDENT DO and FORALL statements.

The compiler is justified in producing a warning if it can prove that one of these assertions is incorrect. It is not required to do so, however. A program containing any false assertion of this type is not HPF-conforming, thus is not defined by HPF, and the compiler may take any action it deems appropriate.