This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix scheduling undeterminism from sorting with DEBUG_INSNs


On Jan 29, 2015, at 10:36 AM, Alexandre Oliva <aoliva@redhat.com> wrote:

> On Jan 19, 2015, Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> wrote:
> 
>> Presence or absence of DEBUG_INSNs in the ready list can change the
>> comparison order, and cause slightly different instruction schedules.
> 
>> The solution that I propose (and that the patch implements) is to sort
>> DEBUG_INSNs separately from normal insns.  If DEBUG_INSNs are present
>> in the ready_list, sort the DEBUG_INSNs only among themselves, while
>> preserving order of the normal insns.  Once there are no DEBUG_INSNs
>> in the ready list, sort using the rank_for_schedule heuristic, just as
>> when we would when compiling without debug info.
> 
> I like that.  Thanks!
> 
> I wonder if it having a separate ready list for debug insns would make
> things simpler.  In general, you shouldn't have to sort debug insns at
> all, since they're not supposed to be reordered in the first place,

The debug insns are not really sorted, it just happens that qsort is the easiest tool to separate debug insns from normal ones.  The rank function for debug insns keeps them in original order.

> but
> keeping them separate would presumably avoid differences in sorting of
> the non-debug ready list.

This would have been my preference too, /if/ we didn't already have handling of ready lists which can have debug insns and normal insns.  With our current infrastructure for handling of debug insns in scheduler all done and working, the above approach is the least intrusive one, which is what I want to get the patch approved for stage 4.

> 
> This is not so different from what you do, though; it just requires
> different bookkeeping.

Thanks, Alexandre!

--
Maxim Kuvyrkov
www.linaro.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]