CCFF — Common Compiler Feedback Format
Introduction
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.
CCFF message generation is enabled in the PGI compilers by adding the –Minfo=ccff option to your compile and link line. The messages are stored in the binary file to be read by profiling tools such as the PGI Profiler. The pgextract tool can also be used to read the CCFF messages directly from the binary image. The first product to exploit CCFF is release 8.0 of the PGI Profiler (a/k/a PGPROF®).
FAQ
- Why is PGI making this technology freely available to the community?
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.
- How is CCFF licensed?
The CCFF license is included in the header of the CCFF XML schema. Or you can read the license text.
- How can our organization contribute to CCFF?
Please post your ideas to the PGI User Forum.
- What are PGI's future plans with CCFF??
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.
- How can our organization include CCFF in our product?
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 Debugging and Profiling User Forum.
XML Schemas
How It Works
CCFF processing is depicted in the figure below.
- The PGI compiler produces an object file from a source file. The object file contains a .CCFF section.
- The linker combines object files into an executable file, appending the .CCFF sections of the objects.
- The executable file is run with the PGI Profiler to produce performance data.
- The CCFF, performance, symbol, and source data are all synthesized in the PGI Profiler into a view of where the time is spent in the program, why, and what might be done about it.
Notes:
- There is another component, the CCFF repository, involved in the CCFF process. For simplicity's sake we don't include it in this overview. It is discussed in some detail in the example.
- On Mac OS X, the CCFF section in the object and executable is named __CCFF.
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 2014 NVIDIA Corporation. All rights reserved. ! Licensed under terms described at https://www.pgroup.com/lit/samples/ccff.htm 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 -fast 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:
- main
- name of the program to extract the CCFF from
- .CCFF
- name of the object file section containing CCFF info
- main.ccff
- output file name
- -xmltag
- specify a top-level XML element to wrap the
elements - -cz
- uncompress the CCFF data
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