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

Eeb061c8b2816b771920da1b3e7904a3?s=128

Swift India

January 25, 2020
Tweet

Transcript

  1. Metal and Metal Kit By- Akanksha Sharma Twitter : @akanksharmaa

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

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

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

    low level, 2D, 3D Architectures—Platforms, devices, GPUs
  5. Then Apple introduced DEEP INTEGRATION

  6. None
  7. None
  8. None
  9. 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
  10. 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
  11. Basic Addition

  12. Argument Tables

  13. None
  14. None
  15. Multithreading in Metal

  16. None
  17. Metal in Machine Learning

  18. None
  19. Linear Algebra Matrix-Matrix Multiplication Matrix-Vector Multiplication Triangular Matrix Factorization and

    Linear Solvers
  20. 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
  21. None
  22. None
  23. None
  24. None
  25. None
  26. What’s new in MPS this year • Support for new

    networks • Improved performance • Easier to use
  27. None
  28. Apple Frameworks using Metal

  29. None
  30. Thank You!!