Hi Arthur,

On Fri, Apr 2, 2021 at 5:04 PM Arthur Gautier
<gcc.gnu....@superbaloo.net> wrote:
>
> Hi Tadeus,
>
> On Fri, Apr 2, 2021 at 9:07 AM Tadeus Prastowo <tadeus.prast...@unitn.it> 
> wrote:

[...]

> > Since an optimized build is likely to be machine-dependent regardless
> > of any intended injection (e.g., different instructions used in GCC
> > binaries depending on /proc/cpuinfo), I don't understand why an
> > optimized build should be reproducible on different machines, unless
> > of course every channel that GCC uses to find out about the machine
> > (e.g., /proc/cpuinfo) is under your total control.  So, do you mean to
> > ask a list of all channels that GCC uses to find out about the
> > machine?
>
> This is where I'm getting confused. According to the manual,
> stagetrain only record branch statistics.

By "the manual", do you refer to
https://gcc.gnu.org/install/build.html#Building-with-profile-feedback
?

Quoting the page:
  When ‘make profiledbootstrap’ is run, it will first build 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 collected.
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?

> 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?

> 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.

> Thank you for your reply!

My pleasure.

> --
> Arthur

-- 
Best regards,
Tadeus

Reply via email to