Chrome Scheduling
London Perf Summit
March 17, 2014
Google Confidential and Proprietary
Overview
Google Confidential and Proprietary
Low vs. High Latency Modes
Stage B
Stage A
Queue of Frames
Google Confidential and Proprietary
Latency vs. Throughput
Stage B
Stage A
Queue of Frames
A:
B:
A:
B:
Caveat: Concurrency doesn’t necessarily�help throughput if we are already CPU bound.
Google Confidential and Proprietary
Latency and Memory
...
Stage A
Stage N
There are ways to reduce the number of�buffers needed in some cases, but it gets tricky.
Google Confidential and Proprietary
High Latency Mode
Stage B
Stage A
Queue of Frames
Google Confidential and Proprietary
Latency Recovery
Stage B
Stage A
Queue of Frames
Google Confidential and Proprietary
Latency Jank
Is it possible to have “jank” even if we are hitting 60fps?
Yes!
Examples:
Google Confidential and Proprietary
Balancing It All
Let’s look at how Chrome’s scheduling works (and sometimes doesn’t work) to balance:
Google Confidential and Proprietary
The Renderer’s Display Pipeline
Compositor�(CSS Anim,
Fast scroll)
Frames
Rasterization
Pending Trees
Active Trees
Blink (rAF)
Google Confidential and Proprietary
The Renderer’s Display Pipeline: Deadline
Compositor�(CSS Anim,
Fast scroll)
Frames
Rasterization
Pending Trees
Active Trees
Blink (rAF)
Deadline
(Draw)
Google Confidential and Proprietary
Coordinating: Renderer + Input
Compositor
Frames
Rasterization
Pending Trees
Active Trees
Blink
Input + BeginImplFrame
Forwarded Input + BeginMainFrame
Google Confidential and Proprietary
First Frame Latency is Very Important
The latency of all subsequent frames will only be as good as the first frame.
Some tricks we use to reduce first frame latency:
Google Confidential and Proprietary
Coordinating: Renderers + UI
UI Compositor
Renderer 1
Renderer Frames
UI Rasterization
Pending Trees
Active Trees
UI
Main
Renderer N
Renderer Frames
Google Confidential and Proprietary
Coordinating: Renderer + UI + GPU
UI Pipeline
Renderer Frames
Renderer Pipeline
Chrome GPU Service
WebGL, Canvas, or Ganesh
Commands
UI Compositor
Commands
Google Confidential and Proprietary
Hidden GPU Latency
Overlay A
Display Controller
Overlay N
GPU Driver
GPU Hardware
Chrome GPU Service
GL�Commands
Raw Commands
WebGL + Canvas
Renderer Texture Uploads + Frames
UI Texture Uploads +Frames
GL�Commands
OS Compositor
and Other Apps
Google Confidential and Proprietary
Pepper Plugin Display Pipeline
Issues:
UI Pipeline
Renderer Pipeline
Plugin Frames
Active Trees
PPAPI
Google Confidential and Proprietary
Synthetic Scheduler Tests
Goal: To test various scheduling corner cases in a way that is mostly immune to the variance introduced by code performance improvements.
A combination of features:
Many thanks to @skyostil for working on this.
Google Confidential and Proprietary
Synthetic Scheduler Tests: Delay Points
Each test can control a small, but key, set of synthetic delay points:
Google Confidential and Proprietary
Synthetic Scheduler Tests: Delay Point Configs
Each synthetic delay point can be configured in one of the following ways:
Google Confidential and Proprietary
Synthetic Scheduler Tests: Content
The following are content use cases the scheduler must address well.
Google Confidential and Proprietary
Synthetic Scheduler Tests: Putting It All Together
Recap: Delay points, Delay point modes, Content types
Running all possible combinations of the options above is not feasible, so we select a handful of use cases that we care about and/or provide good coverage. See design doc for details.
We are already tracking throughput in test results. Combined with @miletus’ latency benchmarking infrastructure, we are able to track latency improvements of these tests as well.
Google Confidential and Proprietary
Next Steps: Coordinate With Input
Google Confidential and Proprietary
Next Steps: Improve Latency
Google Confidential and Proprietary
Next Steps: Smart Concurrency
Google Confidential and Proprietary
Next Steps: Dirty Work
Google Confidential and Proprietary
Next Steps: Wishful Thinking
Google Confidential and Proprietary
Questions?
Google Confidential and Proprietary