From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id E330A39C0021 for ; Thu, 22 Apr 2021 09:02:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E330A39C0021 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mliska@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A93F7B04F; Thu, 22 Apr 2021 09:02:54 +0000 (UTC) Subject: Re: [PATCH] LTO: fallback to -flto=N if -flto=jobserver does not work. To: Richard Biener Cc: GCC Patches References: <11a45856-44b3-754d-5a42-19a348d0d59d@suse.cz> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <8cc12cd9-fe88-f97b-eec2-d47f5342496d@suse.cz> Date: Thu, 22 Apr 2021 11:02:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------9BD7B17F69EFC785F8E3B5F8" Content-Language: en-US X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: , X-List-Received-Date: Thu, 22 Apr 2021 09:02:57 -0000 This is a multi-part message in MIME format. --------------9BD7B17F69EFC785F8E3B5F8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 4/22/21 10:04 AM, Richard Biener wrote: > On Wed, Apr 21, 2021 at 3:08 PM Martin Liška wrote: >> >> When -flto=jobserver is used and we cannot detect job server, then we can >> still fallbackto -flto=N mode. >> >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >> >> Ready to be installed? > > I think this behavior needs to be documented - it falls back to a less > conservative (possibly system overloading) mode - which IMHO is > non-obvious and IMHO we shouldn't do. Sure, I'm sending corresponding patch. Note that it's quite common mistake that '+' is missing in Makefile rule. That was motivation for my change. Martin > > Richard. > >> Thanks, >> Martin >> >> gcc/ChangeLog: >> >> * lto-wrapper.c (run_gcc): When -flto=jobserver is used, but the >> makeserver cannot be detected, then use -flto=N fallback. >> --- >> gcc/lto-wrapper.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c >> index 03a5922f8ea..0b626d7c811 100644 >> --- a/gcc/lto-wrapper.c >> +++ b/gcc/lto-wrapper.c >> @@ -1585,8 +1585,9 @@ run_gcc (unsigned argc, char *argv[]) >> if (jobserver && jobserver_error != NULL) >> { >> warning (0, jobserver_error); >> - parallel = 0; >> + /* Fall back to auto parallelism. */ >> jobserver = 0; >> + auto_parallel = 1; >> } >> else if (!jobserver && jobserver_error == NULL) >> { >> -- >> 2.31.1 >> --------------9BD7B17F69EFC785F8E3B5F8 Content-Type: text/x-patch; charset=UTF-8; name="0001-Document-flto-jobserver-fallback.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Document-flto-jobserver-fallback.patch" >From b81f5288fc81256e63d44e00793e2732eb2a2d88 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 22 Apr 2021 10:59:51 +0200 Subject: [PATCH] Document -flto=jobserver fallback. gcc/ChangeLog: * doc/invoke.texi: Document what happens when GCC can't detect make's job server with -flto=jobserver. --- gcc/doc/invoke.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e98b0962b9f..1cfff4c14a9 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -12340,6 +12340,9 @@ Use @option{-flto=auto} to use GNU make's job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system. +If you specify @option{-flto=jobserver} and make's job server can't be detected, +then well fall back to the number of CPU threads present in your system. + @item -flto-partition=@var{alg} @opindex flto-partition Specify the partitioning algorithm used by the link-time optimizer. -- 2.31.1 --------------9BD7B17F69EFC785F8E3B5F8--