Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Issue 1494883002: GN: Makes GN output deterministic (Closed)

Created:
5 years ago by Zachary Forman
Modified:
5 years ago
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

GN: Makes GN output deterministic Sorts various output just prior to printing to ensure that GN output is deterministic. The overall effect on performance is relatively small, with runtime over 50 runs varying as follows on my Z840: +-------+-------+-------+ | | old | new | +-------+-------+-------+ | mean | 1415 | 1430 | +-------+-------+-------+ | stdev | 58.0 | 70.5 | +-------+-------+-------+ To verify results: $ gn gen out/Default; mv out out-1 $ gn gen out/Default; mv out out-2 $ diff -qr out-1 out-2 The diff should be empty. Initial discussion can be seen at https://groups.google.com/a/chromium.org/forum/#!topic/gn-dev/8mOLgM4r3PI. BUG=565075 Committed: https://crrev.com/98ec25a8fb3f710d43d60b1bcdc5a1475aab136f Cr-Commit-Position: refs/heads/master@{#364954}

Patch Set 1 #

Total comments: 20

Patch Set 2 : Responses to comments #

Patch Set 3 : Adds newline #

Patch Set 4 : Reverts removal of sort #

Patch Set 5 : Moves sort into ninja_toolchain_writer.cc for consistency #

Total comments: 6

Patch Set 6 : Simplifies to just sorting #

Patch Set 7 : Tweaked some comments for clarity #

Total comments: 14

Patch Set 8 : Shrinking scope #

Patch Set 9 : Shrinking scope #

Total comments: 5

Patch Set 10 : Code delousing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -20 lines) Patch
M tools/gn/ninja_build_writer.cc View 1 2 3 4 5 6 1 chunk +7 lines, -3 lines 0 comments Download
M tools/gn/ninja_target_writer.cc View 1 2 3 4 5 6 7 8 9 1 chunk +27 lines, -11 lines 0 comments Download
M tools/gn/ninja_writer.cc View 1 2 3 4 5 6 7 8 2 chunks +14 lines, -6 lines 0 comments Download

Messages

Total messages: 34 (9 generated)
Zachary Forman
Hi Tim! Please review this CL. Hopefully no major disasters :) --Zac
5 years ago (2015-12-03 04:53:35 UTC) #2
mithro-old
Hi Zack, Mostly looks okay, but we'll need the GN developers feedback. I added a ...
5 years ago (2015-12-03 05:20:31 UTC) #4
Zachary Forman
I've uploaded a new snapshot addressing your comments. Slightly concerned about testing for ninja_writer.cc - ...
5 years ago (2015-12-03 07:27:02 UTC) #5
mithro-old
Looks like you missed something..... ----------------------------------------------------- tansell@tansell-z620-l2:/fast/chrome/src$ for i in {1..5}; do time ./out-fast/Release/gn gen ...
5 years ago (2015-12-03 10:41:47 UTC) #6
mithro-old
Is it possible to write a golden test like gn-format for the ninja build writing?
5 years ago (2015-12-03 11:12:50 UTC) #7
Zachary Forman
Hi, Could you please review this CL? Mithro's reviewed it to some extent, but it ...
5 years ago (2015-12-03 11:43:11 UTC) #9
Dirk Pranke
I'll take a look, too, but Brett should review this.
5 years ago (2015-12-03 16:08:07 UTC) #11
brettw
On my machine I can notice a fairly consistent regression of 995ms (old) and 1073ms ...
5 years ago (2015-12-03 17:52:17 UTC) #12
brettw
Here's a question: is the only source of non-determinism in the GN output the ordering ...
5 years ago (2015-12-03 18:48:37 UTC) #13
Zachary Forman
On 2015/12/03 at 18:48:37, brettw wrote: > Here's a question: is the only source of ...
5 years ago (2015-12-03 23:54:51 UTC) #14
brettw
I'm testing it on a Linux Z620 I'm curious, is the metabuild system responsible for ...
5 years ago (2015-12-04 00:00:33 UTC) #15
Dirk Pranke
+maruel We do have (fyi?) bots that look for deterministic builds. As I noted initially, ...
5 years ago (2015-12-04 00:08:51 UTC) #17
Zachary Forman
On 2015/12/04 at 00:08:51, dpranke wrote: > +maruel > > We do have (fyi?) bots ...
5 years ago (2015-12-04 00:25:56 UTC) #18
M-A Ruel
On 2015/12/04 00:25:56, Zachary Forman wrote: > On 2015/12/04 at 00:08:51, dpranke wrote: > > ...
5 years ago (2015-12-07 00:20:16 UTC) #19
M-A Ruel
On 2015/12/04 00:25:56, Zachary Forman wrote: > On 2015/12/04 at 00:08:51, dpranke wrote: > > ...
5 years ago (2015-12-07 00:20:18 UTC) #20
Zachary Forman
I've gone through and replaced the (overly complicated) PointerSet solution with just sorting inputs immediately ...
5 years ago (2015-12-07 03:18:17 UTC) #22
M-A Ruel
Thanks for the explanation, I think it's further possible to scope this CL to be ...
5 years ago (2015-12-07 15:09:50 UTC) #23
brettw
https://codereview.chromium.org/1494883002/diff/120001/tools/gn/ninja_target_writer.cc File tools/gn/ninja_target_writer.cc (right): https://codereview.chromium.org/1494883002/diff/120001/tools/gn/ninja_target_writer.cc#newcode214 tools/gn/ninja_target_writer.cc:214: const std::set<const Target*>& hard_deps = target_->recursive_hard_deps(); We don't have ...
5 years ago (2015-12-07 18:48:54 UTC) #24
Zachary Forman
I've mostly made the changes you've suggested. The overall performance impact was negligible - time ...
5 years ago (2015-12-08 09:40:43 UTC) #25
M-A Ruel
This lgtm but Brett makes the actual decision. https://codereview.chromium.org/1494883002/diff/120001/tools/gn/ninja_writer.cc File tools/gn/ninja_writer.cc (right): https://codereview.chromium.org/1494883002/diff/120001/tools/gn/ninja_writer.cc#newcode58 tools/gn/ninja_writer.cc:58: typedef ...
5 years ago (2015-12-08 13:49:29 UTC) #26
brettw
LGTM, thanks! Just some minor nits before landing... https://codereview.chromium.org/1494883002/diff/160001/tools/gn/ninja_target_writer.cc File tools/gn/ninja_target_writer.cc (right): https://codereview.chromium.org/1494883002/diff/160001/tools/gn/ninja_target_writer.cc#newcode210 tools/gn/ninja_target_writer.cc:210: // ...
5 years ago (2015-12-10 21:29:46 UTC) #27
Zachary Forman
On 2015/12/10 at 21:29:46, brettw wrote: > LGTM, thanks! Just some minor nits before landing... ...
5 years ago (2015-12-10 23:05:21 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1494883002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1494883002/180001
5 years ago (2015-12-13 23:54:47 UTC) #31
commit-bot: I haz the power
Committed patchset #10 (id:180001)
5 years ago (2015-12-14 03:23:47 UTC) #32
commit-bot: I haz the power
5 years ago (2015-12-14 03:24:46 UTC) #34
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/98ec25a8fb3f710d43d60b1bcdc5a1475aab136f
Cr-Commit-Position: refs/heads/master@{#364954}

Powered by Google App Engine
This is Rietveld 408576698