5 Assertions and Directives

Assertions enable the programmer to provide KAP with additional information about the program. Although many KAP users run the product without assertions, sometimes assertions can improve the optimization results. Directives control advanced features and transformations on a local basis.

KAP does not guarantee that an assertion will have an effect. KAP notes the information provided by the assertion, and if that information helps, KAP uses it.

A variable used in a pragma needs to be declared before it is used in that pragma; otherwise, KAP detects an error.

To understand the process KAP uses in interpreting assertions, it is necessary to understand assumed dependences. In the following loop where X is an array, n and m are scalars, and nothing is known about the relationship between n and m , there are two types of dependences, as follows:

for (i=0; i<n; i++)
       X[i] = X[i-1] + X[m];

Between X(i) and X(i-1) there is a FORWARD dependence, and the distance is known to be one. Between X(i) and X(m) , KAP tries to find a relation but cannot, because it does not know the value of m in relation to n . The second dependence is called an ASSUMED dependence, because it is assumed but cannot be proven to exist.

Assertions can be unsafe, because KAP cannot check the correctness of the assertions. If you provide incorrect information, then the KAP generated code may give different results than the original scalar program generates.

Avoid giving a series of similar, redundant assertions, and avoid mixing assertions and hand-coded parallel C pragmas. Either can cause KAP to process some of the pragmas and not others, potentially giving undesired results.

Table 5-1 lists KAP assertions and directives and their durations.

Table 5-1 KAP Assertions and Directives

Name  Duration 
Assertions   
#pragma _KAP arl (<integer>)  Selectable 
#pragma _KAP distinct (name, name)  Selectable 
#pragma _KAP no side effects(name)  Program unit 
Assertions (Parallel Processing)   
#pragma _KAP concurrent  Loop 
#pragma _KAP concurrent call  Loop 
#pragma _KAP concurrent ignore call  Loop 
#pragma _KAP serial  Loop 
Directives (Inlining and IPA)   
#pragma _KAP inline [here|routine|global] [( name[,name..] )]  Selectable 
#pragma _KAP ipa [here|routine|global] [( name[,name..] )]  Selectable 
Directives (Parallel Processing)   
#pragma _ KAP minconcurrent (<integer>)  Program unit 


Previous Page | Next Page | Contents | Index |
Command-Line Qualifiers

Copyright © Digital Equipment Corporation. 1999. All Rights Reserved.