Skip Navigation

Metal developer workflows

Locate and fix issues related to your app’s use of the Metal API and GPU functions.

Overview

Metal comes with a comprehensive suite of advanced developer tools to help you debug and optimize your Metal apps.

Runtime diagnostics

You can enable API Validation when running your app to check for incorrect Metal API usage. For more information, see Validating your app’s Metal API usage.

Enable Shader Validation when running your app to check for issues like out-of-bounds memory access, missing useResource calls, and stack overflows. For more information, see Validating your app’s Metal shader usage.

The Metal Performance HUD offers a visual overlay to catch performance issues while your app is running. For more information, see Monitoring your Metal app’s graphics performance.

Runtime performance analysis

The Metal system trace tool in Instruments provides a visual timeline of the parallel work on the CPU and the GPU, and the memory usage of your Metal app.

An Instruments screenshot displaying a capture in the Game Performance template.

You can begin profiling with the Game Performance template (see Analyzing the performance of your Metal app) or the Game Memory template (see Analyzing the memory usage of your Metal app).

Advanced Metal debugging and profiling

The Metal debugger in Xcode provides advanced tools for debugging and profiling your Metal app.

A screenshot of the Metal debugger showing the Bound Resources viewer and attachments for a draw command.

You can get summaries of your Metal workload with the Dependencies viewer and the Memory viewer, inspect individual resources, and selectively debug your shaders. For more information on debugging, see Investigating visual artifacts.

In addition, you can optimize your Metal app by drilling down performance bottlenecks with the Performance timeline and the per-line shader profiling results. For more information on profiling, see Optimizing GPU performance.

Learn more about Metal debugger.

Topics

Make your Metal app easier to debug by taking a few extra steps as you develop your code.
Learn how to use runtime tools to discover potential issues in your Metal app.
Get references for the set of performance metrics available across Metal tools.

See Also

Current page is Metal developer workflows