From patchwork Wed Apr 29 09:07:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1279109 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Bt232JYjz9sPF for ; Wed, 29 Apr 2020 19:07:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2299D3939C3C; Wed, 29 Apr 2020 09:07:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 4B8AE3939C16 for ; Wed, 29 Apr 2020 09:07:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4B8AE3939C16 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Thomas_Schwinge@mentor.com IronPort-SDR: GM04VuCarSnxTN6KO4d9hrjVPm8kWBH7dgGYxXGU+F+bqpLISLOgff8zVGvsz+cT31MP9hmTPr YiI7A1lcJuSAHKdB1Iz4cOmDT6vuK5m7sAMYm1MozqfDJpzopC5sm55RS1Wg8tYt7TjqUeYoSM 0H8mZm/VVTMVdcL3CEVWQx9CKfGmpIljuW80RoBPCpk9pfnA88APymCzdUpvC6d3ggOzc9VuN5 Va//fHEzXt+1z03jc0ioZ9Z3kae10oYMEZZC3PEtU/mSKpt25rbdbWJqyilbYmiI/oT92fOzU3 yC4= X-IronPort-AV: E=Sophos;i="5.73,331,1583222400"; d="scan'208,223";a="50350385" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 29 Apr 2020 01:07:15 -0800 IronPort-SDR: evapREHktK2Uk7py6B09sAy8Lqw5rq/u9bBFxKxeuqrxKIdSUCIW7YdwJFOvMUfn2QtEjVx4PU SZbgO8+U8aPUl72yaczPNMAFGlZFe2XS5Z3+aVpMeyYFfAzXuNGWs/+IDxaNVZMxGhuKO6s2RH eQqcl2nFk9HLm95sCy5YDT/qT+zYCsFiNdVESO9beH6X3O801gTw8bMrhlXREVlYDpFVvnB1YE gSU9Bz/iP+8wIZ81SamrdnDCrsWErHrHUBATsN4CtVlchvM/4mZagTWsjX5pDJJvSkDXVOanv9 AcU= From: Thomas Schwinge To: Jakub Jelinek , Subject: Harden and adjust 'gcc/configure' parsing of '--enable-offload-targets' (was: [committed] Simplify omp-device-properties.h creation (PR bootstrap/92314)) In-Reply-To: <20191101233802.GX4650@tucnak> References: <20191101233802.GX4650@tucnak> User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Wed, 29 Apr 2020 11:07:04 +0200 Message-ID: <878siebqyv.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Spam-Status: No, score=-21.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LOTSOFHASH, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Stubbs , Tobias Burnus Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi Jakub! On 2019-11-02T00:38:02+0100, Jakub Jelinek wrote: > Apparently my recent change broke quite a lot of setups where people were > configuring --enable-offload-targets= without having the corresponding > offloading compiler already installed. > The following patch simplifies it by removing the need to have it installed > again for compiler building (it is still needed for testing as before), > by adding new tmake_files with the needed rules and building everything > while building the host compiler. ACK, thanks for that re-work. > --- gcc/configure.ac.jj 2019-10-31 11:05:50.461137028 +0100 > +++ gcc/configure.ac 2019-11-01 21:22:58.417920544 +0100 > @@ -1026,18 +1026,22 @@ AC_SUBST(real_target_noncanonical) > AC_SUBST(accel_dir_suffix) > > for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do > - tgt_dir=`echo $tgt | sed -n 's/.*=//p'` > tgt=`echo $tgt | sed 's/=.*//'` > > if echo "$tgt" | grep "^hsa" > /dev/null ; then > enable_hsa=1 > else > enable_offloading=1 > - if test -n "$tgt_dir"; then > - omp_device_property="${tgt_dir}/lib/gcc/\$(real_target_noncanonical)/\$(version)/accel/${tgt}/omp-device-properties" > - else > - omp_device_property="\$(libsubdir)/accel/${tgt}/omp-device-properties" > - fi > + case "$tgt" in > + *-intelmicemul-*) > + omp_device_property=omp-device-properties-i386 > + omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device" > + ;; > + nvptx*-*) > + omp_device_property=omp-device-properties-nvptx > + omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/nvptx/t-omp-device" > + ;; > + esac > omp_device_properties="${omp_device_properties} ${tgt}=${omp_device_property}" > omp_device_property_deps="${omp_device_property_deps} ${omp_device_property}" > fi Discovered/developed in context of my commit b6a0ae1d22c9675f4374c2cb2b5c0833bb1461f1 "[gcn] Fix 'omp-device-properties-gcn' handling", , I've now as obvious pushed to master branch commit d20219b5ab26cd003ae78ac9f82be337fe4df261 "Harden and adjust 'gcc/configure' parsing of '--enable-offload-targets'". Not sure why you'd diverged here, and in particular omitted the error case, which right away would've caught this 'amdgcn' vs. 'gcn' problem introduced by Tobias' commit 955cd057454b323419e06affa7df7d59dc3cd1fb (r277797) "Add gcc/config/gcn/t-omp-device for OpenMP declare variant kind/arch/isa". Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter From d20219b5ab26cd003ae78ac9f82be337fe4df261 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 23 Apr 2020 21:59:07 +0200 Subject: [PATCH] Harden and adjust 'gcc/configure' parsing of '--enable-offload-targets' Fix-up for commit d228ee80f8578be474595a517a228111fac26c5e "re PR bootstrap/92314 (missing omp-device-properties', needed by 's-omp-device-properties-h')". gcc/ * configure.ac <$enable_offload_targets>: Do parsing as done elsewhere. * configure: Regenerate. --- gcc/ChangeLog | 4 ++++ gcc/configure | 13 ++++++++----- gcc/configure.ac | 9 ++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85d1c2b6f758..3df46e498f57 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2020-04-29 Thomas Schwinge + * configure.ac <$enable_offload_targets>: Do parsing as done + elsewhere. + * configure: Regenerate. + * configure.ac <$enable_offload_targets>: 'amdgcn' is 'gcn'. * configure: Regenerate. diff --git a/gcc/configure b/gcc/configure index 83101072aea0..c7bf5d1fdc6b 100755 --- a/gcc/configure +++ b/gcc/configure @@ -7920,18 +7920,21 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do else enable_offloading=1 case "$tgt" in - *-intelmicemul-*) + *-intelmic-* | *-intelmicemul-*) omp_device_property=omp-device-properties-i386 omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device" ;; - amdgcn*-*) + amdgcn*) omp_device_property=omp-device-properties-gcn omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device" ;; - nvptx*-*) + nvptx*) omp_device_property=omp-device-properties-nvptx omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/nvptx/t-omp-device" ;; + *) + as_fn_error $? "unknown offload target specified" "$LINENO" 5 + ;; esac omp_device_properties="${omp_device_properties} ${tgt}=${omp_device_property}" omp_device_property_deps="${omp_device_property_deps} ${omp_device_property}" @@ -18985,7 +18988,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18988 "configure" +#line 18991 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19091,7 +19094,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19094 "configure" +#line 19097 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index b604047ae456..72f79f7ed322 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1045,18 +1045,21 @@ for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do else enable_offloading=1 case "$tgt" in - *-intelmicemul-*) + *-intelmic-* | *-intelmicemul-*) omp_device_property=omp-device-properties-i386 omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/i386/t-omp-device" ;; - amdgcn*-*) + amdgcn*) omp_device_property=omp-device-properties-gcn omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/gcn/t-omp-device" ;; - nvptx*-*) + nvptx*) omp_device_property=omp-device-properties-nvptx omp_device_property_tmake_file="${omp_device_property_tmake_file} \$(srcdir)/config/nvptx/t-omp-device" ;; + *) + AC_MSG_ERROR([unknown offload target specified]) + ;; esac omp_device_properties="${omp_device_properties} ${tgt}=${omp_device_property}" omp_device_property_deps="${omp_device_property_deps} ${omp_device_property}" -- 2.26.2