next up previous contents
Next: Profiling Up: Implementation Previous: Parsing Constructs

Construct Interactions

The motivation for determining what variables and parameters appear to be dependent or independent of each other is discussed in Section gif. The goal of the new integrate pass, run after the snoot and porky passes, is to make this determination possible by gathering more global-level information about what sets of quasistatic variables are used together in the same qif statement, and what quasistatic parameters interact with each other due to nested qinfluence statements. Figures gif shows a partial program; Figure gif demonstrate what information integrate gathers by walking the abstract syntax trees looking for qif and qinfluence statements; the gathered information is stored in new annotations in the SUIF file. (Each different set is also an assigned integer unique identifier stored in its annotation, for later use.)

Specifically, a QIF SET annotation indicates that some part of the program has alternative code tagged by the given list of quasistatic variables. The indicator as to whether there is or is not a final qelse clause is important: if there is no final qelse in a given set, then that introduces the constraint that exactly one of the quasistatic variables must be selected to generate a valid version of the program; if there is a final qelse, then exactly zero or one of the variables must be selected. In this example, exactly one of the quasistatic variables ALTERNATIVE_1 or ALTERNATIVE_2 must be selected. It is possible to write source code such that it is impossible to generate a version of the program that satisfies all such constraints; a later clever compiler pass will complain in such a case.

A QINFLUENCE SET annotation indicates that there is some part of the program whose performance ought to be associated with the quasistatic parameters listed. Note that the qinfluence(THREADS) statement did not introduce a QINFLUENCE SET annotation listing just the THREADS parameter; instead, since the statement is lexically (textually) contained by a QINFLUENCE(BLOCK_SIZE) statement, a QINFLUENCE SET annotation listing both THREADS and BLOCK_SIZE was created instead.

  
Figure: integrate pass example input.

  
Figure: integrate pass finds qif chains and nested qinfluence statements.

The integrate pass at the current time does not record explicit information about other lexical nestings --- a qinfluence block inside a qif statement clause, or a qif statement inside a qinfluence block or another qif statement clause. Nor does the current integrate attempt to derive information about possible dynamic nesting --- cases where quasistatic variables and parameters may interact to influence the performance of the program through non-lexically-apparent interactions. For example, in Figure gif, the performance of the program is likely to depend on the interaction between the quasistatic variables FOO and BAR and the quasistatic parameter QUX, but the fact that FOO and BAR interact with QUX at run-time is not readily apparent through lexical analysis.

  
Figure: Dynamic interactions between quasistatic variables and parameters.



next up previous contents
Next: Profiling Up: Implementation Previous: Parsing Constructs



Reinventing Computing, MIT AI Lab. Author: pshuang@ai.mit.edu (Ping Huang)