> [PATCH, SMS 3/4] Optimize stage count > http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01341.html
This patch for minimizing the stage count (which also refactors and cleans up the code) is approved. Have some minor comments below, followed by some thoughts for possible follow-up improvements. Thanks, Ayal. >Changelog: > > (sms_schedule_by_order): Update call to get_sched_window. > all set_must_precede_follow. ^^^ call >+/* Set bitmaps TMP_FOLLOW and TMP_PRECEDE to MUST_FOLLOW and MUST_PRECEDE >+ respectively only if cycle C falls in the scheduling window boundaries ^^ on the border of > sbitmap tmp_precede = NULL; > sbitmap tmp_follow = NULL; are redundantly reset in set_must_precede_follow(). >+/* Update the sched_params for node U using the II, ^ (time, row and stage) >+ the CYCLE of U and MIN_CYCLE. */ Please also clarify that we're not simply taking SCHED_STAGE (u) = CALC_STAGE_COUNT (SCHED_TIME (u), min_cycle, ii); because the stages are aligned on cycle 0. >+ /* First, normailize the partial schedualing. */ ^ ^ >+ /* Try to achieve optimized SC by normalizing the partial >+ schedule (having the cycles start from cycle zero). The branch ^ >+ location must be placed in row ii-1 in the final scheduling. >+ If that's not the case after the normalization then try to ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >+ move the branch to that row if possible. */ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If failed, shift all instructions to position the branch in row ii-1. For consistency and clarity, may be instead of: >+ /* Bring the branch to cycle -1. */ >+ int amount = SCHED_TIME (g->closing_branch) + 1; it would be better to have: + /* Bring the branch to cycle ii-1. */ + int amount = SCHED_TIME (g->closing_branch) - (ii - 1); Some thoughts on possible improvements (not mandatory; especially given the delay in approval, sorry..thanks for the ping): o Have optimize_sc() take care of all possible rotations doing the best it can, without returning an indication which leaves subsequent (suboptimal) processing to the caller. o Instead of removing the branch and then trying to get it back into the same cycle if you can't place it in row ii-1, consider keeping it in its place and removing it only if you succeed to schedule it (also..) in row ii-1. o May be worthwhile to apply more refactoring, so that the code to reschedule the branch in row ii-1 reuses more of the general code for scheduling an instruction (possibly setting end = start + end), but avoid splitting a row. o Would be interesting to learn of loops that still have suboptimal SC's, to see if it's still an issue. Ayal. 2011/7/20 Revital Eres <revital.e...@linaro.org> > > Hello, > > [PATCH, SMS 3/4] Optimize stage count > http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01341.html > > [PATCH, SMS 4/4] Misc. fixes > http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01342.html > > [PATCH, SMS] Fix calculation of issue_rate > http://gcc.gnu.org/ml/gcc-patches/2011-05/msg01344.html > > Thanks, > Revital