PIPS
|
#include <stdint.h>
#include <stdlib.h>
#include "genC.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "properties.h"
#include "freia.h"
#include "hwac.h"
Go to the source code of this file.
Macros | |
#define | VARSHIFT(v, n) (((char*)v)+(n)) |
#define | RED " = redres." |
Functions | |
static string | get_opencl_file_name (string func_name) |
static bool | opencl_mergeable_p (const dagvtx v) |
static int | dagvtx_opencl_priority (const dagvtx *pv1, const dagvtx *pv2) |
qsort helper: return -1 for v1 before v2 More... | |
static dagvtx | choose_opencl_vertex (const list lv, bool started) |
choose a vertex, avoiding other stuff if the list is started More... | |
static string | opencl_type (string t) |
static string | pixel_name (dagvtx v, int shft, set loaded, string_buffer load, list inputs, string indentation) |
generate a load if needed for an input variable return the holding variable name in a statically allocated array More... | |
static int | opencl_compile_mergeable_dag (string module, dag d, list ls, string split_name, int n_cut, set global_remainings, hash_table signatures, FILE *helper_file, FILE *opencl_file, set helpers, int stnb) |
perform OpenCL compilation on mergeable dag the generated code relies on some freia-provided runtime may be called on a one vertex dag for kernel operations More... | |
static void | opencl_generate_special_kernel_ops (string module, dagvtx v, hash_table signatures, FILE *helper_file, FILE *opencl_file, set helpers) |
call and generate if necessary a specialized kernel, if possible the statement is bluntly modified "in place". More... | |
static bool | dagvtx_constant_kernel_p (const dagvtx v) |
is v a constant kernel operation? More... | |
static int | compile_this_list (string module, list lvertices, list ls, string split_name, int n_cut, set global_remainings, hash_table signatures, FILE *helper_file, FILE *opencl, set helpers, set output_images, dag fulld, int stnb, int max_stnb) |
static void | migrate_statements (list lvertices, sequence sq, set dones) |
migrate the statements corresponding to the vertices so that they are one next to the other in the sequence. More... | |
static bool | vertex_mergeable_p (const dagvtx v, const set s, const dag d) |
return if the vertex can be merged in the set More... | |
static void | opencl_merge_and_compile (string module, sequence sq, list ls, dag d, string fname_fulldag, int n_split, const dag fulld, const set output_images, FILE *helper_file, FILE *opencl, set helpers, hash_table signatures) |
extract subdags of merged operations and compile them More... | |
list | freia_opencl_compile_calls (string module, dag fulld, sequence sq, list ls, const hash_table occs, hash_table exchanges, const set output_images, FILE *helper_file, set helpers, int number, hash_table signatures) |
freia_opencl.c More... | |
Variables | |
static string | border_condition [9] |
#define RED " = redres." |
#define VARSHIFT | ( | v, | |
n | |||
) | (((char*)v)+(n)) |
choose a vertex, avoiding other stuff if the list is started
Definition at line 82 of file freia_opencl.c.
References CAR, DAGVTX, dagvtx_other_stuff_p(), FOREACH, and pips_assert.
Referenced by freia_opencl_compile_calls().
|
static |
Definition at line 945 of file freia_opencl.c.
References copy_dagvtx_norec(), dag_append_vertex(), dag_cleanup_other_statements(), dag_compute_outputs(), FOREACH, freia_hack_fix_global_ins_outs(), make_dag(), module, NIL, and opencl_compile_mergeable_dag().
Referenced by opencl_merge_and_compile().
is v a constant kernel operation?
Definition at line 936 of file freia_opencl.c.
References freia_extract_kernel_vtx(), get_freia_api_vtx(), intptr_t, opencl_hw_t::mergeable_kernel, and freia_api_t::opencl.
Referenced by opencl_merge_and_compile().
qsort helper: return -1 for v1 before v2
Definition at line 68 of file freia_opencl.c.
References dagvtx_number(), and opencl_mergeable_p().
Referenced by freia_opencl_compile_calls(), and opencl_merge_and_compile().
list freia_opencl_compile_calls | ( | string | module, |
dag | fulld, | ||
sequence | sq, | ||
list | ls, | ||
const hash_table | occs, | ||
hash_table | exchanges, | ||
const set | output_images, | ||
FILE * | helper_file, | ||
set | helpers, | ||
int | number, | ||
hash_table | signatures | ||
) |
module | odule |
fulld | ulld |
sq | q |
ls | s |
occs | ccs |
exchanges | xchanges |
output_images | utput_images |
helper_file | elper_file |
helpers | elpers |
number | umber |
signatures | ignatures |
Definition at line 1371 of file freia_opencl.c.
References cat, choose_opencl_vertex(), dag_dot_dump_prefix(), dag_fix_image_reuse(), dag_no_image_operation(), dag_split_on_scalars(), dag_statements(), dagvtx_opencl_priority(), dagvtx_other_stuff_p(), file_readable_p(), FOREACH, fprintf(), free(), freia_aipo_count(), freia_allocate_new_images_if_needed(), freia_dag_optimize(), freia_insert_added_stats(), freia_migrate_statements(), FREIA_OPENCL_CL_INCLUDES, gen_free_list(), gen_length(), get_bool_property(), get_opencl_file_name(), hash_pointer, hash_table_free(), hash_table_make(), HELPER, i2a(), init, module, NIL, opencl_merge_and_compile(), opencl_merge_prop, pips_assert, pips_debug, safe_fclose(), safe_fopen(), set_free(), set_make(), set_pointer, set_union(), and strdup().
Referenced by freia_compile().
Definition at line 47 of file freia_opencl.c.
References cat, db_get_directory_name_for_module(), free(), and strdup().
Referenced by freia_opencl_compile_calls().
migrate the statements corresponding to the vertices so that they are one next to the other in the sequence.
Definition at line 984 of file freia_opencl.c.
References dagvtx_statement(), FOREACH, freia_migrate_statements(), set_add_element(), set_free(), set_make(), set_pointer, and set_union().
Referenced by opencl_merge_and_compile().
|
static |
perform OpenCL compilation on mergeable dag the generated code relies on some freia-provided runtime may be called on a one vertex dag for kernel operations
Definition at line 168 of file freia_opencl.c.
References freia_api_t::arg_in_types, freia_api_t::arg_misc_in, freia_api_t::arg_misc_out, border_condition, call_arguments, CAR, cat, freia_api_t::compact_name, compile(), CONS, dag_dot_dump(), dag_dump(), dag_inputs, dag_outputs, dag_vertex_preds(), dag_vertices, DAGVTX, dagvtx_content, dagvtx_number(), dagvtx_opid(), ENTITY, FOREACH, free(), freia_add_image_arguments(), freia_extract_kernel_vtx(), freia_extract_params(), FREIA_IMAGE, FREIA_OPENCL_CL_INCLUDES, freia_statement_to_call(), freia_substitute_by_helper_call(), gen_copy_seq(), gen_free_list(), gen_length(), gen_nconc(), gen_nreverse(), get_bool_property(), get_freia_api(), get_string_property(), hash_put(), hwac_kill_statement(), i2a(), ifdebug, opencl_hw_t::init, input(), int, intptr_t, is_a_kernel(), local_name_to_top_level_entity(), lparams, opencl_hw_t::macro, opencl_hw_t::mergeable_kernel, module, NIL, freia_api_t::opencl, OPENCL_IMAGE, OPENCL_PIXEL, opencl_type(), pips_assert, pips_debug, pixel_name(), pstatement_statement, pstatement_statement_p, RED, same_string_p, sb_cat, set_append_vertex_statements(), set_free(), set_make(), set_pointer, strdup(), string_buffer_append_c_string_buffer(), string_buffer_append_sb(), string_buffer_free(), string_buffer_make(), string_buffer_to_file(), vtxcontent_inputs, vtxcontent_out, and vtxcontent_source.
Referenced by compile_this_list(), and opencl_generate_special_kernel_ops().
|
static |
call and generate if necessary a specialized kernel, if possible the statement is bluntly modified "in place".
Definition at line 863 of file freia_opencl.c.
References _intFMT, call_arguments, call_function, cat, CDR, freia_api_t::compact_name, CONS, copy_dagvtx_norec(), dag_append_vertex(), dag_outputs, dagvtx_number(), dagvtx_statement(), entity_undefined, free_dag(), freia_create_helper_function(), freia_extract_kernel_vtx(), freia_statement_to_call(), gen_full_free_list(), gen_length(), get_freia_api_vtx(), hash_put(), i2a(), int, intptr_t, local_name_to_top_level_entity(), make_dag(), opencl_hw_t::mergeable_kernel, module, NIL, freia_api_t::opencl, opencl_compile_mergeable_dag(), pips_assert, pips_debug, prefix, set_add_element(), and strdup().
Referenced by opencl_merge_and_compile().
|
static |
extract subdags of merged operations and compile them
d | dag to compile, which is destroyed in the process... |
Definition at line 1017 of file freia_opencl.c.
References cat, freia_api_t::compact_name, compile_this_list(), CONS, dag_computable_vertices(), dag_connected_component(), dag_dot_dump(), dag_inputs, dag_remove_vertex(), dag_vertex_preds(), dag_vertices, dagvtx_constant_kernel_p(), dagvtx_is_measurement_p(), dagvtx_number(), dagvtx_number_str(), dagvtx_opencl_priority(), dagvtx_succs, FOREACH, free(), freia_extract_kernel_vtx(), freia_hack_fix_global_ins_outs(), gen_fprint(), gen_free_list(), gen_in_list_p(), gen_length(), gen_nconc(), gen_nreverse(), gen_remove(), gen_sort_list(), get_bool_property(), get_freia_api_vtx(), i2a(), ifdebug, int, intptr_t, list_in_set_p(), opencl_hw_t::mergeable_kernel, migrate_statements(), module, NIL, freia_api_t::opencl, opencl_generate_special_kernel_ops(), opencl_mergeable_p(), pips_debug, set_add_element(), set_assign_list(), set_belong_p(), set_clear(), set_del_element(), set_free(), set_make(), set_pointer, strdup(), and vertex_mergeable_p().
Referenced by freia_opencl_compile_calls().
Definition at line 57 of file freia_opencl.c.
References _intFMT, dagvtx_freia_api, dagvtx_number(), opencl_hw_t::mergeable, freia_api_t::opencl, and pips_debug.
Referenced by dagvtx_opencl_priority(), and opencl_merge_and_compile().
Definition at line 97 of file freia_opencl.c.
References pips_internal_error, and same_string_p.
Referenced by opencl_compile_mergeable_dag().
|
static |
generate a load if needed for an input variable return the holding variable name in a statically allocated array
Definition at line 113 of file freia_opencl.c.
References border_condition, dagvtx_number(), gen_position(), get_bool_property(), i2a(), load, OPENCL_PIXEL, sb_cat, set_add_element(), set_belong_p(), and VARSHIFT.
Referenced by opencl_compile_mergeable_dag().
return if the vertex can be merged in the set
Definition at line 999 of file freia_opencl.c.
References CAR, dag_vertex_preds(), DAGVTX, dagvtx_is_measurement_p(), dagvtx_succs, gen_free_list(), gen_in_list_p(), gen_length(), NIL, pips_assert, and SET_FOREACH.
Referenced by opencl_merge_and_compile().
|
static |
Definition at line 104 of file freia_opencl.c.
Referenced by opencl_compile_mergeable_dag(), and pixel_name().