Examine your app's use of GPU resources in Instruments, and tune your app as needed.
The Metal GPU Counters instrument is part of Instruments in Xcode 11. Use an iOS or iPadOS device with an A11 or later processor and this instrument to profile how effectively your app uses the GPU. When the GPU is being underutilized, look for bottlenecks that are preventing work from getting to it, or find more work to send to it. When the GPU has enough work, find the commands that take the longest to execute and optimize them to use the GPU more efficiently.
The Metal GPU Counters instrument analyzes data you collect and tells you where your GPU bottlenecks might be. For example, you can determine whether the GPU is waiting for memory accesses or mathematical operations to complete, and whether you are sending it enough work to hide any latency from these operations. Use this data in conjunction with data from other tools, such as the Metal System Trace instrument or Shader Profiler, to determine whether your app is using the GPU effectively.
The Metal GPU Counters instrument provides three types of counters:
Occupancy counters — For measuring the number of threads the GPU is executing and which shader stages it is executing on those threads.
Limiter counters — For measuring activity in GPU subsystems. These measurements include time the GPU spends executing work and any stalls in a subsystem that prevent the GPU from starting new work.
Bandwidth counters — For measuring the overall memory bandwidth the GPU is using to read from or write to system memory.
Enable GPU Counters in the Metal System Trace Template
Because the GPU counters work well in tandem with Metal System Trace, the best way to use them is to enable them as part of a Metal System Trace capture.
In Instruments, after selecting the Metal System Trace template, click and hold the Record button until the menu appears, then choose the Recording Options menu item:
Then, select the Performance Limiters option: