From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by sourceware.org (Postfix) with ESMTPS id C6D6A3858D33 for ; Fri, 2 Apr 2021 16:45:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C6D6A3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=superbaloo.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baloo@superbaloo.net Received: by mail-qt1-f171.google.com with SMTP id y12so4035961qtx.11 for ; Fri, 02 Apr 2021 09:45:14 -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=9p8DlX0Mg4g9heHk4GU67nt/JDOUKZFNlI7YP69yzxw=; b=Rd7NcNsKZbDo1EzQD/3kAZdKB/urNF6aUjKe54PuO/rICBitCahcwFBuG9OztUpiUk 7lUqDkc893i15BAfl9QRDCVENQ1RBblplJz4hBsv2j9GNMXqJW+6yW3XI/eHSucctf1L alBbipigjVpIPJgX6JBrLvgMBxxvc+svT81DpDGiXjY1vBobfAODXqipfbO17KYD6xXp FEshyHmlHh4HoGm30w60lLhyuMGnmwhqONy3Hk4Hm9fKt6SKCQa6QPsYzBqsOD4DMotM rPKZBXK3EKXplfykd3Qj1M42KiB++3ouuoH3jAFQRm31FG729LlvXMnrwtmgvRQDScSe zrOA== X-Gm-Message-State: AOAM5333g7ht7pCgwqSv8G5mxckn0RFqjRnyWYM+Wt7MFq+1Prwwyfr9 LEQiKIyUXLmeetbgL0eAd8nJra/siPSoWMtmh28fkiHcxl8RRg== X-Google-Smtp-Source: ABdhPJw8zFvrHkotamR9gzg07u9K/F4tgeh8IRTJgAuZfAG4VSxTLxXj+hUjaHqkFnUu08fNOTM/M1BaWpENRqMVrSs= X-Received: by 2002:ac8:424b:: with SMTP id r11mr12355355qtm.311.1617381914377; Fri, 02 Apr 2021 09:45:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arthur Gautier Date: Fri, 2 Apr 2021 16:45:03 +0000 Message-ID: Subject: Re: Build reproducibility of gcc @ NixOS To: Tadeus Prastowo Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 16:45:16 -0000 On Fri, Apr 2, 2021 at 4:32 PM Tadeus Prastowo w= rote: > > Hi Arthur, > > On Fri, Apr 2, 2021 at 5:04 PM Arthur Gautier > wrote: > > > > Hi Tadeus, > > > > On Fri, Apr 2, 2021 at 9:07 AM Tadeus Prastowo wrote: [...] > > By "the manual", do you refer to > https://gcc.gnu.org/install/build.html#Building-with-profile-feedback > ? yes > > Quoting the page: > When =E2=80=98make profiledbootstrap=E2=80=99 is run, it will first bui= ld a stage1 compiler. > This compiler is used to build a stageprofile compiler instrumented > to collect execution counts of instruction and branch probabilities. > Training run is done by building stagetrain compiler. > Finally a stagefeedback compiler is built using the information collect= ed. > End quote. > > Based on the quote, a reproducible build is to expected for the > following compilers: > 1. The stage1 compiler. > 2. The stageprofile compiler, which is built by the stage1 compiler. > 3. The stagetrain compiler, which is built by the stageprofile compiler. > > Then, a reproducible build is expected for the stagefeedback compiler > on the condition that the same information, which was collected by the > stageprofile compiler when building the stagegrain compiler, is used. > > Do you agree with that reasoning? Yes, and as far as I can tell, up to the stageprofile I get the same result= . Only the output of the stagetrain compilation changes, which affects the stagefeedback compilation. > > > And I would expect, given > > the same input provided in the same order, two different architectures > > to take the same branch, and not observe any difference. > > In other words, you expect that branch statistics depends only on the > given source code. Correct? That would be my understanding (although very limited). What I'm trying to understand is: what "local behavior" is injected in my build, and see if I could get rid of that, and only keep branch statistics/execution counts, which I expect to be reproducible. > > > I understand > > that with autoprofiled builds, the local architecture behavior is > > injected in the build, but I don't use that. > > I'm not using any -march in the build either (as far as I can > > understand/tell). So I do not expect the build to change its > > instruction set either. > > > > Is that normal that two different architectures would issue two > > different "execution counts of instruction and branch probabilities"? > > I guess that it would be the case. > > > Or is there something more? > > Perhaps you can have the reproducible build that you want by first > isolating the information that is collected by the stageprofile > compiler when building the stagegrain compiler and then reusing the > same information when building every other stagefeedback compiler. Yeah, but said information is not reproducible itself (that would defeat the purpose of the effort).