diff options
author | Gary Oblock <gary@amperecomputing.com> | 2020-09-14 10:06:02 -0700 |
---|---|---|
committer | Gary Oblock <gary@amperecomputing.com> | 2020-09-14 10:06:02 -0700 |
commit | fac145f1ccdc690b710e6458f877f518a3dabd62 (patch) | |
tree | 67c58d2ee4240a7cfa992ca15d7e8c4fb4fa8368 | |
parent | 345086a053ea0921ea01225ef0e69c3956af99c0 (diff) |
Just saving work in progress
-rw-r--r-- | gcc/ipa-str-reorg-instance-interleave.c | 130 | ||||
-rw-r--r-- | gcc/ipa-structure-reorg.h | 2 |
2 files changed, 94 insertions, 38 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c index c417926af64..f5cb57c1381 100644 --- a/gcc/ipa-str-reorg-instance-interleave.c +++ b/gcc/ipa-str-reorg-instance-interleave.c @@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see static void wrangle_ssa_type( tree, Info_t*); //static bool print_internals (gimple *, void *); static void str_reorg_instance_interleave_qual_part ( Info *); +static double cut_off_eq_single_pool( double); static void str_reorg_instance_interleave_type_part ( Info *); static void header ( bool); static void create_new_types ( Info_t *); @@ -1884,25 +1885,25 @@ typedef struct reorg_bb_info reorg_bb_info_t; basic_block *bb; }; - typedef struct perf_bb_info perf_bb_info_t; - typedef struct acc_info acc_info_t; - typedef struct var_info var_info_t; - - struct var_info { - varpool_node *var; - sbitmap *bits; - double count; - }; +typedef struct perf_bb_info perf_bb_info_t; +typedef struct acc_info acc_info_t; +typedef struct var_info var_info_t; - struct acc_info { - varpool_node *v; - int field_num; - }; +struct var_info { + varpool_node *var; + sbitmap *bits; + double count; +}; - struct perf_bb_info { - std::vector <var_info_t*> *vari; - basic_block *gcc_bb; - }; +struct acc_info { + varpool_node *v; + int field_num; +}; + +struct perf_bb_info { + std::vector <var_info_t*> *vari; + basic_block *gcc_bb; +}; static void account_for_use( tree, std::vector <acc_info_t> *); static bool is_array_access( tree); @@ -1910,7 +1911,7 @@ static bool is_array_access( tree); static unsigned int reorg_perf_qual ( Info *info) { - #if 1 + #if 0 // TBD use design in doc but mark ReorgTypes // (do_instance_interleave) that qualify instead of deleting them // unless both dead field elimination and field reorderig are not @@ -1944,47 +1945,84 @@ reorg_perf_qual ( Info *info) double cache_accesses_noreorg = 0.0; // Perf Analysis + DEBUG_A("Preformance Qualifiction\n"); struct cgraph_node *node; FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node) { struct function *func = DECL_STRUCT_FUNCTION ( node->decl); - // Ulgy GCC idiom with global pointer to current function. push_cfun ( func); + #if 0 + DEBUG_A("Function: %s\n", lang_hooks.decl_printable_name ( func->decl, 2)); + // TBD class loop *loop; FOR_EACH_LOOP_FN ( func, loop, LI_ONLY_INNERMOST ) { + DEBUG_A("For Loop with: "); + size_t num_bbs = loop->num_nodes; basic_block *bbs = get_loop_body ( loop); - // This stuff probably doesn't matter - #if 0 - int *bbsort = XNEWVEC ( int, num_bbs); - reorg_bb_info_t *rbbs = - XNEWVEC ( reorg_bb_info_t, num_bbs); - topsort( bbs, bbsort, loop->num_nodes); - for( i = 0; i < num_bbs; i++ ) { - rbbs[i].bb = &bbs[bbsort[i]]; - } - map <int,perf_bb_info_t> bbmap; - #endif - - // TBD Stuff here - // Obtain loop count by looking at all the block counts. unsigned max_count = 0; for ( unsigned i = 0; i < loop->num_nodes; i++) { basic_block bb = bbs [i]; max_count = MAX( max_count, bb->count.value ()); + DEBUG("BB%d, ",bb->index); } + DEBUG("\n"); DEBUG_L("max_count = %d, nb_iterations_estimate = %ld\n", max_count, loop->nb_iterations_estimate); // Originally this was done per bb but now it has to be per - // loop. TBD But perf_bb is per loop so we need something similar - // per loop. + // loop. TBD But perf_bb is per loop so we need something + // similar per loop. I suggest one vector per loop and the the + // information nor be persistent. - std::vector <var_info_t*> pv = bb->vari; + std::vector <var_info_t*> pv; + + std::vector <acc_info_t> accinfo; + INDENT(4); + for ( unsigned i = 0; i < loop->num_nodes; i++) + { + basic_block bb = bbs [i]; + for ( auto gsi = gsi_start_bb ( bb); + !gsi_end_p ( gsi); + gsi_next ( &gsi) ) + { + gimple *stmt = gsi_stmt ( gsi); + DEBUG_A(""); + DEBUG_F ( print_gimple_stmt, stderr, stmt, 0); + unsigned ith; + unsigned num_ops = gimple_num_ops ( stmt); + INDENT(4); + for ( ith = 0; ith < num_ops; ith++ ) + { + tree op = gimple_op ( stmt, ith); + DEBUG_A(""); + DEBUG_F( flexible_print, stderr, op, 1, (dump_flags_t)0); + #if 0 + if ( is_array_access( acc) ) + { + account_for_use( acc, &accinfo); + } + #endif + } + INDENT(-4); + } + } + INDENT(-4); + #endif + + // Disable for a bit + #if 0 + + // Originally this was done per bb but now it has to be per + // loop. TBD But perf_bb is per loop so we need something + // similar per loop. I suggest one vector per loop and the the + // information nor be persistent. + //std::vector <var_info_t*> pv = bb->vari; + for( auto pvi = pv->begin (); pvi != pv->end (); pv = pvi++ ) { // 676 tree base_type = base_type_of( pvi->var->decl); ReorgType_t *ri = get_reorgtype_info( base_type, info); @@ -2054,7 +2092,7 @@ reorg_perf_qual ( Info *info) } } // end for each prop_var 748 - + #endif } // pop_cfun (); } @@ -2065,6 +2103,7 @@ reorg_perf_qual ( Info *info) // cache_accesses // cache_accesses_noreorg + #if 0 double total_cache_accesses = cache_accesses + cache_accesses_noreorg; @@ -2123,6 +2162,23 @@ reorg_perf_qual ( Info *info) } #endif + #endif +} + +#define SINGLE_POOL_SLOPE \ +((SINGLE_POOL_RAW_DO_IT_ALWAYS - SINGLE_POOL_RAW_SKIP_IT) \ + / \ + (SINGLE_POOL_ABS_DO_IT_ALWAYS - SINGLE_POOL_ABS_SKIP_IT)) + +#define SINGLE_POOL_INTERSECT \ +(SINGLE_POOL_RAW_SKIP_IT \ + - \ + SINGLE_POOL_SLOPE * SINGLE_POOL_ABS_SKIP_IT) + +static double +cut_off_eq_single_pool( double x) +{ + return SINGLE_POOL_SLOPE * x + SINGLE_POOL_INTERSECT; } static void diff --git a/gcc/ipa-structure-reorg.h b/gcc/ipa-structure-reorg.h index 8454c42dd89..286e57c2380 100644 --- a/gcc/ipa-structure-reorg.h +++ b/gcc/ipa-structure-reorg.h @@ -253,7 +253,7 @@ extern bool print_internals (gimple *, void *); // defined marcos in the code. However, some of uses // should obviously be converted to dump file information. -#define DEBUGGING 0 +#define DEBUGGING 1 #if DEBUGGING enum Display { Show_nothing, |