GPU profiling

GPU Profiling on Ubuntu Touch Devices

Introduction

Profiling is the act of gathering data about the performance of a task with the ambition to improve the performance.

For CPUs, there are many standard tools to gather information about what the CPU is doing, allowing the developer to identify inefficient code and optimize it. These tools include the QML Profiler in Qt Creator down to perf and ftrace. Some of these techniques and tools are described at QML profiling

However the tooling for profiling tasks on GPUs is much less standardized, and the state is usually GPU-manufacturer specific. In addition the information these tools can gather is also much more limited, due to the design of OpenGL and GPUs in general.

Types of GPU Profiling Tool

There are 2 primary types of GPU profiling tool available, each revealing differing aspects of how your application utilizes the GPU.

API tracer

This runs on the CPU side, intercepting all the raw GL calls the application is making to the GPU driver. This allows an experienced developer to learn exactly what the application is asking the GPU to do, and spot any troublesome call combinations.

These tools record the GL calls to file, allowing them to be replayed on the device, and on the developer's PC.

Open source options are

  • apitrace - available to install on Ubuntu

  • vogl - would need to build and deploy manually

Some GPU manufacturers have more advanced playback applications which can give a developer an idea on how their GPU will interpret those calls, enable/disable rendering options and visualize intermediate rendering state (with wireframes, overdraw indications, etc).

A large drawback of these types of tools are that they impact performance on the device significantly, so while the data gathered is informative if one is experienced in GL, it does not easily show where performance bottlenecks originate. It is also difficult to track down a performance glitch with a long-running process, as the trace file gets huge fast.

GPU performance counter tool

These tools are able to read critical performance statistics the GPU writes as it is working, and visualize them to the developer. These statistics can clearly indicate what the GPU is doing, and reveal bottlenecks like looking up too many textures, poorly performing shaders or cache misses)

On Desktops, there are a few basic free tools available for Intel GPUs. In the "intel-gpu-tools" package are

  • intel-gpu-top
  • intel-perf-counters

which dumps statistics to your shell.

The mobile GPU case is more promising, there are free to use proprietary tools for many mobile GPUs:

  • Adreno (Nexus 4, 7) - some free but closed source tools available

  • Mali (BQ Aquaris 4, M10) - some free but closed source (plus limitations) tools available

  • PowerVr (Meizu MX 4) - some open source tools available!

Instructions on how to install and use these are provided in the following section:

Guides for the various GPU Profiling tools

Click through to dedicated pages on installing and using the various GPU Profiling tools available. Please confirm the GPU in your device before continuing.

CPU-side

GPU-side

Mobile

Desktop

-- gerboland 2015-07-02 19:18:06

Touch/GPU profiling (last edited 2016-07-01 10:00:38 by gerboland)