Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Metal and MetalKit

Metal and MetalKit

Presented at Swift Mumbai Meetup at Here Technologies
https://www.meetup.com/SwiftMumbai/events/266462321/

Introduction to the powerful Metal and MetalKit frameworks. To understand where and how to utilize their capabilities.
And how to use Metal framework to build in running machine learning models in iOS.

Speaker: Akanksha Sharma, Senior Software Engineer at Here Maps
GitHub: https://github.com/akanksharma
Twitter: https://twitter.com/akanksharmaa

Swift India

January 25, 2020
Tweet

More Decks by Swift India

Other Decks in Programming

Transcript

  1. Contents • What is Metal and MetalKit • Origin and

    Requirement • Capabilities • Usage of Metal in frameworks • Metal in Machine Learning • Metal in Simulator
  2. What is Metal? • Was introduced in 2014 with A7

    chip • Low overhead, high performance and incredibly efficient GPU Programming API
  3. Long history of GPU programming APIs Standards—OpenGL, OpenCL Domains—High level,

    low level, 2D, 3D Architectures—Platforms, devices, GPUs
  4. Shading Language Based on C++11 • Static subset • Built

    from LLVM and clang Additions • GPU hardware features (texture sampling, rasterization, compute operations, etc.) • Function overloading and templates
  5. Metal shaders built by Xcode compiler into Metal library files

    • Library contains archive of Metal shaders • With run-time APIs - Load a Metal library - Finalize compilation to GPU machine code
  6. MPSVector • Interprets data in MTLBuffer as a 1-dimensional array

    MPSMatrix • Interprets data in MTLBuffer as a rectangular array • Row-major order MPSTemporaryMatrix • Allocated from MTLHeap • Use for most of your intermediate matrices
  7. What’s new in MPS this year • Support for new

    networks • Improved performance • Easier to use