Deepak Sharma
Deepak Sharma

Reputation: 6477

Metal performance debugging

I have a Metal application on iOS where I take video frames and pass each frame through a number of shaders, some are compute shaders applied in multiple passes and 4 of them are independent MTKViews which display computed textures (example, Histogram) along with video preview. Sometimes (but not always) on older hardware such as iPhone 6s, I notice the app has become too sluggish with frame rate dropping to 1 or 2 frames per second. Please let me know how to debug which Metal shaders are clogging the GPU/GPU and how do I optimize the performance of Metal related code.

Upvotes: 0

Views: 1765

Answers (1)

SurvivalMachine
SurvivalMachine

Reputation: 8356

  1. Run your application in Xcode.
  2. Select Debug -> Capture GPU frame
  3. Select Issue Navigator from the left toolbar
  4. Select Runtime
  5. Fix the listed issues, at least "high" priority.
  6. You can also see where the performance is being spent by looking at drawPrimitives etc. times in the debug navigator on the left.

To view a shader's performance details, select the draw or dispatch call from the event list on the left. There's a "performance" section.

Upvotes: 2

Related Questions