01.12.2012 Views

Architecture of Computing Systems (Lecture Notes in Computer ...

Architecture of Computing Systems (Lecture Notes in Computer ...

Architecture of Computing Systems (Lecture Notes in Computer ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Compiler-Directed Performance Model Construction 191<br />

Source Code<br />

GCC-PME<br />

<strong>in</strong>strumented executable<br />

MA library<br />

performance trace files<br />

validation<br />

MATLAB<br />

Compiletime<br />

Run-time<br />

Post Process<strong>in</strong>g<br />

Tools<br />

Fig. 1. Developed tool cha<strong>in</strong> to create the performance model<br />

time. To benefit from this fact, the results <strong>of</strong> GCC’s loop analysis are <strong>in</strong>corporated<br />

<strong>in</strong> the PME process. This <strong>in</strong>cludes the results <strong>of</strong> scalar evolutions (SCEV)<br />

and <strong>in</strong>duction variables analysis (IV). In case these analysis passes fail to provide<br />

a loop bound, we fall back to a user-specified value: The ma-loop switch def<strong>in</strong>es<br />

the default value that is assumed for loops whose number <strong>of</strong> iterations was not<br />

derivable from static analysis. In order to avoid over <strong>in</strong>strumentation, steer the<br />

<strong>in</strong>strumentation process and, hence, decrease time and space overhead, the user<br />

may set a threshold value (called ma-barrier). The estimated amount <strong>of</strong> operations<br />

is divided by the total estimated amount <strong>of</strong> operations and compared to<br />

the threshold value. Every function or basic block must exceed the threshhold to<br />

qualify for annotation. GCC’s <strong>in</strong>frastructure delivers <strong>in</strong>formation from the added<br />

passes to the user. Specific switches trigger the writ<strong>in</strong>g <strong>of</strong> the <strong>in</strong>ternal program<br />

representation <strong>in</strong>to a file. These files conta<strong>in</strong> the modifications carried out by the<br />

correspond<strong>in</strong>g passes, enabl<strong>in</strong>g the user to exam<strong>in</strong>e the results <strong>of</strong> the <strong>in</strong>strumentation<br />

process. Tak<strong>in</strong>g a look at these files, the user will quickly and easily learn<br />

to adjust the additional compiler parameters to ga<strong>in</strong> decent <strong>in</strong>strumentation.<br />

Loop Annotation. The first PME pass annotates every loop with a call to the MA<br />

library. Herewith the identification <strong>of</strong> the loop nest<strong>in</strong>g level and the frequently<br />

executed parts <strong>of</strong> an application at run time is straightforward. The arrangement<br />

<strong>of</strong> loop components <strong>in</strong> GCC’s <strong>in</strong>termediate representation is shown <strong>in</strong> Figure 2.<br />

The preheader edge leads to the loop header and is mandatory for every loop.<br />

Loops are strongly connected parts <strong>of</strong> the control flow graph, which have exactly<br />

one entry block (header) [15]. The loop header holds the condition decid<strong>in</strong>g to<br />

enter the loop body. After execut<strong>in</strong>g the loop body the latch edge is taken<br />

to the loop header. If the loop has multiple exits, the loop body may be left<br />

through an additional exit edge as well. The annotation <strong>of</strong> the loop adds the<br />

ma_loop_start call at the preheader edge and the ma_loop_end call to all exit<br />

edges. The start call takes three parameters: an unique identifier, variable name<br />

<strong>of</strong> the loop bound (if derivable), expected loop count (pass<strong>in</strong>g the correspond<strong>in</strong>g<br />

variable). To complement this <strong>in</strong>formation the end call takes two arguments:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!