Working on treeprop, I noticed that sometimes the SciMark2 score got worse, but only on amd64.
Looking at the generated code, I found that the problem was that a variable heavily used in deep nesting BBs (level 3) was left on the stack, while variables used at level 1 were put in registers. So I decided to tune is a bit. With the attached patch, I get about a 25% speedup on amd64, but also a 2 or 3% decrease on x86... Using a less aggressive approach (put "(1 * (bb->nesting))" in the increment expression), the amd64 speedup is only 10 or 15%, but at least x86 does not get worse. I'll go on looking at the generated code on both CPUs to find a better tradeoff, but in the meanwhile if somebody wants to have a look at what happens with other architectures... A (very rough) script to automate the process is here: http://primates.ximian.com/~massi/BENCHMARKS/benchmark.pl and some explanation for it is here: http://primates.ximian.com/~massi/blog/archive/2006/Mar-13.html Ciao, Massi
Index: mono/mono/mini/liveness.c =================================================================== --- mono/mono/mini/liveness.c (revision 57888) +++ mono/mono/mini/liveness.c (working copy) @@ -11,6 +11,10 @@ #include "inssel.h" #include "aliasing.h" +//#define SPILL_COST_INCREMENT (1 << (bb->nesting << 1)) +#define SPILL_COST_INCREMENT (1 + (bb->nesting * 2)) + + //#define DEBUG_LIVENESS #if SIZEOF_VOID_P == 8 @@ -116,7 +120,7 @@ if (!mono_bitset_test_fast (bb->kill_set, idx)) mono_bitset_set_fast (bb->gen_set, idx); if (inst->ssa_op == MONO_SSA_LOAD) - vi->spill_costs += 1 + (bb->nesting * 2); + vi->spill_costs += SPILL_COST_INCREMENT; affected_variable = affected_variable->next; } @@ -138,7 +142,7 @@ update_live_range (cfg, idx, bb->dfn, inst_num); mono_bitset_set_fast (bb->kill_set, idx); if (inst->ssa_op == MONO_SSA_STORE) - vi->spill_costs += 1 + (bb->nesting * 2); + vi->spill_costs += SPILL_COST_INCREMENT; affected_variable = affected_variable->next; } Index: mono/mono/mini/linear-scan.c =================================================================== --- mono/mono/mini/linear-scan.c (revision 57888) +++ mono/mono/mini/linear-scan.c (working copy) @@ -218,7 +218,7 @@ } else { if (cfg->verbose_level > 2) - printf ("NOT REGVAR: %d\n", vmv->idx); + printf ("NOT REGVAR: %d (C%d)\n", vmv->idx, vmv->spill_costs); } } }
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list