Message ID | CAO2gOZXhTsakGMtx+KQ0F550A7KYgXtUr93FXK8V-TMhsQi-yg@mail.gmail.com |
---|---|
State | New |
Headers | show |
What is the usual number of iterations? David On Fri, Oct 25, 2013 at 4:10 PM, Dehao Chen <dehao@google.com> wrote: > If the propagation finds an infinite look, if the in-edge count is > non-zero, then it will cause compiler go into infinite loop when > building with AutoFDO. > > Bootstrapped and regression test on-going. > > OK for google-4_8 branch? > > Thanks, > Dehao > > Index: gcc/auto-profile.c > =================================================================== > --- gcc/auto-profile.c (revision 204027) > +++ gcc/auto-profile.c (working copy) > @@ -1287,6 +1287,7 @@ afdo_propagate (void) > { > basic_block bb; > bool changed = true; > + int i = 0; > > FOR_ALL_BB (bb) > { > @@ -1295,7 +1296,7 @@ afdo_propagate (void) > bb->flags |= BB_ANNOTATED; > } > > - while (changed) > + while (changed && i++ < PARAM_VALUE (PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS)) > { > changed = false; > > Index: gcc/params.def > =================================================================== > --- gcc/params.def (revision 204027) > +++ gcc/params.def (working copy) > @@ -460,6 +460,14 @@ DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS, > "The maximum number of loop iterations we predict statically", > 100, 0, 0) > > +/* This parameter controls the maximum iterations that AutoFDO profile > + prpagation algorithm will run for a specific CFG. */ > + > +DEFPARAM(PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS, > + "max-autofdo-max-propagate-iterations", > + "The maximum number of AutoFDO profile propagation iterations", > + 1000, 0, 0) > + > /* This parameter controls the probability of builtin_expect. The default > value is 90%. This empirical value is obtained through the weighted > probability of FDO counters (with the FDO count value as the weight)
Most are within 10. The largest one I see is 17 across all benchmark. Dehao On Fri, Oct 25, 2013 at 4:21 PM, Xinliang David Li <davidxl@google.com> wrote: > What is the usual number of iterations? > > David > > On Fri, Oct 25, 2013 at 4:10 PM, Dehao Chen <dehao@google.com> wrote: >> If the propagation finds an infinite look, if the in-edge count is >> non-zero, then it will cause compiler go into infinite loop when >> building with AutoFDO. >> >> Bootstrapped and regression test on-going. >> >> OK for google-4_8 branch? >> >> Thanks, >> Dehao >> >> Index: gcc/auto-profile.c >> =================================================================== >> --- gcc/auto-profile.c (revision 204027) >> +++ gcc/auto-profile.c (working copy) >> @@ -1287,6 +1287,7 @@ afdo_propagate (void) >> { >> basic_block bb; >> bool changed = true; >> + int i = 0; >> >> FOR_ALL_BB (bb) >> { >> @@ -1295,7 +1296,7 @@ afdo_propagate (void) >> bb->flags |= BB_ANNOTATED; >> } >> >> - while (changed) >> + while (changed && i++ < PARAM_VALUE (PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS)) >> { >> changed = false; >> >> Index: gcc/params.def >> =================================================================== >> --- gcc/params.def (revision 204027) >> +++ gcc/params.def (working copy) >> @@ -460,6 +460,14 @@ DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS, >> "The maximum number of loop iterations we predict statically", >> 100, 0, 0) >> >> +/* This parameter controls the maximum iterations that AutoFDO profile >> + prpagation algorithm will run for a specific CFG. */ >> + >> +DEFPARAM(PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS, >> + "max-autofdo-max-propagate-iterations", >> + "The maximum number of AutoFDO profile propagation iterations", >> + 1000, 0, 0) >> + >> /* This parameter controls the probability of builtin_expect. The default >> value is 90%. This empirical value is obtained through the weighted >> probability of FDO counters (with the FDO count value as the weight)
Ok with the change. David On Fri, Oct 25, 2013 at 6:17 PM, Dehao Chen <dehao@google.com> wrote: > Most are within 10. The largest one I see is 17 across all benchmark. > > Dehao > > On Fri, Oct 25, 2013 at 4:21 PM, Xinliang David Li <davidxl@google.com> wrote: >> What is the usual number of iterations? >> >> David >> >> On Fri, Oct 25, 2013 at 4:10 PM, Dehao Chen <dehao@google.com> wrote: >>> If the propagation finds an infinite look, if the in-edge count is >>> non-zero, then it will cause compiler go into infinite loop when >>> building with AutoFDO. >>> >>> Bootstrapped and regression test on-going. >>> >>> OK for google-4_8 branch? >>> >>> Thanks, >>> Dehao >>> >>> Index: gcc/auto-profile.c >>> =================================================================== >>> --- gcc/auto-profile.c (revision 204027) >>> +++ gcc/auto-profile.c (working copy) >>> @@ -1287,6 +1287,7 @@ afdo_propagate (void) >>> { >>> basic_block bb; >>> bool changed = true; >>> + int i = 0; >>> >>> FOR_ALL_BB (bb) >>> { >>> @@ -1295,7 +1296,7 @@ afdo_propagate (void) >>> bb->flags |= BB_ANNOTATED; >>> } >>> >>> - while (changed) >>> + while (changed && i++ < PARAM_VALUE (PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS)) >>> { >>> changed = false; >>> >>> Index: gcc/params.def >>> =================================================================== >>> --- gcc/params.def (revision 204027) >>> +++ gcc/params.def (working copy) >>> @@ -460,6 +460,14 @@ DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS, >>> "The maximum number of loop iterations we predict statically", >>> 100, 0, 0) >>> >>> +/* This parameter controls the maximum iterations that AutoFDO profile >>> + prpagation algorithm will run for a specific CFG. */ >>> + >>> +DEFPARAM(PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS, >>> + "max-autofdo-max-propagate-iterations", >>> + "The maximum number of AutoFDO profile propagation iterations", >>> + 1000, 0, 0) >>> + >>> /* This parameter controls the probability of builtin_expect. The default >>> value is 90%. This empirical value is obtained through the weighted >>> probability of FDO counters (with the FDO count value as the weight)
Index: gcc/auto-profile.c =================================================================== --- gcc/auto-profile.c (revision 204027) +++ gcc/auto-profile.c (working copy) @@ -1287,6 +1287,7 @@ afdo_propagate (void) { basic_block bb; bool changed = true; + int i = 0; FOR_ALL_BB (bb) { @@ -1295,7 +1296,7 @@ afdo_propagate (void) bb->flags |= BB_ANNOTATED; } - while (changed) + while (changed && i++ < PARAM_VALUE (PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS)) { changed = false; Index: gcc/params.def =================================================================== --- gcc/params.def (revision 204027) +++ gcc/params.def (working copy) @@ -460,6 +460,14 @@ DEFPARAM(PARAM_MAX_PREDICTED_ITERATIONS, "The maximum number of loop iterations we predict statically", 100, 0, 0) +/* This parameter controls the maximum iterations that AutoFDO profile + prpagation algorithm will run for a specific CFG. */ + +DEFPARAM(PARAM_AUTOFDO_MAX_PROPAGATE_ITERATIONS, + "max-autofdo-max-propagate-iterations", + "The maximum number of AutoFDO profile propagation iterations", + 1000, 0, 0) + /* This parameter controls the probability of builtin_expect. The default value is 90%. This empirical value is obtained through the weighted probability of FDO counters (with the FDO count value as the weight)