CCFF - Common Compiler Feedback Format


CCFF 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.

The first product to exploit CCFF is release 8.0 of PGI's PGPROF performance profiler.


CCFF FAQ

  1. 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.

  2. How is CCFF licensed?

    The CCFF license is included in the header of the CCFF XML schema. Or you can read the license text.

  3. How can our organization contribute to CCFF?

    Please post your ideas to the CCFF User Forum.

  4. 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.

  5. 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 CCFF User Forum.


CCFF Specification & XML Schemas


How CCFF Works

CCFF processing is depicted in the figure below.

  1. The PGI compiler produces an object file from a source file. The object file contains a .CCFF section.
  2. The linker combines object files into an executable file, merging the .CCFF sections of the objects.
  3. The executable file is run to produce performance data (see the PGPROF User's Guide for information on using PGPROF and generating performance data) in the form of a 'pgprof.out' file.
  4. The PGPROF profiler is invoked.
    1. PGPROF invokes pgextract to read the executable and produce an XML file containing the CCFF information
    2. PGPROF reads in the performance data from the 'pgprof.out' file
    3. as needed, PGPROF reads source files and symbol information from the executable
  5. The CCFF, performance, symbol, and source data are all synthesized into a comprehensive view of where the time is spent in the program, why, and what might be done about it.

Notes:

  1. 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.
  2. 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 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:

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 element specifying the subprogram and a element specifying the object file. The element can be used to look up more detailed information in the message repository - in this example we would look for a element associated with message ID VEC039.


Using CCFF with PGPROF

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.

PGPROF Screen Capture
View enlarged image

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

  • some profile-feedback messages showing the number of calls and loop counts
  • the compute-intensity of the loop - basically a measure of computation to memory operations - higher numbers mean that there is more computation than memory loads and stores.
  • information about parallelization, with a hint for how it might be possible to make the loop run in parallel. (note: in the "Parallelism" tab, PGPROF shows this loop as completely serial.)
  • a message from the compiler's inter-procedural analysis identifying the value of variable 'nb' as always being the constant '5'.
  • information about how the source file was compiled. Note that some 'shorthand' compiler options are expanded here - '-fastsse' and '-Mipa' are aliases for a number of commonly used and recommended options, shown in this display.

Click me