Using Accelerate and simd

WWDC 2018

Posted by Den on August 30, 2018 · 8 mins read
Using Accelerate and simd

Using Accelerate and simd

WWDC 2018

Using Accelerate and simd

WWDC 2018

Composition of Accelerate Framework

  • vDSP — Signal processing
  • vImage — Image processing
  • vForce — Vector transcendental functions
  • BLAS, LAPACK, LinearAlgebra — Dense matrix computations
  • Sparse BLAS, Sparse Solvers — Sparse matrix computations
  • BNNS-Neural networks

Closely Related

  • simd — Small vector and matrix computation for CPU
  • Compression — Lossless data compression

Signal Processing Library

  • Basic operations on arrays
    - Add, subtract, multiply, conversion, etc.
  • Discrete Fourier/Cosine Transform
    - 1D DFT/ DCT/ FFT
    - 2D FFT
  • Convolution and correlation

Demo

Signal Extraction from Noise Link

Essential Computations

  • Analyze noisy signal with forward DCT
  • Remove frequency components of amplitude less than threshold
  • Reconstruct clean signal with inverse DCT

Demo

Halftone Descreening with 2D Fast Fourier Transform

Essential Computations

  • Transform halftone image with 2D FFT
  • Remove frequency components of the halftone screen
  • Reconstruct continuous tone image

Frequency Removal

  • zvmags
  • vthrsc
  • vclip
  • zrvmul

The simd Module

  • Simplified vector programming
  • Small (fixed-size) vector and matrices
  • Abstract architecture-specific types and intrinsics

simd

  • Matrices of size 2, 3, or 4 and vector of 2, 3, 4, 8, 16, 32, or 64
  • Arithmetic operators (+,-, *, /) work with both vectors and scalras
  • Supports common vector math and geometry operations (dot, length, clamp)
  • Quaternions

Rotating a Cube by Transforming Its Vertices Link

vImages

Image Processing Library

  • Conversion
  • Geometry
  • Convolution
  • Transform
  • Morphology

Adjust Color Saturation

  • The formula to adjust color saturation is
    Cb = ((Cb -128) * saturation) + 128
    Cr = ((Cr -128) * saturation) + 128

Workflow

More video effects

  • Rotation
  • Blur
  • Dither
  • Color quantization

LINPACK Benchmark

  • How fast can you solve a system of equations?
  • Actually 3 separate benchmarks
    - 100 x 100 system
    - 1000 x 1000 system
    - No hold barred
Performance in GFLOPS (bigger is better)