From: Kyrill Tkachov <kyrylo.tkachov@arm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Vladimir Makarov <vmakarov@redhat.com>
Subject: [PATCH][haifa-sched] PR rtl-optimization/68236: Exit early from autoprefetcher lookahead if not in haifa sched
Date: Mon, 09 Nov 2015 16:32:00 -0000 [thread overview]
Message-ID: <5640CA7E.8080007@arm.com> (raw)
[-- 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 ();
}
next reply other threads:[~2015-11-09 16:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 16:32 Kyrill Tkachov [this message]
2015-11-10 3:22 ` Vladimir Makarov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5640CA7E.8080007@arm.com \
--to=kyrylo.tkachov@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=vmakarov@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).