During compilation, most modern compilers discover and generate a wealth of information about what the compiler did in optimizing the code, what optimizations could not be implemented (and why), how data is accessed, relationships between procedures, and much more. PGI compilers include the ability to save this information into the compiled object and/or executable file for later extraction and review. The Common Compiler Feedback Format (CCFF) is a draft standard published by PGI that defines what compiler information is stored and how the information is formatted. Using CCFF, HPC tools providers can enhance their products to offer more and better information about optimizing performance.
The first product to exploit CCFF is release 8.0 of PGI's PGPROF performance profiler.
The benefits of standards are well-known. If more compiler and tool providers adopt this technology, PGI's customers and PGI will benefit through improved performance and interoperability.
Please post your ideas to the CCFF User Forum.
For now PGI will maintain the CCFF specification and host a discussion forum. If enough interest develops within the community, we will explore moving maintenance and definition of CCFF technology into the community.
Download the CCFF Schemas and specifications (see below) The PGI compilers can be considered a reference implementation for CCFF generation, so try experimenting with those to generate different CCFF messages. Utilities for extracting CCFF information from object and executable files (pgzip/pgunzip/pgextract) are included in the PGI release packages. If you have questions, post them to the CCFF User Forum.
CCFF processing is depicted in the figure below.
Following is a simple example program to demonstrate CCFF generation and extraction. This example is intended to illustrate how CCFF works and can be used; clearly there are many more complicated cases and more details are required for an actual CCFF implementation.
Suppose we have this simple program:
! (c) Copyright 2008 The Portland Group, Inc. (PGI) All rights reserved. ! Licensed under terms described at http://www.pgroup.com/doc/ccff.xsd subroutine daxpy(n,a,x,y) real*8 a(n),x,y(n) do i = 1, n y(i) = a(i) * x + y(i) end do return end program daxpytest implicit none integer n, i parameter(n=50) real*8 a(n), y(n), x ! init x = 42.86 do i=1, n a(i) = dble(i) y(i) = dble(i) enddo call daxpy(n, a, x, y) print *, 'result...' do i=1, n, 2 print *, y(i), y(i+1) enddo end
Compile this program with PGI compilers using the following command:
pgf90 -Minfo=ccff -fastsse -Mvect=noaltcode main.f -o main
Then extract the CCFF information into an XML file with the following command:
pgextract main .CCFF main.ccff -xmltag ccffbin -cz
The pgextract command is included with all PGI software releases. The arguments to the pgextract command have the following meanings:
Then examine main.ccff. You will see <message> elements like the following, noting that the loop at line 6 was vectorized. If you look at line 6 in the example source code, you'll see that it is the first line of the compute-intensive loop in the daxpy routine. So it is good news that it is being vectorized!
<message> <messageline>6</messageline> <messageid>VEC039</messageid> <messagetext>Generated vector sse code for inner loop</messagetext> </message>
Elements like this one are contained within a
At PGI, CCFF information is used in conjunction with the PGPROF performance profiling tool. The profiler can associate those parts of a program that run the longest or use the most resources with compiler feedback that can provide clues to performance improvement.
Here is an example screenshot of the PGPROF profiler displaying compiler feedback using CCFF.
In the source panel at the top is a triply nested Fortran loop. Most of the lines are annotated with blue 'info' icons to the left of the line numbers. The user has selected the button for line 136, which shows the CCFF information for line 136 (the outer loop) in the Compiler Feedback Panel below the source panel.
The messages at the top of the Compiler Feedback panel are associated with that specific source line. The granularity of the information increases the farther down the panel you go, showing procedure or routine-level information, and finally file-level information.
Messages of interest here include