Skip to content

Commit 61fb610

Browse files
authored
Merge pull request #14781 from graydon/batch-mode-driver-internals-docs
[Docs] Explain batch mode a bit, in DriverInternals.rst
2 parents c1b48a2 + 4867ec0 commit 61fb610

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

docs/DriverInternals.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,13 @@ in the current build. This is covered by checking if the input has been
9494
modified since the last build; if it hasn't, we only need to recompile if
9595
something it depends on has changed.
9696

97-
98-
Execute: Running the Jobs in a Compilation using a TaskQueue
99-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97+
Schedule: Ordering and skipping jobs by dependency analysis
98+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10099

101100
A Compilation's goal is to make sure every Job in its list of Jobs is handled.
102101
If a Job needs to be run, the Compilation attempts to *schedule* it. If the
103102
Job's dependencies have all been completed (or determined to be skippable), it
104-
is added to the TaskQueue; otherwise it is marked as *blocked.*
103+
is scheduled for execution; otherwise it is marked as *blocked.*
105104

106105
To support Jobs compiling individual Swift files, which may or may not need to
107106
be run, the Compilation keeps track of a DependencyGraph. (If file A depends on
@@ -111,6 +110,22 @@ that were directly blocked on it, and check to see if any other Jobs now need
111110
to run based on the DependencyGraph. See the section on :doc:`DependencyAnalysis`
112111
for more information.
113112

113+
Batch: Optionally combine similar jobs
114+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115+
116+
The Driver has an experimental "batch mode" that examines the set of scheduled
117+
jobs just prior to execution, looking for jobs that are identical to one another
118+
aside from the primary input file they are compiling in a module. If it finds
119+
such a set, it may replace the set with a single BatchJob, before handing it off
120+
to the TaskQueue; this helps minimize the overall number of frontend processes
121+
that run (and thus do potentially redundant work).
122+
123+
Once any batching has taken place, the set of scheduled jobs (batched or
124+
otherwise) is transferred to the TaskQueue for execution.
125+
126+
Execute: Running the Jobs in a Compilation using a TaskQueue
127+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128+
114129
The Compilation's TaskQueue controls the low-level aspects of managing
115130
subprocesses. Multiple Jobs may execute simultaneously, but communication with
116131
the parent process (the driver) is handled on a single thread. The level of

0 commit comments

Comments
 (0)