From patchwork Wed Aug 12 10:21:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 506561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 133F81401B5 for ; Wed, 12 Aug 2015 20:22:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=UqQqFlST; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=L/QAld2ICKRjyQXs j93YRB8FGT95L2Pi6Rfb22FeCSpWCTqLLwKwmbkRNf/LI1KfHfwVINkSZ+niE3XP SMLoLsIdcybEcPdClPPbC3wOB8OD5/S92MHWZFllMK3vN/5YUeMd1ufGMqoZZ+AW /gJ4cNl03iPl8DTCNONhrZz7s6Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=H+aWlIlZe39vfC1GYYV2OR 174Ok=; b=UqQqFlST0ysvWA8I+1MymvW0H7qi7HftR4Ne9QIYtde1gWhChk1uQY gd3ilepipIUaOYoQCUKdHvLKZK7qz18Wui5gucBPkxc6JSi14I746zfCnA4gOa38 MIVGd2VvcKy7tIFvffb2AOkwETstd5jr8ptfkRQd+mpJIJxION1Gw= Received: (qmail 39676 invoked by alias); 12 Aug 2015 10:22:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 39666 invoked by uid 89); 12 Aug 2015 10:22:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Aug 2015 10:22:07 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZPTAY-0004lU-P4 from Thomas_Schwinge@mentor.com ; Wed, 12 Aug 2015 03:22:03 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Wed, 12 Aug 2015 11:22:01 +0100 From: Thomas Schwinge To: Nathan Sidwell , GCC Patches CC: Cesar Philippidis , Jakub Jelinek Subject: [gomp4] Work around expand_GOACC_DIM_SIZE/expand_GOACC_DIM_POS ICEs (was: signed nums are better for dimensions) In-Reply-To: <55CA331A.408@acm.org> References: <55CA331A.408@acm.org> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Wed, 12 Aug 2015 12:21:52 +0200 Message-ID: <871tf8kdrz.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Tue, 11 Aug 2015 13:38:34 -0400, Nathan Sidwell wrote: > 2) We really should not be getting to the expanders if there's nothing to expand > to. That's simply covering up lack of earlier handling. That earlier removal > gives optimizers more leeway. > --- internal-fn.c (revision 226770) > +++ internal-fn.c (working copy) > static void > -expand_GOACC_FORK (gcall *stmt ATTRIBUTE_UNUSED) > +expand_GOACC_FORK (gcall *ARG_UNUSED (stmt)) > { > #ifdef HAVE_oacc_fork > [...] > +#else > + gcc_unreachable (); > #endif > } > > static void > -expand_GOACC_JOIN (gcall *stmt ATTRIBUTE_UNUSED) > +expand_GOACC_JOIN (gcall *ARG_UNUSED (stmt)) > { > #ifdef HAVE_oacc_join > [...] > +#else > + gcc_unreachable (); > #endif > } > static void > -expand_GOACC_DIM_SIZE (gcall *stmt) > +expand_GOACC_DIM_SIZE (gcall *ARG_UNUSED (stmt)) > { > +#ifdef HAVE_oacc_dim_size > [...] > #else > - emit_move_insn (target, const1_rtx); > + gcc_unreachable (); > #endif > } > > static void > -expand_GOACC_DIM_POS (gcall *stmt) > +expand_GOACC_DIM_POS (gcall *ARG_UNUSED (stmt)) > { > +#ifdef HAVE_oacc_dim_pos > [...] > #else > - emit_move_insn (target, const0_rtx); > + gcc_unreachable (); > #endif > } It's not an issue for expand_GOACC_FORK and expand_GOACC_JOIN, but expand_GOACC_DIM_SIZE and expand_GOACC_DIM_POS then blow up when the intelmic offloading compiler works through the OpenACC offloading code, for example: [...]/source-gcc/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/firstprivate-1.c: In function 'main._omp_fn.0': [...]/source-gcc/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/firstprivate-1.c:18:11: internal compiler error: in expand_GOACC_DIM_POS, at internal-fn.c:2023 #pragma acc parallel num_gangs (n) firstprivate (a) ^ 0x90bce7 expand_GOACC_DIM_POS [...]/source-gcc/gcc/internal-fn.c:2023 0x62945a expand_call_stmt [...]/source-gcc/gcc/cfgexpand.c:2279 0x62945a expand_gimple_stmt_1 [...]/source-gcc/gcc/cfgexpand.c:3238 0x62945a expand_gimple_stmt [...]/source-gcc/gcc/cfgexpand.c:3399 0x62a82d expand_gimple_basic_block [...]/source-gcc/gcc/cfgexpand.c:5411 0x62fc86 execute [...]/source-gcc/gcc/cfgexpand.c:6023 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. mkoffload-intelmic: fatal error: [...]/install/offload-x86_64-intelmicemul-linux-gnu/bin//x86_64-unknown-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc returned 1 exit status Admittedly, compiling OpenACC offloading code for Intel MIC doesn't make a lot of sense (currently), but it is what's being done, and has caused a lot of regressions in my testing, so I committed the following workaround to gomp-4_0-branch in r226804. A different approach would have been to invent some machinery to not compile OpenACC offloading code on the Intel MIC offloading path, but as the latter eventually is to support OpenACC offloading, too (see , for example), this seemed like a step into the wrong direction. Eventually, this will need to be fixed differently/properly -- have to implement oacc_dim_size and oacc_dim_pos for Intel MIC offloading, or can we have a generic fallback solution not specific to the offloading target? commit 8a3187f17e13bd45e630ff8a587c1fc7086abece Author: tschwinge Date: Wed Aug 12 09:56:59 2015 +0000 Work around expand_GOACC_DIM_SIZE/expand_GOACC_DIM_POS ICEs Followup to r226783. gcc/ * internal-fn.c: Include "builtins.h". (expand_GOACC_DIM_SIZE, expand_GOACC_DIM_POS): Instead of gcc_unreachable, expand_builtin_trap. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@226804 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 6 ++++++ gcc/internal-fn.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) Grüße, Thomas diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index ea254c5..044fdf7 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,9 @@ +2015-08-12 Thomas Schwinge + + * internal-fn.c: Include "builtins.h". + (expand_GOACC_DIM_SIZE, expand_GOACC_DIM_POS): Instead of + gcc_unreachable, expand_builtin_trap. + 2015-08-10 Nathan Sidwell * tree-ssa-phiopt.c (minmax_replacement): Create new ssa name if diff --git gcc/internal-fn.c gcc/internal-fn.c index 8b8c6e1..70bffd4 100644 --- gcc/internal-fn.c +++ gcc/internal-fn.c @@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "tree-ssanames.h" #include "diagnostic-core.h" +#include "builtins.h" /* The names of each internal function, indexed by function number. */ const char *const internal_fn_name_array[] = { @@ -2003,7 +2004,7 @@ expand_GOACC_DIM_SIZE (gcall *ARG_UNUSED (stmt)) VOIDmode, EXPAND_NORMAL); emit_insn (gen_oacc_dim_size (target, dim)); #else - gcc_unreachable (); + expand_builtin_trap (); #endif } @@ -2021,7 +2022,7 @@ expand_GOACC_DIM_POS (gcall *ARG_UNUSED (stmt)) VOIDmode, EXPAND_NORMAL); emit_insn (gen_oacc_dim_pos (target, dim)); #else - gcc_unreachable (); + expand_builtin_trap (); #endif }