From cTuning.org

Revision as of 14:42, 10 August 2009 by Huangyuanjie (Talk | contribs)
Jump to: navigation, search

Common page for GSOC09 and other developments in summer 2009: function cloning, fine-grain optimizations, program instrumentation:


Contents

Fine-grain optimization project

Yuanjie Huang (ICT, China)

This project aims to provide fine-grain optimization selection and tuning abilities in GCC, and thus enable GCC to tune default optimization heuristic of the compiler or fine optimizations for a given program on a given architecture entirely automatically using statistical and machine learning techniques from the MILEPOST project.

ICI Fine-grain tuning work flow

TODO

Image:ICI-adapt-record.jpg

Image:ICI-adapt-reuse.jpg


ICI Events

ICI events added to the framework for fine-grain tuning are documented here.

ICI Features

ICI features added to the framework for fine-grain tuning are documented here.

Feature name Type of contents Description
"main_input_filename" array of strings, i.e., char ** Name of the file which serves as the main input file of compiler .

Known Issue on Current ICI Features

  • "function_filename" can be empty for functions generated by IPCP optimization (cp pass).

ICI Parameters

ICI parameters now come with a type which should be declared when registering parameters in ICI, currently only a few basic C types are supported: void, char, unsigned char, int, unsigned int, long and unsigned long. A special type named EP_SILENT is introduced to pass parameters that is only used to pass status information to plugin; it's actually int, and is planned to be replaced by a elegant solution. The parameter type is defined in gcc/highlev-plugin-internal.h and gcc/highlev-plugin.h:

typedef enum
{
  EP_SILENT,
  EP_VOID,
  EP_CHAR,
  EP_UNSIGNED_CHAR,
  EP_INT;
  EP_UNSIGNED_INT,
  EP_LONG,
  EP_UNSIGNED_LONG
} event_parameter_type;

The representation of parameters is defined in file gcc/events.c:

/* Parameter structure.  */
struct event_parameter
{
  const char *name;            /* Name for the parameter */
  const void *value;           /* Pointer to data */
  event_parameter_type type;   /* Type enumeration of value */
};

ICI API

register_event_parameter: register a new ICI parameter

Prototype void register_event_parameter (const char *name, const void* value, event_parameter_type type)
API level FICI0
Declared in highlev-plugin.h
Implemented in events.c
Inputs name: name of the parameter
value pointer to data
type type of data
Return value none
Description

Define a new ICI parameter named name, with a pointer value to some data of type. Trigger an internal compiler error (failed assertion) if name is invalid.

Prerequisites

name can be neither NULL nor an empty string. <type> is a valid type defined in event_parameter_type.

Outputs

See also

get_event_parameter_type


get_event_parameter_type: get the type of an ICI event parameter

Prototype event_parameter_type get_event_parameter_type (const char *name)
API level FICI0
Declared in highlev-plugin.h
Implemented in events.c
Inputs name: name of the parameter
Return value EP_VOID if the parameter was found;
otherwise, the type of parameter named name
Description

Prerequisites

Parameter hash table must have been initialized.

Outputs

Informational message if parameters hash table does not exists.

See also

register_event_parameter


Adapt Plugin

Description

Adapt plugin provides support for GCC pass sequence record/substitution, function-specific optimization tuning, function clone and instrumentation. Plugins developed for fine-grain tuning are documented here. These plugins are developed to work with ICI-2.0 interface.


How to use

Adapt plugin is depends on MXML library, which provides XML reading and writing ability.

This plugin behaves differently depending on the ICI_ADAPT_CONTROL environmental variable, which can be either set to 1 to record information of current compilation into XML files or to 2 to reuse passes from XML files to perform passes substitution, function clone and other functionalities.

To use adapt plugin with ICI, ICI_PLUGIN environment variable should be set to the path to the plugin library (.so), and gcc should be called with with either -fici flag or ICI_USE environment parameter.


Known Issue

none

Locations of visitors to this page