502.gcc_r
SPEC CPU®2017 Benchmark Description

Benchmark Name

502.gcc_r

Benchmark Author

Richard Stallman and a large cast of helpers.
For a full list, see http://gcc.gnu.org/onlinedocs/gcc/Contributors.html

Benchmark Program General Category

C Language optimizing compiler

Benchmark Description

502.gcc_r is based on GCC Version 4.5.0. It generates code for an IA32 processor. The benchmark runs as a compiler with many of its optimization flags enabled.

502.gcc_r has altered inlining heuristics, so as to inline more code than may be typical of Unix systems as of the time that the porting work was done for the benchmark. This was done so that 502.gcc_r would spend more time analyzing its source code inputs, and use more memory. Without this effect, 502.gcc_r would have done less analysis, and needed more input workloads to achieve the run times required for CPU2017. Recall that SPEC CPU® benchmarks are drawn from 'the compute-intensive portion of real applications'; therefore, for the benchmark version, the preference is to compile a few large files instead of many small files.

Input Description

The inputs to the benchmark are C source code files. The large files for the ref workloads are GCC itself, after preprocessing. The presentation of the entire (preprocessed) source set at one time avoids I/O and allows the benchmark compiler a wide scope as it considers optimizations. There are several optimizations used, which can be found in the file control in each of the input directories. For example, the brief 'test' workload uses
-O3 -finline-limit=50000.

New inputs can be generated by writing C source code.

Output Description

All output files are IA32 assembly code files.

Programming Language

C

Known Portability Issues

  1. spec_qsort and ANSI aliasing: The spec_qsort.c routine does not strictly obey the ANSI aliasing rules. See the detailed discussion in the documentation for 505.mcf_r, which is where the problem was reported.

    If you are compiling with the GCC compiler, it is theoretically possible that you might need to add -fno-strict-aliasing to 502.gcc_r as well. The Example GCC config files as updated for SPEC CPU 2017 v1.1.5 demonstrate how to do so.

  2. Multiple definitions: When using the GNU Compiler Collection (GCC) to compile the gcc benchmark, you may encounter errors such as the following:

       cc1-checksum.o: In function `vprintf':
       /usr/include/bits/stdio.h:38: multiple definition of `vprintf'
       main.o:/usr/include/bits/stdio.h:38: first defined here
    

    Notice in the message above that the compiler appears to be objecting to using a definition at
    stdio.h:38 because it already has a definition at
    stdio.h:38.
    That somewhat confusing error signature is due to inclusion of header files that use pre-1999 inlining keywords. See the documentation of -fgnu89-inline in the GNU chapter on C-Dialect-Options, and the associated discussion of inlining, which explains how the keywords inline, static, and extern were standardized in a manner that differs from their pre-1999 use by GCC.

    A recommended solution to this problem is:

    intrate,intspeed=base:
       EXTRA_COPTIMIZE = -fgnu89-inline

    Note: as shown above, you would set the flag for all benchmarks, as required by the rules.
    In peak, if you wish, you could be more selective and set it only for the gcc benchmark.

    Possible alternatives:

Other Portability Considerations

  1. Some of the optimizations 502.gcc_r performs require constant propagation of floating point constants. These form an insignificant amount of computation time, yet may depend on IEEE floating point format to produce a correct result.
  2. 502.gcc_r is not an ANSI C program. It uses GNU extensions.
  3. The initial port of 502.gcc_r was to a 64 bit system. It has been successfully ported by SPEC to many 32-bit UNIX implementations.

Sources and Licensing

502.gcc_r is based on the GNU C compiler version 4.5, using the GNU GPL license.

Please see details in the document SPEC CPU®2017 Licenses.

References

Last updated: $Date: 2020-09-23 10:06:01 -0400 (Wed, 23 Sep 2020) $

Copyright © 2017-2020 Standard Performance Evaluation Corporation (SPEC®)