Skip to content

Commit 155ee7a

Browse files
authored
GPU thread --> raster thread (#3836)
This implements the “transition period” phase of the change proposed in flutter/flutter#29443 (comment).
1 parent d009c0d commit 155ee7a

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

src/docs/development/tools/devtools/timeline.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This chart is populated with individual frames as they are rendered
3535
in your application. Each bar in the chart represents a frame.
3636
The bars are color-coded to highlight the different portions of
3737
work that occur when rendering a Flutter frame: work from the UI
38-
thread and work from the GPU thread.
38+
thread and work from the raster thread (previously known as GPU thread).
3939

4040
![Screenshot from a timeline recording]({% asset tools/devtools/timeline_frame_rendering_chart.png @path %}){:width="100%"}
4141

@@ -47,29 +47,29 @@ The UI thread executes Dart code in the Dart VM. This includes
4747
code from your application as well as the Flutter framework.
4848
When your app creates and displays a scene, the UI thread creates
4949
a layer tree, a lightweight object containing device-agnostic
50-
painting commands, and sends the layer tree to the GPU thread
50+
painting commands, and sends the layer tree to the raster thread
5151
to be rendered on the device. Do **not** block this thread.
5252

53-
### GPU
53+
### Raster
5454

55-
The GPU thread executes graphics code from the Flutter Engine.
55+
The raster thread (previously known as the GPU thread) executes
56+
graphics code from the Flutter Engine.
5657
This thread takes the layer tree and displays it by talking to
5758
the GPU (graphic processing unit). You cannot directly access
58-
the GPU thread or its data, but if this thread is slow, it's a
59+
the raster thread or its data, but if this thread is slow, it's a
5960
result of something you've done in the Dart code. Skia, the
60-
graphics library, runs on this thread, which is sometimes called
61-
the rasterizer thread.
61+
graphics library, runs on this thread.
6262

6363
Sometimes a scene results in a layer tree that is easy to construct,
64-
but expensive to render on the GPU thread. In this case, you'll
64+
but expensive to render on the raster thread. In this case, you'll
6565
need to figure out what your code is doing that is causing
6666
rendering code to be slow. Specific kinds of workloads are more
6767
difficult for the GPU. They might involve unnecessary calls to
6868
`saveLayer()`, intersecting opacities with multiple objects,
6969
and clips or shadows in specific situations.
7070

7171
For more information on profiling, see
72-
[Identifying problems in the GPU graph][GPU thread].
72+
[Identifying problems in the GPU graph][GPU graph].
7373

7474
### Jank
7575

@@ -203,5 +203,5 @@ state. To import a timeline snapshot, you can drag and drop the
203203
snapshot into DevTools from any page. **Note the DevTools only
204204
supports importing files that were originally exported from DevTools.**
205205

206-
[GPU thread]: /docs/perf/rendering/ui-performance#identifying-problems-in-the-gpu-graph
206+
[GPU graph]: /docs/perf/rendering/ui-performance#identifying-problems-in-the-gpu-graph
207207
[Flutter performance profiling]: /docs/perf/rendering/ui-performance

src/docs/perf/rendering/ui-performance.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ steps to take, and tools that can help.
3636
## Diagnosing performance problems
3737

3838
To diagnose an app with performance problems, you'll enable
39-
the performance overlay to look at the UI and GPU threads.
39+
the performance overlay to look at the UI and raster threads.
40+
(The raster thread was previously known as the GPU thread.)
4041
Before you begin, you want to make sure that you're running in
4142
[profile mode][], and that you're not using an emulator.
4243
For best results, you might choose the slowest device that
@@ -134,15 +135,15 @@ The following screenshot shows the performance overlay running
134135
on the Flutter Gallery example:
135136

136137
![Screenshot of overlay showing zero jank]({% asset tools/devtools/performance-overlay-green.png @path %})
137-
<br>Performance overlay showing the GPU thread (top),
138+
<br>Performance overlay showing the raster thread (top),
138139
and UI thread (bottom).<br>The vertical green bars
139140
represent the current frame.
140141

141142
## Interpreting the graphs
142143

143-
The top graph shows the time spent by the GPU thread,
144-
the bottom one graph shows the time spent by the
145-
UI (CPU) thread.
144+
The top graph (marked "GPU") shows the time spent by
145+
the raster thread, the bottom one graph shows the time
146+
spent by the UI thread.
146147
The white lines across the graphs show 16ms increments
147148
along the vertical axis; if the graph ever goes over one
148149
of these lines then you are running at less than 60Hz.
@@ -166,7 +167,7 @@ the scene is too complicated to render quickly.
166167
![Screenshot of performance overlay showing jank with red bars]({% asset tools/devtools/performance-overlay-jank.png @path %})
167168
<br>The vertical red bars indicate that the current frame is
168169
expensive to both render and paint.<br>When both graphs
169-
display red, start by diagnosing the UI thread (Dart VM).
170+
display red, start by diagnosing the UI thread.
170171

171172
## Flutter's threads
172173

@@ -190,24 +191,28 @@ on other threads.
190191
Flutter's framework on your app's behalf.
191192
When your app creates and displays a scene, the UI thread creates
192193
a _layer tree_, a lightweight object containing device-agnostic
193-
painting commands, and sends the layer tree to the GPU thread to
194+
painting commands, and sends the layer tree to the raster thread to
194195
be rendered on the device. _Don't block this thread!_
195196
Shown in the bottom row of the performance overlay.
196197

197-
<dt markdown="1">**GPU thread**</dt>
198-
<dd markdown="1">The GPU thread takes the layer tree and displays
198+
<dt markdown="1">**Raster thread** (previously known as the GPU thread)</dt>
199+
<dd markdown="1">The raster thread takes the layer tree and displays
199200
it by talking to the GPU (graphic processing unit).
200-
You cannot directly access the GPU thread or its data but,
201+
You cannot directly access the raster thread or its data but,
201202
if this thread is slow, it's a result of something you've done
202-
in the Dart code. Skia, the graphics library, runs on this thread,
203-
which is sometimes called the _rasterizer_ thread.
203+
in the Dart code. Skia, the graphics library, runs on this thread.
204204
Shown in the top row of the performance overlay.
205+
This thread was previously known as the "GPU thread" because it
206+
rasterizes for the GPU. But it is running on the CPU. We renamed it
207+
to "raster thread" because many developers wrongly (but understandably)
208+
assumed the thread runs on the GPU unit.
205209

206-
<dt markdown="1">**I/O** thread</dt>
210+
<dt markdown="1">**I/O thread**</dt>
207211
<dd markdown="1">Performs expensive tasks (mostly I/O) that would
208-
otherwise block either the UI or GPU threads.
212+
otherwise block either the UI or raster threads.
209213
This thread is not shown in the performance overlay.
210-
214+
</dl>
215+
211216
For links to more information and videos,
212217
see [The Framework architecture][] on the
213218
[GitHub wiki][], and the community article,
@@ -268,11 +273,11 @@ can be said here?
268273
## Identifying problems in the GPU graph
269274

270275
Sometimes a scene results in a layer tree that is easy to construct,
271-
but expensive to render on the GPU thread. When this happens,
276+
but expensive to render on the raster thread. When this happens,
272277
the UI graph has no red, but the GPU graph shows red.
273278
In this case, you’ll need to figure out what your code is doing
274279
that is causing rendering code to be slow. Specific kinds of workloads
275-
are more difficult for the GPU. They might involve unnecessary calls
280+
are more difficult for the GPU. They might involve unnecessary calls
276281
to [`saveLayer`][], intersecting opacities with multiple objects,
277282
and clips or shadows in specific situations.
278283

0 commit comments

Comments
 (0)