From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 4F5A83894414 for ; Thu, 22 Apr 2021 11:19:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4F5A83894414 Received: by mail-ej1-x636.google.com with SMTP id n2so68177468ejy.7 for ; Thu, 22 Apr 2021 04:19:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=OdjhjoiNs/jKNx1JFFR9zK/eXqzUaRZPPC9FBMQLcfY=; b=S7N6tbmnkPYbJ3Hw8c21Z05+8TpQG3vEdaocUF1yiYxz5o/FGD6is8v4Z7oA5PMUas tmFM48/z6hg+Q39XnE8GYkwOj9qs+uJ0VWZ6rOQIGS2eBjvQ2EcuHf5LH9cewZyy6Ss4 X/W1we+m81xmaqti+o8kEFAOypmvxiDFh5MDLPfY2MulnmJEeY41jZhnCmnSAig7o0kz 7aG9Crb2vfNQZatXNSyoi0jHOyIZYZLC5bgDF9qhUivjSM5e1lVF0PJ/MEL7OtLhBl/a o9iKvJ/wfWc9p1GUmxm9gKGaDjGEpwhF8UtzjswV8kGk78t03NgaE1eB+/M3ujZzR2oM ttuQ== X-Gm-Message-State: AOAM530cjBV2zQ5iG68h5YQp4YcPy8amK5+Rk1ElDKjNUvOpkwnnE44v 46vJZ3K4FTPxQJyf+KldiVBB+SEJPMrLzQ3p6mA= X-Google-Smtp-Source: ABdhPJxU1McArlVDyd2RWu7aAU2x4lIxfPRAbqoSCT8sNI9LM0qDi1fL78dur11JTsW1zR12WWBdqsGM4BHTxv6VgUo= X-Received: by 2002:a17:906:cc46:: with SMTP id mm6mr2963640ejb.138.1619090396344; Thu, 22 Apr 2021 04:19:56 -0700 (PDT) MIME-Version: 1.0 References: <11a45856-44b3-754d-5a42-19a348d0d59d@suse.cz> <8cc12cd9-fe88-f97b-eec2-d47f5342496d@suse.cz> In-Reply-To: <8cc12cd9-fe88-f97b-eec2-d47f5342496d@suse.cz> From: Richard Biener Date: Thu, 22 Apr 2021 13:19:45 +0200 Message-ID: Subject: Re: [PATCH] LTO: fallback to -flto=N if -flto=jobserver does not work. To: =?UTF-8?Q?Martin_Li=C5=A1ka?= Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 11:19:58 -0000 On Thu, Apr 22, 2021 at 11:02 AM Martin Li=C5=A1ka wrote: > > On 4/22/21 10:04 AM, Richard Biener wrote: > > On Wed, Apr 21, 2021 at 3:08 PM Martin Li=C5=A1ka wrot= e: > >> > >> When -flto=3Djobserver is used and we cannot detect job server, then w= e can > >> still fallbackto -flto=3DN 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 mistak= e > that '+' is missing in Makefile rule. That was motivation for my change. Sure, but that change won't get this fixed. IMHO we should eventually emit diagnostic like warning: could not find jobserver, compiling N jobs serially once N > 1 (or 2?). Likewise if people just use -flto and auto-detection finds nothing: warning: using serial compilation of N LTRANS jobs note: refer to http://.... for how to use parallel compile using the URL diagnostics to point to -flto=3D... documentation. That is, teach users rather than second-guessing and eventually blowing things up. IMHO only the jobserver mode is safe to automatically use. Richard. > Martin > > > > > Richard. > > > >> Thanks, > >> Martin > >> > >> gcc/ChangeLog: > >> > >> * lto-wrapper.c (run_gcc): When -flto=3Djobserver is used, but= the > >> makeserver cannot be detected, then use -flto=3DN 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 !=3D NULL) > >> { > >> warning (0, jobserver_error); > >> - parallel =3D 0; > >> + /* Fall back to auto parallelism. */ > >> jobserver =3D 0; > >> + auto_parallel =3D 1; > >> } > >> else if (!jobserver && jobserver_error =3D=3D NULL) > >> { > >> -- > >> 2.31.1 > >> >