Starfish Efficient Concurrency Support for Computer Vision - - PowerPoint PPT Presentation

starfish
SMART_READER_LITE
LIVE PREVIEW

Starfish Efficient Concurrency Support for Computer Vision - - PowerPoint PPT Presentation

Starfish Efficient Concurrency Support for Computer Vision Applications Robert LiKamWa Lin Zhong Rice University 1 In the year 2020... 2 Continuous mobile vision Where did I place Remind me to Oh, I haven't


slide-1
SLIDE 1

Efficient ¡Concurrency ¡Support

for ¡

Computer ¡Vision ¡Applications

Robert ¡LiKamWa Lin ¡Zhong Rice ¡University

Starfish

1
slide-2
SLIDE 2

In ¡the ¡year ¡2020...

2
slide-3
SLIDE 3

Where did I place my keys? Oh, I haven't talked to Fred recently...

3

Remind me to tell Lin to let me graduate!

Continuous ¡mobile ¡vision

? ? ? ? ? ? ? ? ? ?

slide-4
SLIDE 4 4

Continuous ¡mobile ¡vision

Insufficient ¡concurrency ¡support ¡for ¡vision!

Energy ¡consumption ¡overwhelms ¡wearable ¡battery!

slide-5
SLIDE 5 5

Application Capture ¡Service Vision ¡ Headers

Vision ¡ Library

slide-6
SLIDE 6 6

Application Capture ¡Service Vision ¡ Headers

Scale Face

slide-7
SLIDE 7

Vision Library

7

Vision Library Vision Library

We ¡need ¡efficient ¡concurrency ¡support!

Camera ¡is ¡overworked Computation ¡is ¡overworked

200+ ¡ms 200+ ¡ms 200+ ¡ms

slide-8
SLIDE 8 8

Vision Library Vision Library Vision Library

Observations:

  • Vision ¡apps ¡utilize ¡common ¡vision ¡library
slide-9
SLIDE 9 9

Face SURF Scale Scale Scale Face

Observations:

  • Vision ¡apps ¡utilize ¡common ¡vision ¡library
  • Capture/Computation ¡is ¡redundant across ¡apps

common ¡ primitives

slide-10
SLIDE 10 10

Face SURF Scale Scale Scale Face

Observations:

  • Vision ¡apps ¡utilize ¡common ¡vision ¡library
  • Capture/Computation ¡is ¡redundant across ¡apps

common ¡ primitives

slide-11
SLIDE 11 11

Share ¡computations, Reduce ¡redundancy

Key ¡Idea:

Proposal: ¡Split-­‑process ¡design ¡for ¡centralized ¡control ¡

Scale SURF Face

slide-12
SLIDE 12

Starfish ¡Core Service

12

Vision ¡ Library

Starfish ¡Library Uses ¡vision ¡headers ¡ to ¡intercept ¡library ¡calls Starfish ¡Core ¡Service Executes, ¡tracks, ¡and ¡shares library ¡call ¡computations

Vision ¡ Library Starfish Library Starfish Library Starfish Library

slide-13
SLIDE 13

Starfish ¡Core Service

13

Vision ¡ Library Vision ¡ Library Starfish Library Starfish Library Starfish Library

Starfish

Split-­‑process ¡library ¡solution ¡for ¡ efficient, ¡transparent ¡multi-­‑app ¡service

slide-14
SLIDE 14 14

First ¡Call Execute ¡call ¡(20-­‑200 ¡ms) Store ¡results Subsequent ¡Call(s) Skip ¡execution (0 ¡ms) Retrieve ¡results

Starfish ¡Core

Vision ¡ Library Exec. Function ¡Cache Storage/Retrieval Function ¡Cache ¡ Arg ¡Search faceDetect(img) faceDetect(img) Vision ¡ Library Starfish Library Starfish Library Starfish Library

slide-15
SLIDE 15

Starfish ¡Core

Function Cache

15

Starfish

Share ¡computations, Reduce ¡redundancy

Cache ¡ Search Vision ¡ Library Vision ¡ Library Starfish Library Starfish Library Starfish Library

slide-16
SLIDE 16 16

Timing ¡optimizations: + ¡Reuse ¡"Fresh ¡Frames” ¡to ¡promote ¡cache ¡hits + ¡Delay ¡call ¡return ¡to ¡encourage ¡device ¡sleep

Starfish ¡Core

Function Cache Cache ¡ Search Vision ¡ Library Vision ¡ Library Starfish Library Starfish Library Starfish Library

slide-17
SLIDE 17

Starfish ¡Core

Function Cache

17

Starfish Library Starfish Library Starfish Library

Cache ¡ Search Vision ¡ Library

+ ¡Promote ¡sharing ¡by ¡reusing ¡"Fresh ¡Frames” + ¡Maintain ¡code ¡privacy ¡by ¡delaying ¡call ¡return + ¡Manage ¡concurrent ¡requests ¡through ¡fine-­‑grained ¡locks

Mitigating ¡ Split-­‑Process ¡Overhead

slide-18
SLIDE 18

Starfish ¡Core

18

Starfish Library Starfish Library Starfish Library

Function Cache Cache ¡ Search Vision ¡ Library

Reduce ¡expense ¡of ¡argument ¡passing Avoid ¡library ¡object ¡modification

slide-19
SLIDE 19

Split-­‑Process ¡in ¡the ¡Literature

19

Zero-­‑copy Require ¡library ¡redesign ¡ Object ¡tracking Optimized ¡for ¡code ¡offload

  • Object ¡Redefinition
  • Lightweight ¡RPC
  • SUN ¡RPC
  • Cloud ¡Transfer ¡
  • COMET
  • MAUI
  • CloneCloud
slide-20
SLIDE 20

Split-­‑Process ¡Argument ¡Passing

20

faceDetect( )

Goal: ¡Minimize ¡deep ¡copy ¡overhead

3.5 ¡ms

Shared ¡Memory Starfish ¡Library Starfish ¡Core

deep ¡copy is ¡expensive ¡

Vision ¡ Library Execution

slide-21
SLIDE 21

1) ¡Protected ¡shallow ¡copy

21

Issue ¡copy-­‑on-­‑write ¡(mprotect) ¡on ¡received ¡objects

faceDetect( )

Shared ¡Memory Starfish ¡Library Starfish ¡Core

Vision ¡ Library Execution CoW CoW

slide-22
SLIDE 22

2) ¡Direct ¡output ¡marshalling

22

Write ¡new ¡data ¡directly into ¡shared ¡memory

faceDetect( )

Shared ¡Memory Starfish ¡Library Starfish ¡Core

Vision ¡ Library Execution CoW CoW

malloc()

slide-23
SLIDE 23

3) ¡Reuse ¡arguments ¡from ¡prior ¡calls

23

Track, ¡reuse ¡previous ¡inputs/outputs

faceDetect( )

Shared ¡Memory Starfish ¡Library Starfish ¡Core

Vision ¡ Library Execution CoW CoW

malloc()

Argument ¡ Table (img, ¡shm_ptr)

slide-24
SLIDE 24

(Usually) ¡Zero-­‑Copy ¡Argument ¡Passing

24

+ ¡Reduce ¡deep ¡copies ¡through ¡argument ¡reuse + ¡Reduce ¡allocation ¡through ¡buffer ¡reuse ¡

faceDetect( )

Shared ¡Memory Starfish ¡Library Starfish ¡Core

Vision ¡ Library Execution CoW CoW

malloc()

Argument ¡ Table (img, ¡shm_ptr)

slide-25
SLIDE 25

Starfish ¡Optimizations

  • Share ¡Computations
  • Maintain ¡expectations ¡ ¡of ¡

developers ¡& ¡users

  • Increase ¡sharing ¡efficiency ¡

by ¡relaxing ¡timing

  • Decrease ¡redundancy
  • Reduce ¡argument ¡copy
  • Reuse ¡memory ¡buffers
25
slide-26
SLIDE 26 26

Experimental ¡Platform

Benchmarks: 1) ¡Per-­‑call ¡micro-­‑benchmarks 2) ¡Multi-­‑app ¡benchmarks

OMAP4430 ¡dual-­‑core ¡Cortex-­‑A9 ¡ pinned ¡to ¡600 ¡MHz OpenCV ¡+ ¡Android ¡+ ¡Google ¡Glass ¡ Monsoon ¡Power ¡Monitor

slide-27
SLIDE 27 27

First ¡Call

Native : 21 ¡ms

  • Unopt. ¡Starfish : 42 ¡ms ¡

Starfish : 24ms

Memory ¡optimizations ¡ cut ¡Starfish ¡overhead ¡in ¡half

0" 5" 10" 15" 20" 25" Receive&Outputs& Prepare&Outputs& Allocate&Outputs& Exec.&Function& Search&Cache& Send&Inputs& Prepare&Inputs&

Execution&time&(ms)&

Library'call'execution:'resize() resize()

Native& Starfish&Unopt.& Starfish&

slide-28
SLIDE 28 28

First ¡Call

Native : 21 ¡ms

  • Unopt. ¡Starfish : 42 ¡ms ¡

Starfish : 24ms

Second ¡Call

Native : 21 ¡ms

  • Unopt. ¡Starfish : 10 ¡ms ¡

Starfish : 6 ¡ms ¡

Starfish ¡works ¡well ¡when native ¡function ¡execution ¡>> ¡5 ¡ms

0" 5" 10" 15" 20" 25" Receive&Outputs& Prepare&Outputs& Allocate&Outputs& Exec.&Function& Search&Cache& Send&Inputs& Prepare&Inputs&

Execution&time&(ms)&

Library'call'execution:'resize() resize()

Native& Starfish&Unopt.& Starfish&

Memory ¡optimizations ¡ cut ¡Starfish ¡overhead ¡in ¡half

slide-29
SLIDE 29

Places ¡where ¡Starfish ¡fails

  • 5-­‑6 ¡ms ¡performance ¡overhead ¡per-­‑call:

– Bad ¡for ¡fast ¡computations – Bad ¡with ¡large, ¡deep ¡arguments

  • Non-­‑cacheable ¡functions

– Random, ¡temporal, ¡external ¡dependencies – Functions ¡with ¡specific ¡parameters

29

But ¡great ¡for ¡many ¡high-­‑level ¡functions: Face ¡detect, ¡Corner ¡detect, ¡Image ¡resize

slide-30
SLIDE 30

Starfish ¡vs. ¡Multi-­‑App ¡Workload

30

Scale Face Detect Face Recog If ¡Lin ¡then ¡That Social ¡Logger Facebook Google+ Twitter MySpace Whatsapp ... 0.3 ¡FPS

slide-31
SLIDE 31

0" 0.5" 1" 1.5" 2" 2.5" 3" 3.5" 4" 4.5" 5" 1" 2" 3" 4" 5" 6" 7" 8" 9" 10" Frame&Rate& (FPS)& Number&of&App&Instances& Na/ve" Starfish"

When ¡running ¡multiple ¡apps, ¡ Starfish ¡achieves ¡higher ¡performance

31

Higher ¡ is ¡ better

slide-32
SLIDE 32

When ¡running ¡multiple ¡apps, Starfish ¡draws ¡single-­‑app ¡power

32

0" 500" 1000" 1500" 2000" 2500" 1" 2" 3" 4" 5" 6" 7" 8" 9" 10" Power& Consump-on& (mW)& Number&of&App&Instances& Na.ve" Starfish"

Lower is ¡ better

slide-33
SLIDE 33

When ¡running ¡multiple ¡apps, Starfish ¡draws ¡single-­‑app ¡power

33

0" 500" 1000" 1500" 2000" 2500" 1" 2" 3" 4" 5" 6" 7" 8" 9" 10" Power& Consump-on& (mW)& Number&of&App&Instances& Na.ve" Starfish"

Starfish ¡achieves ¡efficient ¡concurrency ¡support! ¡

slide-34
SLIDE 34

Starfish ¡Core

Function Cache

34

Starfish

Share ¡computations, Reduce ¡redundancy

Cache ¡ Search Vision ¡ Library Vision ¡ Library Starfish Library Starfish Library Starfish Library

slide-35
SLIDE 35 35

Continuing mobile ¡vision

Mitigating Analog Signal ¡Chain Bandwidth

Preserving User/Subject Privacy Designing Efficient Systems

slide-36
SLIDE 36

Starfish: ¡ Share ¡computations, ¡Reduce ¡redundancy

36

Transparent, ¡efficient ¡library ¡call ¡caching

  • Timing ¡optimizations ¡for ¡

frame ¡freshness ¡and ¡performance ¡preservation

  • Memory ¡optimizations for ¡

minimal ¡deep ¡copy ¡and ¡small ¡cache ¡footprint

Google ¡Glass ¡Experiments:

  • Low ¡overhead ¡

Memory ¡optimizations ¡slash ¡overhead ¡in ¡half

  • Reduced ¡power ¡draw

Multi-­‑app ¡workloads ¡draw ¡Single ¡app ¡ ¡power