PIPS
|
kernels manipulation More...
#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "text.h"
#include "pipsdbm.h"
#include "resources.h"
#include "properties.h"
#include "misc.h"
#include "control.h"
#include "callgraph.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "effects-convex.h"
#include "text-util.h"
#include "transformations.h"
#include "transformer.h"
#include "semantics.h"
#include "parser_private.h"
#include "accel-util.h"
Go to the source code of this file.
Functions | |
static void | kernel_load_store_generator (statement s, const char *module_name) |
Generate a communication around a statement instead of plain memory access if it is a call to a function named module_name. More... | |
static bool | kernel_load_store_engine (const char *module_name, const string enginerc) |
run kernel load store using either region or effect engine More... | |
bool | kernel_load_store (const char *module_name) |
Generate malloc/copy-in/copy-out on the call sites of this module. More... | |
static bool | do_kernelize (statement s, entity loop_label) |
create a statement eligible for outlining into a kernel #1 find the loop flagged with loop_label #2 make sure the loop is // with local index #3 perform strip mining on this loop to make the kernel appear #4 perform two outlining to separate kernel from host More... | |
bool | kernelize (const string module_name) |
turn a loop flagged with LOOP_LABEL into a kernel (GPU, terapix ...) More... | |
bool | flag_kernel (const string module_name) |
bool | bootstrap_kernels (const string module_name) |
module_name | odule_name |
Definition at line 297 of file kernels.c.
References DB_PUT_MEMORY_RESOURCE, db_resource_p(), make_callees(), module_name(), NIL, and pips_internal_error.
create a statement eligible for outlining into a kernel #1 find the loop flagged with loop_label #2 make sure the loop is // with local index #3 perform strip mining on this loop to make the kernel appear #4 perform two outlining to separate kernel from host
s | statement where the kernel can be found |
loop_label | label of the loop to be turned into a kernel |
gather and check parameters
verify the loop is parallel
we can strip mine the loop
unfortunately, the strip mining does not exactly does what we want, fix it here
it is legal because we know the loop index is private, otherwise the end value of the loop index may be used incorrectly...
validate changes
recompute effects
outline the work and kernel parts
job done
Definition at line 162 of file kernels.c.
References AddLocalEntityToDeclarations(), callees_callees, compute_callees(), CONS, cumulated_effects(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, ENDP, entity_is_argument_p(), execution_sequential_p, gen_recurse_stop(), get_current_module_entity(), get_current_module_name(), get_current_module_statement(), get_int_property(), get_string_property_or_ask(), instruction_loop, instruction_loop_p, loop_body, loop_execution, loop_index, loop_label, loop_locals, loop_range, loop_strip_mine(), make_block_statement(), make_statement_list, module_local_name(), module_reorder(), nb_nodes, outliner(), pips_user_error, proper_effects(), RemoveLocalEntityFromDeclarations(), replace_entity(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), same_entity_p(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), statement_instruction, statement_label, statement_loop(), statement_loop_p(), strdup(), STRING, and user_request().
Referenced by kernelize().
module_name | odule_name |
Definition at line 287 of file kernels.c.
References callees_callees, CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, db_resource_p(), module_name(), pips_internal_error, strdup(), and STRING.
bool kernel_load_store | ( | const char * | module_name | ) |
Generate malloc/copy-in/copy-out on the call sites of this module.
based on convex array regions
module_name | odule_name |
Definition at line 143 of file kernels.c.
References kernel_load_store_engine(), and module_name().
run kernel load store using either region or effect engine
[in] | module_name | is the name of the function we want to isolate with communications and memory allocations |
[in] | enginerc | is the name of the resources to use to analyse which data need to be allocated and transfers. It can be DBR_REGIONS (more precise) or DBR_EFFECTS |
generate a load stores on each caller
prelude
o the job
validate
ostlude
lag the module as kernel if not done
Definition at line 93 of file kernels.c.
References callees_callees, caller_name, compute_callees(), CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, db_put_or_update_memory_resource(), debug_off, debug_on, FOREACH, free_value_mappings(), gen_context_recurse, gen_true2(), get_current_module_entity(), get_current_module_statement(), kernel_load_store_generator(), module_name(), module_name_to_entity(), module_reorder(), module_to_value_mappings(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_precondition_map(), reset_proper_rw_effects(), same_string_p, set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_precondition_map(), set_proper_rw_effects(), statement_domain, strdup(), and STRING.
Referenced by kernel_load_store().
|
static |
Generate a communication around a statement instead of plain memory access if it is a call to a function named module_name.
[in,out] | s | is the statment to isolate with some communication arounds |
[in] | module_name | is the name of the function to isolate |
Generate communication operations around the call to a function named "module_name".
Definition at line 66 of file kernels.c.
References call_function, do_isolate_statement(), get_string_property(), module_local_name(), module_name(), pips_debug, prefix, same_string_p, statement_call(), and statement_call_p().
Referenced by kernel_load_store_engine().
turn a loop flagged with LOOP_LABEL into a kernel (GPU, terapix ...)
module_name | name of the module |
prelude
retreive loop label
run kernelize
validate
ostlude
module_name | odule_name |
Definition at line 259 of file kernels.c.
References compute_callees(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, do_kernelize(), entity_undefined_p, find_label_entity(), gen_context_recurse, gen_null2(), get_current_module_statement(), get_string_property_or_ask(), module_name(), module_name_to_entity(), module_reorder(), pips_user_error, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_domain.