From cTuning.org
| Line 230: | Line 230: | ||
|} | |} | ||
| + | === ''initialize_ici_pass_list'': initialize a list of passes for ICI batch execution === | ||
| + | |||
| + | {| cellpadding="5" | ||
| + | | style="vertical-align:top" | | ||
| + | {| border="1" cellspacing="0" cellpadding="3" align="left" style="text-align:left" width="400px" | ||
| + | !Prototype | ||
| + | |<tt>void *initialize_ici_pass_list (int num)</tt> | ||
| + | |- | ||
| + | !API level | ||
| + | | FICI0 | ||
| + | |- | ||
| + | !Declared in | ||
| + | | ''pass-manager.h'' | ||
| + | |- | ||
| + | ! Implemented in | ||
| + | | ''pass-manager.c'' | ||
| + | |- | ||
| + | !Inputs | ||
| + | | ''num:'' maximum number of passes. | ||
| + | |- | ||
| + | !Return value | ||
| + | | array of opt_pass pointers of size (num + 1). | ||
| + | |} | ||
| + | | valign="top" | '''''Description''''' | ||
| + | |||
| + | Initialize a list of NULL pointers of pass type. | ||
| + | |||
| + | '''''Prerequisites''''' | ||
| + | |||
| + | none | ||
| + | |||
| + | '''''Outputs''''' | ||
| + | |||
| + | none | ||
| + | |||
| + | '''''See also''''' | ||
| + | |||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#initialize_ici_pass_list:_initialize_a_list_of_passes_for_ICI_batch_execution|initialize_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#insert_ici_pass_list:_insert_a_pass_into_ICI_pass_list|insert_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning|run_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning|run_ici_pass_list_per_function]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning|delete_ici_pass_list]] | ||
| + | |||
| + | |} | ||
| + | |||
| + | === ''insert_ici_pass_list'': insert a pass into ICI pass list === | ||
| + | |||
| + | {| cellpadding="5" | ||
| + | | style="vertical-align:top" | | ||
| + | {| border="1" cellspacing="0" cellpadding="3" align="left" style="text-align:left" width="400px" | ||
| + | !Prototype | ||
| + | |<tt>void insert_ici_pass_list (void *list, int *cursor, char *name)</tt> | ||
| + | |- | ||
| + | !API level | ||
| + | | FICI0 | ||
| + | |- | ||
| + | !Declared in | ||
| + | | ''pass-manager.h'' | ||
| + | |- | ||
| + | ! Implemented in | ||
| + | | ''pass-manager.c'' | ||
| + | |- | ||
| + | !Inputs | ||
| + | | ''list:'' a pointer to ICI pass list (an array of <tt>opt_pass</tt> pointers).<br />''cursor:'' a pointer to an integer indicating the slot to insert pass into.<br />''name:'' the name of the pass to be inserted. | ||
| + | |- | ||
| + | !Return value | ||
| + | | none | ||
| + | |} | ||
| + | | valign="top" | '''''Description''''' | ||
| + | |||
| + | Insert a pass named <tt>name</tt> into ICI pass list <tt>list</tt> at position specified by <tt>cursor</tt>, and then increase <tt>cursor</tt> by 1. | ||
| + | |||
| + | '''''Prerequisites''''' | ||
| + | |||
| + | An pass named <tt>name</tt> has been registered prior to calling this function.<br /> | ||
| + | The <tt>cursor</tt> indicates an empty slot in <tt>list</tt>. | ||
| + | |||
| + | '''''Outputs''''' | ||
| + | |||
| + | Informational message if the slot specified by <tt>cursor</tt> is not empty prior to calling this function. | ||
| + | |||
| + | '''''See also''''' | ||
| + | |||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#initialize_ici_pass_list:_initialize_a_list_of_passes_for_ICI_batch_execution|initialize_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#insert_ici_pass_list:_insert_a_pass_into_ICI_pass_list|insert_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#run_ici_pass_list:_execute_an_ICI_pass_list_on_current_function|run_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning|run_ici_pass_list_per_function]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning|delete_ici_pass_list]] | ||
| + | |||
| + | |} | ||
| + | |||
| + | === ''run_ici_pass_list'': execute an ICI pass list on current function === | ||
| + | |||
| + | {| cellpadding="5" | ||
| + | | style="vertical-align:top" | | ||
| + | {| border="1" cellspacing="0" cellpadding="3" align="left" style="text-align:left" width="400px" | ||
| + | !Prototype | ||
| + | |<tt>void insert_ici_pass_list (void *list, int *cursor, char *name)</tt> | ||
| + | |- | ||
| + | !API level | ||
| + | | FICI0 | ||
| + | |- | ||
| + | !Declared in | ||
| + | | ''pass-manager.h'' | ||
| + | |- | ||
| + | ! Implemented in | ||
| + | | ''pass-manager.c'' | ||
| + | |- | ||
| + | !Inputs | ||
| + | | ''list:'' a pointer to ICI pass list (an array of <tt>opt_pass</tt> pointers). | ||
| + | |- | ||
| + | !Return value | ||
| + | | none | ||
| + | |} | ||
| + | | valign="top" | '''''Description''''' | ||
| + | |||
| + | Execute an ICI pass list <tt>list</tt> on function being compiled. | ||
| + | |||
| + | '''''Prerequisites''''' | ||
| + | |||
| + | List is not empty and current function is specified in GCC. | ||
| + | |||
| + | '''''Outputs''''' | ||
| + | |||
| + | none | ||
| + | |||
| + | '''''See also''''' | ||
| + | |||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#initialize_ici_pass_list:_initialize_a_list_of_passes_for_ICI_batch_execution|initialize_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#insert_ici_pass_list:_insert_a_pass_into_ICI_pass_list|insert_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning#run_ici_pass_list:_execute_an_ICI_pass_list_on_current_function|run_ici_pass_list]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning|run_ici_pass_list_per_function]] | ||
| + | [[CTools:ICI:Projects:GSOC09:Fine_grain_tuning|delete_ici_pass_list]] | ||
| + | |||
| + | |} | ||
| + | |||
| + | <!-- TODO: more on plugin XML --> | ||
== Adapt Plugin == | == Adapt Plugin == | ||
Revision as of 03:09, 11 August 2009
Google Summer of Code 2009: fine-grain optimizations.
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
Coming soon...
ICI Events
ICI events added to the framework for fine-grain tuning are documented here.
ICI Features
New 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:
/* Datatype of event parameter pointer */
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
| 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 the type of an ICI event parameter
| Description
Get the type of an event parameter. Trigger an internal compiler error if no parameters were registered prior to calling this function. Prerequisites Parameter hash table must have been initialized prior to calling this function. Outputs Informational message if parameters hash table does not exists. See also |
run_pass: run a pass
| Description
Execute the pass registered with name prior to calling this function on current function. Warning: IPA passes should not be execute with this function, use run_ipa_passinstead. Prerequisites A pass of the specified name has been registered prior to calling this function. Outputs none See also |
run_ipa_pass: run an IPA pass
| Description
Execute the IPA pass registered with name prior to calling this function on current function. Prerequisites An IPA pass of the specified name has been registered prior to calling this function. Outputs none See also |
initialize_ici_pass_list: initialize a list of passes for ICI batch execution
| Description
Initialize a list of NULL pointers of pass type. Prerequisites none Outputs none See also initialize_ici_pass_list insert_ici_pass_list run_ici_pass_list run_ici_pass_list_per_function delete_ici_pass_list |
insert_ici_pass_list: insert a pass into ICI pass list
| Description
Insert a pass named name into ICI pass list list at position specified by cursor, and then increase cursor by 1. Prerequisites An pass named name has been registered prior to calling this function. Outputs Informational message if the slot specified by cursor is not empty prior to calling this function. See also initialize_ici_pass_list insert_ici_pass_list run_ici_pass_list run_ici_pass_list_per_function delete_ici_pass_list |
run_ici_pass_list: execute an ICI pass list on current function
| Description
Execute an ICI pass list list on function being compiled. Prerequisites List is not empty and current function is specified in GCC. Outputs none See also initialize_ici_pass_list insert_ici_pass_list run_ici_pass_list run_ici_pass_list_per_function delete_ici_pass_list |
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.
HOWTO
Adapt plugin is depends on Mini-XML 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

