PIPS
|
#include <stdint.h>
#include <stdlib.h>
#include "genC.h"
#include "misc.h"
#include "freia.h"
#include "freia_spoc.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "properties.h"
#include "pipsdbm.h"
#include "freia_spoc_private.h"
#include "hwac.h"
#include "effects-generic.h"
Go to the source code of this file.
Data Structures | |
struct | occs_ctx |
struct | related_ctx |
Macros | |
#define | T true |
#define | F false |
#define | NO_POC { { spoc_poc_unused, 0 }, { spoc_poc_unused, 0 } } |
#define | NO_MES { measure_none, measure_none } |
#define | NOPE_SPOC { spoc_nothing, NO_POC, alu_unused, NO_MES } |
#define | NOPE_TRPX { 0, 0, 0, 0, 0, 0, false, false, NULL } |
#define | NOPE_OPCL { F, F, NULL, NULL } |
#define | NOPE_SIGMAC { "Id", "nop", "width, height", F, 0 } |
#define | NOPE_MPPA {"MPPA_KERNEL_NOP"} |
#define | NO_SPOC { spoc_not_implemented, NO_POC, alu_unused, NO_MES } |
#define | NO_TRPX { 0, 0, 0, 0, 0, -1, false, false, NULL } |
#define | NO_OPCL { F, F, NULL, NULL } |
#define | NO_SIGMAC { "not_implemented", NULL, NULL, F, 0 } |
#define | NO_MPPA {"MPPA_KERNEL_NOP"} |
#define | TRPX_OP(c, op) { 0, 0, 0, 0, 0, c, true, false, "TERAPIX_UCODE_" op } |
#define | TRPX_IO(c, op) { 0, 0, 0, 0, 0, c, true, true, "TERAPIX_UCODE_" op } |
#define | TRPX_NG(c, op) { 1, 1, 1, 1, 0, c, false, false, "TERAPIX_UCODE_" op } |
#define | TRPX_MS(m, c, op) { 0, 0, 0, 0, m, c, true, false, "TERAPIX_UCODE_" op } |
#define | OPCL(op) { T, F, "PIXEL_" op, NULL } |
#define | OPCLK(op, init) { F, T, "PIXEL_" op, "PIXEL_" init } |
#define | SGC_W(ag, pref) { #ag, #pref, "width", T, 1 } |
#define | SGC_WH(ag, pref) { #ag, #pref, "width, height", F, 0 } |
#define | MPPA(kernel) {#kernel} |
#define | TY_INT "int32_t" |
#define | TY_PIN "int32_t *" |
#define | TY_CIP "const int32_t *" |
#define | TY_UIN "uint32_t" |
#define | TY_PUI "uint32_t *" |
#define | NO_PARAM { NULL, NULL, NULL } |
#define | FREIA_AIPO_API_SIZE (sizeof(*FREIA_AIPO_API)/sizeof(freia_api_t)) |
#define | E_WRITE(v) (v) |
#define | E_READ(v) ((void*)(((_int)v)+1)) |
Functions | |
const freia_api_t * | hwac_freia_api (const char *function) |
freia-utils.c More... | |
int | hwac_freia_api_index (const string function) |
returns the index of the description of an AIPO function More... | |
const freia_api_t * | get_freia_api (int index) |
const freia_api_t * | get_freia_api_vtx (dagvtx v) |
static string | get_var (string prefix, int *params) |
string | what_operation (const _int type) |
string | what_operation_shape (const _int type) |
SPoC: set shape depending on hardware component used by vertex. More... | |
void | freia_spoc_set_operation (const freia_api_t *api, _int *type, _int *id) |
??? beurk: I keep the operation as two ints for code regeneration. More... | |
list | freia_get_params (const freia_api_t *api, list args) |
get freia further parameters, skipping image ones More... | |
list | freia_get_vertex_params (const dagvtx v) |
expression | freia_get_nth_scalar_param (const dagvtx v, int n) |
int | freia_max_pixel_value (void) |
list | freia_extract_params (const int napi, list args, string_buffer head, string_buffer head2, hash_table params, int *nparams) |
returns an allocated expression list of the parameters only (i.e. More... | |
call | freia_ok (void) |
build all is well freia constant More... | |
bool | freia_assignment_p (const entity e) |
tell whether it is an assignment to ignore? More... | |
statement | freia_copy_image (const entity source, const entity target) |
void | hwac_replace_statement (statement s, call newc, bool kill) |
replace statement contents with call to c, or continue if kill More... | |
void | hwac_kill_statement (statement s) |
remove contents of statement s. More... | |
bool | freia_image_variable_p (const entity var) |
rather approximative? More... | |
static entity | get_assigned_variable (const statement s) |
for "ret = freia_aipo_*()": return the 'ret' variable... More... | |
bool | entity_freia_api_p (const entity f) |
returns whether the entity is a freia API (AIPO) function. More... | |
bool | freia_statement_aipo_call_p (const statement s) |
returns whether the statement is a FREIA call. More... | |
static void | set_add_scalars (set s, const statement stat, const bool written) |
append simple scalar entities with written/read effects to s scalars assigned to are ignored (return status). More... | |
static bool | real_freia_scalar_rw_dep (const statement s, const statement t, list *vars) |
is there a simple scalar (no image) rw dependency from s to t? WW deps are ignored... More... | |
void | freia_init_dep_cache (void) |
void | freia_close_dep_cache (void) |
bool | freia_scalar_rw_dep (const statement s, const statement t, list *vars) |
static bool | lexpression_equal_p (const list l1, const list l2) |
call | freia_statement_to_call (const statement s) |
return the actual function call from a statement, dealing with assign and returns... More... | |
static bool | is_freia_this_call (const statement s, const string fname) |
bool | is_freia_alloc (const statement s) |
bool | is_freia_dealloc (const statement s) |
bool | same_constant_parameters (const dagvtx v1, const dagvtx v2) |
tell whether v1 and v2 point to statements with the same parameters. More... | |
entity | freia_create_helper_function (const string function_name, list lparams) |
int | freia_substitute_by_helper_call (dag d, set global_remainings, set remainings, list ls, const string function_name, list lparams, set helpers, int preceeding) |
substitute those statement in ls that are in dag d and accelerated by a call to function_name(lparams) also update sets of remainings and global_remainings More... | |
static statement | find_aipo_statement (list ls, bool before) |
void | freia_insert_added_stats (list ls, list stats, bool before) |
insert statements to actual code sequence in "ls" BEWARE that ls is assumed to be in reverse order... More... | |
void | freia_add_image_arguments (list limg, list *lparams) |
prepend limg images in front of the argument list limg is consummed by the operation. More... | |
static int | reference_argument_number (const reference r, const list le) |
return the argument number, starting from 1, of this reference or 0 if not found. More... | |
static bool | reference_written_p (const reference r, const hash_table signatures) |
tell about the image effect. More... | |
static bool | check_ref (reference r, occs_ctx *ctx) |
hack to help replace use-def chains which did not work initially with C. More... | |
static void | check_ref2 (reference r, occs_ctx *ctx) |
static bool | check_stmt (statement s, occs_ctx *ctx) |
hash_table | freia_build_image_occurrences (statement s, set image_occs_stats, hash_table image_stats, const hash_table signatures) |
void | freia_clean_image_occurrences (hash_table occs) |
cleanup occurrence data structure More... | |
bool | freia_aipo_spoc_implemented (const freia_api_t *api) |
whether api available with SPoC More... | |
bool | freia_aipo_terapix_implemented (const freia_api_t *api) |
whether api available with Ter@pix More... | |
bool | freia_convolution_p (dagvtx v) |
is it the convolution special case? More... | |
bool | freia_convolution_width_height (dagvtx v, _int *pw, _int *ph, bool check) |
get width & height of convolution More... | |
static void | clean_stats_to_image (hash_table s2i) |
static statement | image_free (entity v) |
generate statement: "freia_free(v);" More... | |
static bool | related_images_p (const entity img1, const entity img2, const hash_table new_images) |
is there an effect to this image or related images in the statement? More... | |
static bool | related_effect (statement s, struct related_ctx *ctx) |
static bool | some_related_image_effect (statement s, entity img, hash_table new_images, hash_table image_stats, bool write_only) |
static bool | only_minor_statements_in_between (entity image, hash_table new_images, hash_table image_stats, list ls, statement s1, list l2, set image_occurences) |
tell whether there is no image processing statements between s1 and l2 More... | |
list | freia_allocate_new_images_if_needed (list ls, list images, const hash_table occs, const hash_table init, const hash_table signatures) |
insert image allocation if needed, for intermediate image inserted before if an image is used only twice, then it is switched back to the initial one More... | |
int | freia_aipo_count (dag d, int *pa, int *pc) |
static void | oi_call_rwt (call c, set images) |
static void | oi_stmt_rwt (statement s, set images) |
set | freia_compute_output_images (entity module, statement s) |
set | freia_compute_current_output_images (void) |
static string | stat_nb (statement s) |
void | freia_migrate_statements (sequence sq, const set stats, const set before) |
static bool | freia_extract_kernel (expression e, bool strict, intptr_t *k00, intptr_t *k10, intptr_t *k20, intptr_t *k01, intptr_t *k11, intptr_t *k21, intptr_t *k02, intptr_t *k12, intptr_t *k22) |
extract values from a kernel definition return 9 values, expected to be 0/1 elsewhere... More... | |
bool | freia_extract_kernel_vtx (dagvtx v, bool strict, intptr_t *k00, intptr_t *k10, intptr_t *k20, intptr_t *k01, intptr_t *k11, intptr_t *k21, intptr_t *k02, intptr_t *k12, intptr_t *k22) |
vertex-based version More... | |
string | helper_file_name (string func_name, string suffix) |
return malloc'ed "foo.database/Src/%{module}_helper_functions.c" should it depend on the target? no, because we could mix targets? More... | |
Variables | |
static const freia_api_t | FREIA_AIPO_API [] |
!!! there are some underlying assumptions when using this structure: only one of ALU/POC/MES is used per AIPO. More... | |
static hash_table | dep_cache = NULL |
#define E_READ | ( | v | ) | ((void*)(((_int)v)+1)) |
Definition at line 1248 of file freia-utils.c.
#define E_WRITE | ( | v | ) | (v) |
Definition at line 1247 of file freia-utils.c.
#define F false |
Definition at line 51 of file freia-utils.c.
#define FREIA_AIPO_API_SIZE (sizeof(*FREIA_AIPO_API)/sizeof(freia_api_t)) |
Definition at line 450 of file freia-utils.c.
#define MPPA | ( | kernel | ) | {#kernel} |
Definition at line 83 of file freia-utils.c.
#define NO_MES { measure_none, measure_none } |
Definition at line 54 of file freia-utils.c.
#define NO_MPPA {"MPPA_KERNEL_NOP"} |
Definition at line 68 of file freia-utils.c.
Definition at line 66 of file freia-utils.c.
#define NO_PARAM { NULL, NULL, NULL } |
Definition at line 92 of file freia-utils.c.
#define NO_POC { { spoc_poc_unused, 0 }, { spoc_poc_unused, 0 } } |
Definition at line 53 of file freia-utils.c.
#define NO_SIGMAC { "not_implemented", NULL, NULL, F, 0 } |
Definition at line 67 of file freia-utils.c.
#define NO_SPOC { spoc_not_implemented, NO_POC, alu_unused, NO_MES } |
Definition at line 64 of file freia-utils.c.
Definition at line 65 of file freia-utils.c.
#define NOPE_MPPA {"MPPA_KERNEL_NOP"} |
Definition at line 61 of file freia-utils.c.
Definition at line 59 of file freia-utils.c.
#define NOPE_SIGMAC { "Id", "nop", "width, height", F, 0 } |
Definition at line 60 of file freia-utils.c.
#define NOPE_SPOC { spoc_nothing, NO_POC, alu_unused, NO_MES } |
Definition at line 57 of file freia-utils.c.
Definition at line 58 of file freia-utils.c.
Definition at line 77 of file freia-utils.c.
Definition at line 78 of file freia-utils.c.
#define SGC_W | ( | ag, | |
pref | |||
) | { #ag, #pref, "width", T, 1 } |
Definition at line 80 of file freia-utils.c.
#define SGC_WH | ( | ag, | |
pref | |||
) | { #ag, #pref, "width, height", F, 0 } |
Definition at line 81 of file freia-utils.c.
Definition at line 50 of file freia-utils.c.
Definition at line 71 of file freia-utils.c.
Definition at line 75 of file freia-utils.c.
Definition at line 72 of file freia-utils.c.
Definition at line 70 of file freia-utils.c.
#define TY_CIP "const int32_t *" |
Definition at line 88 of file freia-utils.c.
#define TY_INT "int32_t" |
Definition at line 86 of file freia-utils.c.
#define TY_PIN "int32_t *" |
Definition at line 87 of file freia-utils.c.
#define TY_PUI "uint32_t *" |
Definition at line 90 of file freia-utils.c.
#define TY_UIN "uint32_t" |
Definition at line 89 of file freia-utils.c.
hack to help replace use-def chains which did not work initially with C.
occurrences is: <image entity> -> { set of statements } this is really a ugly hack, sorry! ??? I should also consider declarations, but as they should only contain image allocations so there should be no problem.
Definition at line 1328 of file freia-utils.c.
References _intFMT, E_READ, E_WRITE, occs_ctx::enclosing, entity_name, freia_image_variable_p(), gen_get_ancestor(), hash_defined_p(), hash_get(), hash_put(), occs_ctx::image_occs_stats, occs_ctx::image_stats, occs_ctx::occs, pips_assert, pips_debug, reference_variable, reference_written_p(), set_add_element(), set_make(), set_pointer, occs_ctx::signatures, statement_domain, statement_number, and written.
Referenced by check_ref2(), and freia_build_image_occurrences().
Definition at line 1362 of file freia-utils.c.
References check_ref().
Referenced by check_stmt().
Definition at line 1367 of file freia-utils.c.
References _intFMT, check_ref2(), E_READ, E_WRITE, occs_ctx::enclosing, entity_initial, FOREACH, gen_context_recurse, gen_true2(), hash_put(), occs_ctx::image_stats, pips_debug, reference_domain, set_make(), set_pointer, statement_declarations, and statement_number.
Referenced by freia_build_image_occurrences().
|
static |
Definition at line 1463 of file freia-utils.c.
References HASH_FOREACH, hash_table_free(), and set_free().
Referenced by freia_allocate_new_images_if_needed().
returns whether the entity is a freia API (AIPO) function.
Definition at line 806 of file freia-utils.c.
References AIPO, entity_local_name(), and f().
Referenced by dag_append_freia_call(), fcs_call_flt(), and freia_statement_aipo_call_p().
Definition at line 1147 of file freia-utils.c.
References _intFMT, CAR, FOREACH, gen_last(), gen_length(), pips_assert, pips_debug, STATEMENT, and statement_number.
Referenced by freia_insert_added_stats().
prepend limg images in front of the argument list limg is consummed by the operation.
limg | img |
lparams | params |
Definition at line 1233 of file freia-utils.c.
References CONS, entity_to_expression(), FOREACH, gen_free_list(), gen_nconc(), gen_nreverse(), lparams, and NIL.
Referenced by freia_spoc_pipeline(), freia_terapix_call(), and opencl_compile_mergeable_dag().
pa | a |
pc | c |
Definition at line 1823 of file freia-utils.c.
References AIPO, dag_vertices, dagvtx_function_name(), FOREACH, and same_string_p.
Referenced by freia_opencl_compile_calls().
bool freia_aipo_spoc_implemented | ( | const freia_api_t * | api | ) |
whether api available with SPoC
api | pi |
Definition at line 1418 of file freia-utils.c.
References pips_assert, freia_api_t::spoc, spoc_not_implemented, and spoc_hw_t::used.
bool freia_aipo_terapix_implemented | ( | const freia_api_t * | api | ) |
whether api available with Ter@pix
api | pi |
Definition at line 1426 of file freia-utils.c.
References AIPO, terapix_hw_t::cost, freia_api_t::function_name, pips_assert, same_string_p, and freia_api_t::terapix.
Referenced by dagvtx_terapix_priority().
list freia_allocate_new_images_if_needed | ( | list | ls, |
list | images, | ||
const hash_table | occs, | ||
const hash_table | init, | ||
const hash_table | signatures | ||
) |
insert image allocation if needed, for intermediate image inserted before if an image is used only twice, then it is switched back to the initial one
This could/should be improved:
ls | list of statements to consider |
images | list of entities to check and maybe allocate |
init | new image -> initial image |
signatures | helper -> _int # written args ahead (may be NULL) |
ls | s |
images | mages |
occs | ccs |
init | nit |
signatures | ignatures |
Definition at line 1650 of file freia-utils.c.
References CAR, clean_stats_to_image(), CONS, E_READ, E_WRITE, entity_local_name(), entity_name, FOREACH, free_sequence(), freia_build_image_occurrences(), freia_clean_image_occurrences(), freia_memory_management_statement(), freia_switch_image_in_statement(), gen_free_list(), gen_last(), get_bool_property(), get_current_module_statement(), hash_defined_p(), hash_get(), hash_pointer, hash_put(), hash_table_make(), image_free(), init, insert_statement(), make_sequence(), NIL, only_minor_statements_in_between(), pips_assert, pips_debug, pips_user_warning, s1, sequence_statements, set_add_element(), set_belong_p(), set_free(), set_make(), set_pointer, set_size(), set_to_list(), STATEMENT, statement_sequence(), and statement_sequence_p().
Referenced by freia_aipo_compile_calls(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
tell whether it is an assignment to ignore?
Definition at line 703 of file freia-utils.c.
References ENTITY_ASSIGN_P, and ENTITY_BITWISE_OR_UPDATE_P.
Referenced by fcs_call_flt(), freia_statement_aipo_call_p(), freia_statement_to_call(), get_assigned_variable(), and hwac_replace_statement().
hash_table freia_build_image_occurrences | ( | statement | s, |
set | image_occs_stats, | ||
hash_table | image_stats, | ||
const hash_table | signatures | ||
) |
image_occs_stats | set of statements with image occurences (may be NULL) |
signatures | helper entity -> (_int) # out args |
image_occs_stats | mage_occs_stats |
image_stats | mage_stats |
signatures | ignatures |
Definition at line 1388 of file freia-utils.c.
References check_ref(), check_stmt(), gen_context_multi_recurse(), gen_null(), hash_pointer, hash_table_make(), occs_ctx::occs, pips_debug, reference_domain, and statement_domain.
Referenced by freia_allocate_new_images_if_needed(), and freia_compile().
void freia_clean_image_occurrences | ( | hash_table | occs | ) |
cleanup occurrence data structure
occs | ccs |
Definition at line 1407 of file freia-utils.c.
References HASH_FOREACH, hash_table_free(), and set_free().
Referenced by freia_allocate_new_images_if_needed(), and freia_compile().
void freia_close_dep_cache | ( | void | ) |
Definition at line 915 of file freia-utils.c.
References dep_cache, gen_free_list(), HASH_FOREACH, hash_table_free(), pips_assert, and s1.
Referenced by freia_compile().
set freia_compute_current_output_images | ( | void | ) |
Definition at line 1885 of file freia-utils.c.
References freia_compute_output_images(), get_current_module_entity(), and get_current_module_statement().
Referenced by freia_compile().
module | odule |
Definition at line 1866 of file freia-utils.c.
References call_domain, FOREACH, freia_image_variable_p(), gen_context_multi_recurse(), gen_true(), module, module_functional_parameters, oi_call_rwt(), oi_stmt_rwt(), set_add_element(), set_make(), set_pointer, and statement_domain.
Referenced by freia_compute_current_output_images().
is it the convolution special case?
Definition at line 1441 of file freia-utils.c.
References dagvtx_operation(), and same_string_p.
Referenced by dag_terapix_measures(), sc_inst(), sigmac_params_decl(), terapix_gram_management(), terapix_macro_code(), and update_erosions().
get width & height of convolution
pw | w |
ph | h |
check | heck |
Definition at line 1449 of file freia-utils.c.
References CAR, CDR, EXPRESSION, expression_integer_value(), freia_get_vertex_params(), gen_length(), and pips_assert.
Referenced by dag_terapix_measures(), terapix_gram_management(), terapix_macro_code(), and update_erosions().
source | ource |
target | arget |
Definition at line 710 of file freia-utils.c.
References AIPO, call_to_statement, CONS, entity_to_expression(), local_name_to_top_level_entity(), make_call(), and NIL.
Referenced by freia_dag_optimize().
function_name | unction_name |
lparams | params |
Definition at line 1030 of file freia-utils.c.
References CONS, copy_type(), debug_off, debug_on, entity_function_p(), entity_type, expression_to_user_type(), FOREACH, functional_result, gen_nreverse(), local_name_to_top_level_entity(), lparams, make_dummy_unknown(), make_empty_function(), make_language_c(), make_mode_value(), make_parameter(), module_functional_parameters, NIL, pips_assert, and type_functional.
Referenced by freia_substitute_by_helper_call(), mppa_call_helper(), opencl_generate_special_kernel_ops(), and sc_delimiter().
|
static |
extract values from a kernel definition return 9 values, expected to be 0/1 elsewhere...
Definition at line 1957 of file freia-utils.c.
References brace_expression_p(), call_arguments, CAR, CDR, entity_initial, EXPRESSION, expression_integer_value(), expression_reference_p(), expression_syntax, expression_variable(), gen_length(), NIL, pips_assert, syntax_call, value_expression, and value_expression_p.
Referenced by freia_extract_kernel_vtx().
bool freia_extract_kernel_vtx | ( | dagvtx | v, |
bool | strict, | ||
intptr_t * | k00, | ||
intptr_t * | k10, | ||
intptr_t * | k20, | ||
intptr_t * | k01, | ||
intptr_t * | k11, | ||
intptr_t * | k21, | ||
intptr_t * | k02, | ||
intptr_t * | k12, | ||
intptr_t * | k22 | ||
) |
vertex-based version
strict | trict |
k00 | 00 |
k10 | 10 |
k20 | 20 |
k01 | 01 |
k11 | 11 |
k21 | 21 |
k02 | 02 |
k12 | 12 |
k22 | 22 |
Definition at line 2012 of file freia-utils.c.
References CAR, EXPRESSION, freia_extract_kernel(), and freia_get_vertex_params().
Referenced by constant_image_p(), copy_image_p(), dagvtx_constant_kernel_p(), erosion_optimization(), mppa_compile_dag(), mppa_helper_args_params(), opencl_compile_mergeable_dag(), opencl_generate_special_kernel_ops(), opencl_merge_and_compile(), sc_kernel_compute_loop(), and sc_print_kernel().
list freia_extract_params | ( | const int | napi, |
list | args, | ||
string_buffer | head, | ||
string_buffer | head2, | ||
hash_table | params, | ||
int * | nparams | ||
) |
returns an allocated expression list of the parameters only (i.e.
do not include the input & output images). params maps variables (if so) to already present parameters names. the extraction function allocs new parameter names if necessary. of expression
napi | api |
args | rgs |
head | ead |
head2 | ead2 |
params | arams |
nparams | params |
Definition at line 612 of file freia-utils.c.
References freia_api_t::arg_in_types, freia_api_t::arg_misc_in, freia_api_t::arg_misc_out, freia_api_t::arg_out_types, CAR, CDR, CONS, copy_expression(), entity_undefined_p, entity_variable_p, EXPRESSION, expression_to_entity(), free(), freia_get_params(), gen_length(), gen_nreverse(), get_bool_property(), get_freia_api(), get_var(), hash_defined_p(), hash_get(), hash_put(), NIL, params, pips_assert, and sb_cat.
Referenced by freia_spoc_pipeline(), freia_terapix_call(), opencl_compile_mergeable_dag(), same_constant_parameters(), and sc_get_params_values().
expression freia_get_nth_scalar_param | ( | const dagvtx | v, |
int | n | ||
) |
Definition at line 589 of file freia-utils.c.
References CAR, EXPRESSION, freia_get_vertex_params(), and gen_nthcdr().
Referenced by constant_image_p(), copy_image_p(), and propagate_constant_image().
list freia_get_params | ( | const freia_api_t * | api, |
list | args | ||
) |
get freia further parameters, skipping image ones
api | pi |
args | rgs |
Definition at line 569 of file freia-utils.c.
References freia_api_t::arg_img_in, freia_api_t::arg_img_out, freia_api_t::arg_misc_in, freia_api_t::arg_misc_out, CDR, gen_length(), and pips_assert.
Referenced by freia_extract_params(), and freia_get_vertex_params().
Definition at line 578 of file freia-utils.c.
References call_arguments, dagvtx_content, dagvtx_freia_api, freia_get_params(), freia_statement_to_call(), pips_assert, pstatement_statement, pstatement_statement_p, and vtxcontent_source.
Referenced by freia_convolution_width_height(), freia_extract_kernel_vtx(), freia_get_nth_scalar_param(), freia_terapix_call(), gram_param(), has_vtx_dynamic_params(), mppa_compile_dag(), mppa_helper_args_params(), sc_delimiter(), sc_inst(), sc_kernel_specific_agent(), sigmac_params_decl(), spoc_alu_conf(), spoc_measure_conf(), spoc_poc_conf(), spoc_th_conf(), and terapix_gram_management().
rather approximative?
var | ar |
Definition at line 768 of file freia-utils.c.
References basic_pointer, basic_pointer_p, basic_typedef, basic_typedef_p, entity_local_name(), entity_name, entity_pointer_p(), entity_type, entity_undefined, entity_variable_p, FREIA_IMAGE_TYPE, pips_debug, same_string_p, type_variable, ultimate_type(), and variable_basic.
Referenced by check_ref(), collect_images(), fis_call_flt(), freia_compute_output_images(), freia_shuffle_move_forward(), freia_some_effects_on_images(), image_ref_flt(), oi_call_rwt(), ref_count_rwt(), seq_rwt(), and set_add_scalars().
void freia_init_dep_cache | ( | void | ) |
Definition at line 909 of file freia-utils.c.
References dep_cache, hash_pointer, hash_table_make(), and pips_assert.
Referenced by freia_compile().
insert statements to actual code sequence in "ls" BEWARE that ls is assumed to be in reverse order...
ls | s |
stats | tats |
before | efore |
Definition at line 1185 of file freia-utils.c.
References _intFMT, call_arguments, call_function, CAR, CONS, ENTITY_C_RETURN_P, EXPRESSION, expression_constant_p(), find_aipo_statement(), gen_nconc(), instruction_call, instruction_call_p, instruction_to_statement(), make_instruction_sequence(), make_sequence(), NIL, pips_debug, pips_internal_error, statement_comments, statement_instruction, statement_number, STATEMENT_NUMBER_UNDEFINED, and string_undefined.
Referenced by freia_aipo_compile_calls(), freia_mppa_compile_calls(), freia_opencl_compile_calls(), and sc_delimiter().
int freia_max_pixel_value | ( | void | ) |
Definition at line 594 of file freia-utils.c.
References FREIA_DEFAULT_BPP, and pips_user_error.
Referenced by constant_image_p(), and copy_image_p().
sq | q |
stats | tats |
before | efore |
Definition at line 1905 of file freia-utils.c.
References CONS, FOREACH, gen_free_list(), gen_length(), gen_nconc(), gen_nreverse(), ifdebug, lend(), NIL, pips_assert, pips_debug, sequence_statements, set_belong_p(), set_fprint(), set_size(), and stat_nb().
Referenced by freia_mppa_compile_calls(), freia_opencl_compile_calls(), migrate_statements(), and sc_delimiter().
call freia_ok | ( | void | ) |
build all is well freia constant
Definition at line 695 of file freia-utils.c.
References local_name_to_top_level_entity(), make_call(), and NIL.
Referenced by freia_cleanup_status(), hwac_kill_statement(), mppa_call_helper(), and sc_delimiter().
vars | ars |
Definition at line 929 of file freia-utils.c.
References dep_cache, gen_copy_seq(), hash_defined_p(), hash_get(), hash_pointer, hash_put(), hash_table_make(), NIL, pips_assert, and real_freia_scalar_rw_dep().
Referenced by all_previous_stats_with_deps_are_computed(), any_scalar_dep(), and dagvtx_dot().
void freia_spoc_set_operation | ( | const freia_api_t * | api, |
_int * | type, | ||
_int * | id | ||
) |
??? beurk: I keep the operation as two ints for code regeneration.
api | pi |
type | ype |
id | d |
Definition at line 545 of file freia-utils.c.
References freia_api_t::function_name, hwac_freia_api_index(), pips_assert, freia_api_t::spoc, spoc_alu, spoc_measure_0, spoc_measure_1, spoc_not_implemented, spoc_poc_0, spoc_poc_1, spoc_th_0, spoc_th_1, spoc_type_alu, spoc_type_mes, spoc_type_nop, spoc_type_poc, spoc_type_sni, spoc_type_thr, and spoc_hw_t::used.
Referenced by dag_append_freia_call().
returns whether the statement is a FREIA call.
Definition at line 814 of file freia-utils.c.
References call_arguments, call_function, CAR, CDR, ENTITY_C_RETURN_P, entity_freia_api_p(), EXPRESSION, expression_syntax, freia_assignment_p(), gen_length(), instruction_call, instruction_call_p, pips_assert, statement_instruction, syntax_call, and syntax_call_p.
Referenced by clean_list_head(), freia_cleanup_sequence_rec(), freia_reduction_variable(), fsi_seq_flt(), fsi_stmt_flt(), and set_add_scalars().
return the actual function call from a statement, dealing with assign and returns...
return NULL if not a call.
Definition at line 973 of file freia-utils.c.
References call_arguments, call_function, CAR, CDR, ENTITY_C_RETURN_P, EXPRESSION, expression_syntax, freia_assignment_p(), gen_length(), instruction_call, instruction_call_p, pips_assert, statement_instruction, syntax_call, and syntax_call_p.
Referenced by any_use_statement(), dag_append_freia_call(), dag_normalize(), dagvtx_copy_list_dot(), fcs_count(), freia_alloc_stat_p(), freia_cleanup_sequence_rec(), freia_get_vertex_params(), freia_reduction_variable(), freia_spoc_pipeline(), freia_stmt_free_p(), freia_terapix_call(), get_upper_model(), is_freia_this_call(), maybe_unroll_while_rwt(), opencl_compile_mergeable_dag(), opencl_generate_special_kernel_ops(), same_constant_parameters(), sc_get_params_values(), set_aipo_call(), and substitute_image_in_statement().
int freia_substitute_by_helper_call | ( | dag | d, |
set | global_remainings, | ||
set | remainings, | ||
list | ls, | ||
const string | function_name, | ||
list | lparams, | ||
set | helpers, | ||
int | preceeding | ||
) |
substitute those statement in ls that are in dag d and accelerated by a call to function_name(lparams) also update sets of remainings and global_remainings
the function must chose one of the statements? the current implementation is a buggy mess. it should be fully re-thought from scratch.
what should be done, is to chose the FIRST statement after the LAST dependency of the compiled statements? at least it must exist beacause one of the dependent statement must appear after that, but is it enough for all possible graph? so maybe we should do a topological sort of all the statements and reshuffle everything instead of trying to preserver the initial code as much as possible?
global_remainings | lobal_remainings |
remainings | emainings |
ls | of statement |
function_name | unction_name |
lparams | params |
helpers | elpers |
preceeding | receeding |
Definition at line 1073 of file freia-utils.c.
References _intFMT, dag_vertices, dagvtx_content, FOREACH, freia_create_helper_function(), gen_length(), hwac_replace_statement(), lparams, make_call(), pips_assert, pips_debug, pips_user_warning, pstatement_statement, pstatement_statement_p, set_add_element(), set_belong_p(), set_difference(), set_free(), set_make(), set_pointer, statement_call_p(), statement_number, and vtxcontent_source.
Referenced by freia_trpx_compile_one_dag(), and opencl_compile_mergeable_dag().
for "ret = freia_aipo_*()": return the 'ret' variable...
return NULL if not an assignment
Definition at line 793 of file freia-utils.c.
References call_arguments, call_function, CAR, EXPRESSION, expression_to_entity(), freia_assignment_p(), instruction_call, pips_assert, statement_call_p(), and statement_instruction.
Referenced by set_add_scalars().
const freia_api_t* get_freia_api | ( | int | index | ) |
index | ndex |
Definition at line 477 of file freia-utils.c.
References FREIA_AIPO_API.
Referenced by commutative_operation_p(), constant_image_p(), copy_image_p(), dagvtx_compact_operation(), dagvtx_function_name(), dagvtx_is_measurement_p(), dagvtx_is_operator_p(), freia_extract_params(), freia_spoc_pipeline(), freia_terapix_call(), get_freia_api_vtx(), opencl_compile_mergeable_dag(), and propagate_constant_image().
const freia_api_t* get_freia_api_vtx | ( | dagvtx | v | ) |
Definition at line 483 of file freia-utils.c.
References dagvtx_content, get_freia_api(), and vtxcontent_opid.
Referenced by dagvtx_constant_kernel_p(), has_vtx_dynamic_params(), mppa_compile_dag(), opencl_generate_special_kernel_ops(), opencl_merge_and_compile(), sc_delimiter(), sc_inst(), sc_vtx_tostring(), sigmac_name_instances(), and sigmac_params_decl().
Definition at line 491 of file freia-utils.c.
References cat, i2a(), params, prefix, and strdup().
Referenced by freia_extract_params().
return malloc'ed "foo.database/Src/%{module}_helper_functions.c" should it depend on the target? no, because we could mix targets?
func_name | unc_name |
suffix | uffix |
Definition at line 2029 of file freia-utils.c.
References cat, db_get_directory_name_for_module(), free(), HELPER, and strdup().
Referenced by freia_compile(), and sc_delimiter().
const freia_api_t* hwac_freia_api | ( | const char * | function | ) |
function | unction |
Definition at line 455 of file freia-utils.c.
References FREIA_AIPO_API, freia_api_t::function_name, hash_defined_p(), hash_get(), hash_put(), hash_string, and hash_table_make().
Referenced by dag_append_freia_call(), freia_cleanup_sequence_rec(), freia_terapix_call(), hwac_freia_api_index(), reference_written_p(), sio_call_flt(), and swis_call_flt().
returns the index of the description of an AIPO function
function | unction |
Definition at line 471 of file freia-utils.c.
References FREIA_AIPO_API, and hwac_freia_api().
Referenced by commutative_operation_p(), dag_normalize(), freia_spoc_set_operation(), set_aipo_call(), switch_vertex_to_a_copy(), and switch_vertex_to_assign().
void hwac_kill_statement | ( | statement | s | ) |
remove contents of statement s.
Definition at line 761 of file freia-utils.c.
References freia_ok(), and hwac_replace_statement().
Referenced by freia_dag_optimize(), freia_spoc_pipeline(), freia_terapix_call(), and opencl_compile_mergeable_dag().
replace statement contents with call to c, or continue if kill
newc | ewc |
kill | ill |
Definition at line 720 of file freia-utils.c.
References call_arguments, call_function, call_to_expression(), CAR, CDR, CONS, ENTITY_C_RETURN_P, EXPRESSION, free_call(), free_expression(), free_instruction(), freia_assignment_p(), gen_free_list(), gen_full_free_list(), gen_length(), instruction_call, instruction_call_p, make_continue_instruction(), make_instruction_call(), NIL, pips_assert, and statement_instruction.
Referenced by freia_substitute_by_helper_call(), hwac_kill_statement(), mppa_call_helper(), and sc_delimiter().
generate statement: "freia_free(v);"
Definition at line 1484 of file freia-utils.c.
References call_to_statement, CONS, entity_to_expression(), FREIA_FREE, local_name_to_top_level_entity(), make_call(), and NIL.
Referenced by freia_allocate_new_images_if_needed().
Definition at line 1002 of file freia-utils.c.
References FREIA_ALLOC, and is_freia_this_call().
Referenced by freia_cmp_statement(), freia_memory_management_statement(), and get_upper_model().
Definition at line 1007 of file freia-utils.c.
References FREIA_FREE, and is_freia_this_call().
Referenced by freia_cleanup_sequence_rec(), freia_cmp_statement(), and freia_memory_management_statement().
Definition at line 995 of file freia-utils.c.
References call_function, entity_user_name(), freia_statement_to_call(), and same_string_p.
Referenced by is_freia_alloc(), and is_freia_dealloc().
Definition at line 953 of file freia-utils.c.
References CAR, CDR, EXPRESSION, expression_equal_p(), and gen_length().
Referenced by same_constant_parameters().
Definition at line 1841 of file freia-utils.c.
References call_arguments, call_function, CAR, entity_local_name(), ENTITY_RETURN_P, EXPRESSION, expression_to_entity(), freia_image_variable_p(), FREIA_OUTPUT, same_string_p, and set_add_element().
Referenced by freia_compute_output_images(), and oi_stmt_rwt().
Definition at line 1855 of file freia-utils.c.
References call_domain, entity_initial, FOREACH, gen_context_recurse, gen_true2(), oi_call_rwt(), and statement_declarations.
Referenced by freia_compute_output_images().
|
static |
tell whether there is no image processing statements between s1 and l2
Definition at line 1572 of file freia-utils.c.
References _intFMT, bool_to_string(), entity_local_name(), FOREACH, gen_in_list_p(), gen_length(), ifdebug, related_ctx::image_stats, related_ctx::new_images, pips_assert, pips_debug, pips_user_warning, s1, set_belong_p(), some_related_image_effect(), and statement_number.
Referenced by freia_allocate_new_images_if_needed().
is there a simple scalar (no image) rw dependency from s to t? WW deps are ignored...
should be okay of computed in order?
s | source statement |
t | target statement |
vars | if set, return list of scalars which hold the dependencies |
Definition at line 881 of file freia-utils.c.
References _intFMT, compare_entities(), pips_debug, set_add_scalars(), set_empty_p(), set_free(), set_intersection(), set_make(), set_pointer, set_to_sorted_list(), and statement_number.
Referenced by freia_scalar_rw_dep().
return the argument number, starting from 1, of this reference or 0 if not found.
Definition at line 1253 of file freia-utils.c.
References expression_reference(), expression_reference_p(), and FOREACH.
Referenced by reference_written_p().
|
static |
tell about the image effect.
if in doubt, return true.
Definition at line 1267 of file freia-utils.c.
References freia_api_t::arg_img_out, call_arguments, call_domain, call_function, entity_local_name(), gen_get_ancestor(), hash_defined_p(), hash_get(), hwac_freia_api(), if(), int, pips_debug, pips_internal_error, reference_argument_number(), reference_variable, and written.
Referenced by check_ref().
|
static |
Definition at line 1524 of file freia-utils.c.
References _intFMT, E_READ, E_WRITE, entity_local_name(), gen_recurse_stop(), hash_get(), related_ctx::image_stats, related_ctx::img, related_ctx::new_images, pips_assert, pips_debug, related_images_p(), SET_FOREACH, related_ctx::some_effect, statement_number, related_ctx::write_only, and written.
Referenced by some_related_image_effect().
|
static |
is there an effect to this image or related images in the statement?
are img1 and img2 related?
Definition at line 1504 of file freia-utils.c.
References entity_local_name(), hash_defined_p(), hash_get(), and pips_debug.
Referenced by related_effect().
tell whether v1 and v2 point to statements with the same parameters.
v1 | 1 |
v2 | 2 |
Definition at line 1014 of file freia-utils.c.
References call_arguments, dagvtx_opid(), dagvtx_statement(), freia_extract_params(), freia_statement_to_call(), gen_free_list(), and lexpression_equal_p().
Referenced by freia_dag_optimize().
append simple scalar entities with written/read effects to s scalars assigned to are ignored (return status).
no attempt at managing aliasing or the like...
Definition at line 850 of file freia-utils.c.
References effect_any_reference, effect_read_p, effect_write_p, effects_effects, entity_pointer_p(), entity_scalar_p(), entity_variable_p, FOREACH, freia_image_variable_p(), freia_statement_aipo_call_p(), get_assigned_variable(), load_cumulated_rw_effects(), malloc_effect_p(), reference_variable, set_add_element(), and written.
Referenced by real_freia_scalar_rw_dep().
|
static |
Definition at line 1558 of file freia-utils.c.
References gen_context_recurse, gen_null2(), related_ctx::image_stats, related_ctx::img, related_ctx::new_images, related_effect(), related_ctx::some_effect, statement_domain, and related_ctx::write_only.
Referenced by only_minor_statements_in_between().
Definition at line 1893 of file freia-utils.c.
References i2a(), and statement_number.
Referenced by freia_migrate_statements().
Definition at line 499 of file freia-utils.c.
References spoc_type_alu, spoc_type_inp, spoc_type_mes, spoc_type_nop, spoc_type_oth, spoc_type_out, spoc_type_poc, spoc_type_sni, and spoc_type_thr.
Referenced by basic_spoc_conf(), comment(), dagvtx_dump(), generate_wiring(), print_op_schedule(), and where_to_perform_operation().
SPoC: set shape depending on hardware component used by vertex.
Definition at line 518 of file freia-utils.c.
References spoc_type_alu, spoc_type_inp, spoc_type_mes, spoc_type_nop, spoc_type_oth, spoc_type_out, spoc_type_poc, and spoc_type_thr.
Referenced by dagvtx_dot().
|
static |
Definition at line 907 of file freia-utils.c.
Referenced by freia_close_dep_cache(), freia_init_dep_cache(), and freia_scalar_rw_dep().
|
static |
!!! there are some underlying assumptions when using this structure: only one of ALU/POC/MES is used per AIPO.
only the first of two POC or MES is used per AIPO. ??? conversions between 8/16 bits images are definitely not handled here.
Definition at line 99 of file freia-utils.c.
Referenced by get_freia_api(), hwac_freia_api(), and hwac_freia_api_index().