* [PATCH][haifa-sched] PR rtl-optimization/68236: Exit early from autoprefetcher lookahead if not in haifa sched
@ 2015-11-09 16:32 Kyrill Tkachov
2015-11-10 3:22 ` Vladimir Makarov
0 siblings, 1 reply; 2+ messages in thread
From: Kyrill Tkachov @ 2015-11-09 16:32 UTC (permalink / raw)
To: GCC Patches; +Cc: Vladimir Makarov
[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]
Hi all,
In this PR there are tons of ICEs throughout the aarch64 testsuite when compiled with -fselective-scheduling -fselective-scheduling2 --param=sched-autopref-queue-depth=10.
Admittedly that's a rare combination as we don't use selective scheduling by default on aarch64.
The problem is that after my patch to enable auto-prefetcher modelling in the scheduler for aarch64 we now call
into autopref_multipass_dfa_lookahead_guard from the aarch64 backend hook.
However, autopref_multipass_dfa_lookahead_guard only makes sense when doing normal scheduling, the necessary structs are not
setup properly otherwise. So we end up trying to access the insn_queue, which is either NULL, or contains garbage
because it has not been properly initialised from earlier.
The solution in this patch is to exit early from autopref_multipass_dfa_lookahead_guard if insn_queue is NULL.
I'm using insn_queue as an indication that we entered from haifa-sched because I couldn't see any other
variable that keeps track of which scheduling approach we're using.
Also, I needed a hunk to reset insn_queue to NULL in haifa_sched_finish so that if we run selective scheduling
after a round of normal haifa scheduling (for example after sched fusion on aarch64) we don't end up accessing
bogus memory locations from insn_queue.
With this patch a testsuite with -fselective-scheduling/-fselective-scheduling2/--param=sched-autopref-queue-depth=10
runs sanely rather than ICE'ing in almost every test.
Bootstrapped and tested in a normal configuration on arm, aarch64 and x86_64 too.
Ok for trunk?
Thanks,
Kyrill
2015-11-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/68236
* haifa-sched.c (autopref_multipass_dfa_lookahead_guard): Return 0
if insn_queue doesn't exist.
(haifa_sched_finish): Reset insn_queue to NULL.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: haifa-sched-sel-sched.patch --]
[-- Type: text/x-patch; name=haifa-sched-sel-sched.patch, Size: 1080 bytes --]
commit f7995307c6f66bd4be3895f6cd7e5d14d30b7fe2
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Fri Nov 6 14:39:38 2015 +0000
[haifa-sched] PR rtl-optimization/68236: Exit early from autoprefetcher lookahead if not in haifa sched
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index caadc11..a926f4d 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -5806,7 +5806,10 @@ autopref_multipass_dfa_lookahead_guard (rtx_insn *insn1, int ready_index)
{
int r = 0;
- if (PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) <= 0)
+ /* Exit early if the param forbids this or if we're not entering here through
+ normal haifa scheduling. This can happen if selective scheduling is
+ explicitly enabled. */
+ if (!insn_queue || PARAM_VALUE (PARAM_SCHED_AUTOPREF_QUEUE_DEPTH) <= 0)
return 0;
if (sched_verbose >= 2 && ready_index == 0)
@@ -7483,6 +7486,7 @@ haifa_sched_finish (void)
sched_deps_finish ();
sched_finish_luids ();
current_sched_info = NULL;
+ insn_queue = NULL;
sched_finish ();
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][haifa-sched] PR rtl-optimization/68236: Exit early from autoprefetcher lookahead if not in haifa sched
2015-11-09 16:32 [PATCH][haifa-sched] PR rtl-optimization/68236: Exit early from autoprefetcher lookahead if not in haifa sched Kyrill Tkachov
@ 2015-11-10 3:22 ` Vladimir Makarov
0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Makarov @ 2015-11-10 3:22 UTC (permalink / raw)
To: Kyrill Tkachov, GCC Patches
On 11/09/2015 11:31 AM, Kyrill Tkachov wrote:
>
> Ok for trunk?
>
Yes, thanks.
>
>
> 2015-11-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> PR rtl-optimization/68236
> * haifa-sched.c (autopref_multipass_dfa_lookahead_guard): Return 0
> if insn_queue doesn't exist.
> (haifa_sched_finish): Reset insn_queue to NULL.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-10 3:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 16:32 [PATCH][haifa-sched] PR rtl-optimization/68236: Exit early from autoprefetcher lookahead if not in haifa sched Kyrill Tkachov
2015-11-10 3:22 ` Vladimir Makarov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).