annotate llvm/docs/HowToAddABuilder.rst @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 ===================================================================
anatofuz
parents:
diff changeset
2 How To Add Your Build Configuration To LLVM Buildbot Infrastructure
anatofuz
parents:
diff changeset
3 ===================================================================
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 Introduction
anatofuz
parents:
diff changeset
6 ============
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 This document contains information about adding a build configuration and
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
9 buildbot-worker to private worker builder to LLVM Buildbot Infrastructure.
150
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 Buildmasters
anatofuz
parents:
diff changeset
12 ============
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 There are two buildmasters running.
anatofuz
parents:
diff changeset
15
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
16 * The main buildmaster at `<https://lab.llvm.org/buildbot>`_. All builders
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
17 attached to this machine will notify commit authors every time they break
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
18 the build.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
19 * The staging buildmaster at `<https://lab.llvm.org/staging>`_. All builders
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
20 attached to this machine will be completely silent by default when the build
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
21 is broken. This buildmaster is reconfigured every two hours with any new
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
22 commits from the llvm-zorg repository.
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
23
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
24 In order to remain connected to the main buildmaster (and thus notify
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
25 developers of failures), a builbot must:
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
26
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
27 * Be building a supported configuration. Builders for experimental backends
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
28 should generally be attached to staging buildmaster.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
29 * Be able to keep up with new commits to the main branch, or at a minimum
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
30 recover to tip of tree within a couple of days of falling behind.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
31
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
32 Additionally, we encourage all bot owners to point their bots towards the
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
33 staging master during maintenance windows, instability troubleshooting, and
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
34 such.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
35
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
36 Roles & Expectations
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
37 ====================
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
38
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
39 Each buildbot has an owner who is the responsible party for addressing problems
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
40 which arise with said buildbot. We generally expect the bot owner to be
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
41 reasonably responsive.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
42
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
43 For some bots, the ownership responsibility is split between a "resource owner"
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
44 who provides the underlying machine resource, and a "configuration owner" who
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
45 maintains the build configuration. Generally, operational responsibility lies
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
46 with the "config owner". We do expect "resource owners" - who are generally
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
47 the contact listed in a workers attributes - to proxy requests to the relevant
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
48 "config owner" in a timely manner.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
49
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
50 Most issues with a buildbot should be addressed directly with a bot owner
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
51 via email. Please CC `Galina Kistanova <mailto:gkistanova@gmail.com>`_.
150
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 Steps To Add Builder To LLVM Buildbot
anatofuz
parents:
diff changeset
54 =====================================
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
55 Volunteers can provide their build machines to work as build workers to
150
anatofuz
parents:
diff changeset
56 public LLVM Buildbot.
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 Here are the steps you can follow to do so:
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 #. Check the existing build configurations to make sure the one you are
anatofuz
parents:
diff changeset
61 interested in is not covered yet or gets built on your computer much
anatofuz
parents:
diff changeset
62 faster than on the existing one. We prefer faster builds so developers
anatofuz
parents:
diff changeset
63 will get feedback sooner after changes get committed.
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 #. The computer you will be registering with the LLVM buildbot
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
66 infrastructure should have all dependencies installed and be able to
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
67 build your configuration successfully. Please check what degree
150
anatofuz
parents:
diff changeset
68 of parallelism (-j param) would give the fastest build. You can build
anatofuz
parents:
diff changeset
69 multiple configurations on one computer.
anatofuz
parents:
diff changeset
70
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
71 #. Install buildbot-worker (currently we are using buildbot version 2.8.4).
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
72 This specific version can be installed using ``pip``, with a command such
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
73 as ``pip3 install buildbot-worker==2.8.4``.
150
anatofuz
parents:
diff changeset
74
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
75 #. Create a designated user account, your buildbot-worker will be running under,
150
anatofuz
parents:
diff changeset
76 and set appropriate permissions.
anatofuz
parents:
diff changeset
77
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
78 #. Choose the buildbot-worker root directory (all builds will be placed under
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
79 it), buildbot-worker access name and password the build master will be using
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
80 to authenticate your buildbot-worker.
150
anatofuz
parents:
diff changeset
81
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
82 #. Create a buildbot-worker in context of that buildbot-worker account. Point it
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
83 to the **lab.llvm.org** port **9994** (see `Buildbot documentation,
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
84 Creating a worker
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
85 <http://docs.buildbot.net/current/tutorial/firstrun.html#creating-a-worker>`_
150
anatofuz
parents:
diff changeset
86 for more details) by running the following command:
anatofuz
parents:
diff changeset
87
anatofuz
parents:
diff changeset
88 .. code-block:: bash
anatofuz
parents:
diff changeset
89
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
90 $ buildbot-worker create-worker <buildbot-worker-root-directory> \
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
91 lab.llvm.org:9994 \
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
92 <buildbot-worker-access-name> \
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
93 <buildbot-worker-access-password>
150
anatofuz
parents:
diff changeset
94
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
95 Only once a new worker is stable, and
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
96 approval from Galina has been received (see last step) should it
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
97 be pointed at the main buildmaster.
150
anatofuz
parents:
diff changeset
98
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
99 Now start the worker:
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
100
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
101 .. code-block:: bash
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
102
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
103 $ buildbot-worker start <buildbot-worker-root-directory>
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
104
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
105 This will cause your new worker to connect to the staging buildmaster
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
106 which is silent by default.
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
107
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
108 Try this once then check the log file
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
109 ``<buildbot-worker-root-directory>/worker/twistd.log``. If your settings
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
110 are correct you will see a refused connection. This is good and expected,
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
111 as the credentials have not been established on both ends. Now stop the
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
112 worker and proceed to the next steps.
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
113
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
114 #. Fill the buildbot-worker description and admin name/e-mail. Here is an
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
115 example of the buildbot-worker description::
150
anatofuz
parents:
diff changeset
116
anatofuz
parents:
diff changeset
117 Windows 7 x64
anatofuz
parents:
diff changeset
118 Core i7 (2.66GHz), 16GB of RAM
anatofuz
parents:
diff changeset
119
anatofuz
parents:
diff changeset
120 g++.exe (TDM-1 mingw32) 4.4.0
anatofuz
parents:
diff changeset
121 GNU Binutils 2.19.1
anatofuz
parents:
diff changeset
122 cmake version 2.8.4
anatofuz
parents:
diff changeset
123 Microsoft(R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
anatofuz
parents:
diff changeset
124
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
125 See `here <http://docs.buildbot.net/current/manual/installation/worker.html>`_
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
126 for which files to edit.
150
anatofuz
parents:
diff changeset
127
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
128 #. Send a patch which adds your build worker and your builder to
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
129 `zorg <https://github.com/llvm/llvm-zorg>`_. Use the typical LLVM
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
130 `workflow <https://llvm.org/docs/Contributing.html#how-to-submit-a-patch>`_.
150
anatofuz
parents:
diff changeset
131
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
132 * workers are added to ``buildbot/osuosl/master/config/workers.py``
150
anatofuz
parents:
diff changeset
133 * builders are added to ``buildbot/osuosl/master/config/builders.py``
anatofuz
parents:
diff changeset
134
anatofuz
parents:
diff changeset
135 Please make sure your builder name and its builddir are unique through the
anatofuz
parents:
diff changeset
136 file.
anatofuz
parents:
diff changeset
137
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
138 All new builders should default to using the "'collapseRequests': False"
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
139 configuration. This causes the builder to build each commit individually
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
140 and not merge build requests. To maximize quality of feedback to developers,
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
141 we *strongly prefer* builders to be configured not to collapse requests.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
142 This flag should be removed only after all reasonable efforts have been
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
143 exhausted to improve build times such that the builder can keep up with
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
144 commit flow.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
145
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
146 It is possible to allow email addresses to unconditionally receive
150
anatofuz
parents:
diff changeset
147 notifications on build failure; for this you'll need to add an
anatofuz
parents:
diff changeset
148 ``InformativeMailNotifier`` to ``buildbot/osuosl/master/config/status.py``.
anatofuz
parents:
diff changeset
149 This is particularly useful for the staging buildmaster which is silent
anatofuz
parents:
diff changeset
150 otherwise.
anatofuz
parents:
diff changeset
151
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
152 #. Send the buildbot-worker access name and the access password directly to
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
153 `Galina Kistanova <mailto:gkistanova@gmail.com>`_, and wait until she
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
154 lets you know that your changes are applied and buildmaster is
150
anatofuz
parents:
diff changeset
155 reconfigured.
anatofuz
parents:
diff changeset
156
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
157 #. Make sure you can start the buildbot-worker and successfully connect
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
158 to the silent buildmaster. Then set up your buildbot-worker to start
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
159 automatically at the start up time. See the buildbot documentation
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
160 for help. You may want to restart your computer to see if it works.
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
161
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
162 #. Check the status of your buildbot-worker on the `Waterfall Display (Staging)
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
163 <http://lab.llvm.org/staging/#/waterfall>`_ to make sure it is
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
164 connected, and the `Workers Display (Staging)
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
165 <http://lab.llvm.org/staging/#/workers>`_ to see if administrator
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
166 contact and worker information are correct.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
167
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
168 #. At this point, you have a working builder connected to the staging
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
169 buildmaster. You can now make sure it is reliably green and keeps
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
170 up with the build queue. No notifications will be sent, so you can
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
171 keep an unstable builder connected to staging indefinitely.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
172
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
173 #. (Optional) Once the builder is stable on the staging buildmaster with
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
174 several days of green history, you can choose to move it to the production
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
175 buildmaster to enable developer notifications. Please email `Galina
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
176 Kistanova <mailto:gkistanova@gmail.com>`_ for review and approval.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
177
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
178 To move a worker to production (once approved), stop your worker, edit the
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
179 buildbot.tac file to change the port number from 9994 to 9990 and start it
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
180 again.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
181
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
182 Best Practices for Configuring a Fast Builder
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
183 =============================================
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
184
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
185 As mentioned above, we generally have a strong preference for
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
186 builders which can build every commit as they come in. This section
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
187 includes best practices and some recommendations as to how to achieve
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
188 that end.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
189
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
190 The goal
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
191 In 2020, the monorepo had just under 35 thousand commits. This works
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
192 out to an average of 4 commits per hour. Already, we can see that a
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
193 builder must cycle in less than 15 minutes to have a hope of being
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
194 useful. However, those commits are not uniformly distributed. They
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
195 tend to cluster strongly during US working hours. Looking at a couple
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
196 of recent (Nov 2021) working days, we routinely see ~10 commits per
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
197 hour during peek times, with occasional spikes as high as ~15 commits
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
198 per hour. Thus, as a rule of thumb, we should plan for our builder to
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
199 complete ~10-15 builds an hour.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
200
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
201 Resource Appropriately
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
202 At 10-15 builds per hour, we need to complete a new build on average every
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
203 4 to 6 minutes. For anything except the fastest of hardware/build configs,
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
204 this is going to be well beyond the ability of a single machine. In buildbot
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
205 terms, we likely going to need multiple workers to build requests in parallel
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
206 under a single builder configuration. For some rough back of the envelope
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
207 numbers, if your build config takes e.g. 30 minutes, you will need something
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
208 on the order of 5-8 workers. If your build config takes ~2 hours, you'll
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
209 need something on the order of 20-30 workers. The rest of this section
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
210 focuses on how to reduce cycle times.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
211
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
212 Restrict what you build and test
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
213 Think hard about why you're setting up a bot, and restrict your build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
214 configuration as much as you can. Basic functionality is probably
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
215 already covered by other bots, and you don't need to duplicate that
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
216 testing. You only need to be building and testing the *unique* parts
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
217 of the configuration. (e.g. For a multi-stage clang builder, you probably
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
218 don't need to be enabling every target or building all the various utilities.)
150
anatofuz
parents:
diff changeset
219
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
220 It can sometimes be worthwhile splitting a single builder into two or more,
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
221 if you have multiple distinct purposes for the same builder. As an example,
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
222 if you want to both a) confirm that all of LLVM builds with your host
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
223 compiler, and b) want to do a multi-stage clang build on your target, you
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
224 may be better off with two separate bots. Splitting increases resource
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
225 consumption, but makes it easy for each bot to keep up with commit flow.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
226 Additionally, splitting bots may assist in triage by narrowing attention to
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
227 relevant parts of the failing configuration.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
228
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
229 In general, we recommend Release build types with Assertions enabled. This
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
230 generally provides a good balance between build times and bug detection for
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
231 most buildbots. There may be room for including some debug info (e.g. with
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
232 `-gmlt`), but in general the balance between debug info quality and build
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
233 times is a delicate one.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
234
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
235 Use Ninja & LLD
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
236 Ninja really does help build times over Make, particularly for highly
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
237 parallel builds. LLD helps to reduce both link times and memory usage
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
238 during linking significantly. With a build machine with sufficient
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
239 parallelism, link times tend to dominate critical path of the build, and are
236
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
240 thus worth optimizing.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
241
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
242 Use CCache and NOT incremental builds
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
243 Using ccache materially improves average build times. Incremental builds
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
244 can be slightly faster, but introduce the risk of build corruption due to
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
245 e.g. state changes, etc... At this point, the recommendation is not to
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
246 use incremental builds and instead use ccache as the latter captures the
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
247 majority of the benefit with less risk of false positives.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
248
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
249 One of the non-obvious benefits of using ccache is that it makes the
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
250 builder less sensitive to which projects are being monitored vs built.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
251 If a change triggers a build request, but doesn't change the build output
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
252 (e.g. doc changes, python utility changes, etc..), the build will entirely
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
253 hit in cache and the build request will complete in just the testing time.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
254
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
255 With multiple workers, it is tempting to try to configure a shared cache
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
256 between the workers. Experience to date indicates this is difficult to
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
257 well, and that having local per-worker caches gets most of the benefit
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
258 anyways. We don't currently recommend shared caches.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
259
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
260 CCache does depend on the builder hardware having sufficient IO to access
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
261 the cache with reasonable access times - i.e. a fast disk, or enough memory
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
262 for a RAM cache, etc.. For builders without, incremental may be your best
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
263 option, but is likely to require higher ongoing involvement from the
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
264 sponsor.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
265
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
266 Enable batch builds
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
267 As a last resort, you can configure your builder to batch build requests.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
268 This makes the build failure notifications markedly less actionable, and
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
269 should only be done once all other reasonable measures have been taken.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
270
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
271 Leave it on the staging buildmaster
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
272 While most of this section has been biased towards builders intended for
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
273 the main buildmaster, it is worth highlighting that builders can run
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
274 indefinitely on the staging buildmaster. Such a builder may still be
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
275 useful for the sponsoring organization, without concern of negatively
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
276 impacting the broader community. The sponsoring organization simply
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
277 has to take on the responsibility of all bisection and triage.
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
278
c4bab56944e8 LLVM 16
kono
parents: 221
diff changeset
279