> The calculation of the number of instructions in a row is currently > done by updating row_rest_count field in struct ps_insn on the fly > while creating a new instruction. It is used to make sure we do not > exceed > the issue_rate. > This calculation assumes the instruction is inserted in the beginning of a > row thus does not take into account the cases where it must follow other > instructions. Also, it's not been property updated when an instruction > is removed. > To avoid the overhead of maintaining this row_rest_count count in every > instruction in each row as is currently done; this patch maintains one > count per row which holds the number of instructions in the row. > > The patch was tested together with the rest of the patches in this series. > On ppc64-redhat-linux regtest as well as bootstrap with SMS flags > enabling SMS also on loops with stage count 1. Regtested on SPU. > On arm-linux-gnueabi regtseted on c,c++. Bootstrap c language with SMS > flags enabling SMS also on loops with stage count 1. > > OK for mainline? >
OK. The current situation is indeed broken, and inefficient, as you noted: o We are checking only the first node in a row for its row_rest_count value, to figure out if the row is full; hence it's really a property of the row, not of a node. o When scheduling a node, we update only that node's row_rest_count; hence if we schedule a node in position other than the first, the row_rest_count value of the first node is not incremented. o When removing a node, we do not decrement any row_rest_count value. Please add the following: o A clarification that rows_length is used only (as an optimization) to back off quickly from trying to schedule a node in a full row; that is, to avoid running through futile DFA state transitions. o An assert that ps->rows_length[i] equals the number of nodes in ps->rows [i] (e.g., in verify_partial_schedule(); and then recheck...). Thanks for fixing this, Ayal. > Thanks, > Revital > > * modulo-sched.c (struct ps_insn): Remove row_rest_count field. > (struct partial_schedule): Add rows_length field. > (ps_insert_empty_row): Handle rows_length. > (create_partial_schedule): Likewise. > (free_partial_schedule): Likewise. > (reset_partial_schedule): Likewise. > (create_ps_insn): Remove rest_count argument. > (remove_node_from_ps): Update rows_length. > (add_node_to_ps): Update rows_length and call create_ps_insn > without passing row_rest_count. > [attachment "patch_row_rest_count_17_5.txt" deleted by Ayal Zaks/Haifa/IBM]