SlideShare a Scribd company logo
© 2020 OctoML and University of Washington
Introduction to the TVM Open
Source Deep Learning Compiler
Stack
Luis Ceze
w/ Tianqi Chen, Thierry Moreau, Jared Roesch, Ziheng Jiang,
Lianmin Zheng, Eddie Yan, Meghan Cowan, Chien-Yu Lin,
Haichen Shen, Leyuan Wang, Yuwei Hu, Carlos Guestrin,
Arvind Krishnamurthy, Zach Tatlock, and many in the Apache
TVM community!
© 2020 OctoML and University of Washington
A perfect storm
2
Growing set of requirements: Cost, latency, power, security & privacy
Cambrian explosion of models,
workloads, and use cases CNN GAN RNN MLP DQNN
Rapidly evolving ML software
ecosystem
Silicon scaling limitations
(Dennard and Moore)
Cambrian explosion of HW backends.
Heterogeneous HW
© 2020 OctoML and University of Washington
Current Dominant Deep Learning
Systems Landscape
3
Frameworks and
Inference engines
DL Compilers
Kernel
Libraries
Hardware
Orchestrators
Azure ML GCP Datalab
cuDNN NNPack MKL-DNN
Open source, automated
end-to-end optimization
framework for deep learning
Hand optimized
© 2020 OctoML and University of Washington
Stack
4
End-to-end,
framework to metal open
stack.
Research and deployment.
High-Level Differentiable IR
Tensor Expression IR
LLVM, CUDA, Metal VTA
Edge
FPGA
Cloud
FPGA
ASIC
Open source synthesizable deep
learning accelerator design
© 2020 OctoML and University of Washington
Automated by Machine Learning
5
High-Level Differentiable IR
Tensor Expression IR
LLVM, CUDA, Metal VTA
Edge
FPGA
Cloud
FPGA
ASIC
TVM: Automated End-to-end Optimizations for Deep Learning. Chen et al. OSDI 18
ML-based
Optimization
AutoTVM
AutoVTA
Hardware Fleet
© 2020 OctoML and University of Washington
End-user perspective:
Compile & deploy
6
import tvm
from tvm import relay
graph, params =
Frontend.from_keras
(keras_resnet50)
graph, lib, params =
Relay.build(graph, target)
Compile Deploy
© 2020 OctoML and University of Washington
Open Source Community
and Impact
7
Open source: ~420+ contributors from UW, Berkeley, Cornell, UCLA, Amazon, Huawei, NTT, Facebook, Microsoft,
Qualcomm, Alibaba, Intel, …
Incubated as Apache TVM. Independent governance, allowing competitors to
collaborate.
Used in production at leading companies
Deep Learning
Compiler Service
DSP/Tensor engine
for mobile
Mobile and Server
Optimizations
Cloud-side model
optimization
© 2020 OctoML and University of Washington 8
© 2020 OctoML and University of Washington
Existing Deep Learning Frameworks
9
Frameworks
Hardware
Primitive Tensor operators such as
Conv2D
High-level data flow graph
Offload to heavily optimized DNN operator
library
eg. cuDNN
© 2020 OctoML and University of Washington
Engineering costs limits progress
10
cuDNN Engineering intensive
New operator introduced by operator fusion optimization potential
benefit: 1.5x speedup
Frameworks
© 2020 OctoML and University of Washington
Our approach: Learning-based Learning System
11
Frameworks
Hardware
Directly generate optimized program
for new operator workloads and hardware
High-level data flow graph and optimizations
Machine Learning based Program Optimizer
© 2020 OctoML and University of Washington
Tensor Compilation/Optimization as a
search problem
12
Tensor Expression (Specification)
C = tvm.compute((m, n),
lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
Search Space of Possible Program Optimizations
Low-level Program Variants
© 2020 OctoML and University of Washington
Search Space Example (1/3)
13
Search Space of Possible Program Optimizations
Vanilla Code
Tensor Expression (Specification)
C = tvm.compute((m, n),
lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
© 2020 OctoML and University of Washington
Search Space Example (2/3)
14
Search Space of Possible Program Optimizations
Loop Tiling for Locality
Tensor Expression (Specification)
C = tvm.compute((m, n),
lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
© 2020 OctoML and University of Washington
Search Space Example (3/3)
15
Search Space of Possible Program Optimizations
Map to Accelerators
Tensor Expression (Specification)
C = tvm.compute((m, n),
lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
© 2020 OctoML and University of Washington
Optimization space is really large…
16
Loop Transformations
Thread
Bindings
Cache
Locality
Thread Cooperation Tensorization
Latency
Hiding
Typically explored via human intuition.
How can we automate this? Auto-tuning is too slow.
Billions of possible
optimization
choices
Tensor Expression (Specification)
C = tvm.compute((m, n),
lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
© 2020 OctoML and University of Washington
Problem Formalization
17
Search Space
Expression
Objective
Code Generator
Optimization
Configuration
Cost:
Execute Time
Program
AutoOpt
© 2020 OctoML and University of Washington
Black-box Optimization
18
Challenge: Lots of experimental trials, each trial costs ~1 second
Code Generator
Try each configuration until we find a good one
Search Space
Expression AutoTVM
© 2020 OctoML and University of Washington
Cost-model Driven Approach
19
Search Space
Expression AutoOpt
Challenge: Need reliable cost model per hardware
Use cost model to pick configuration
Code Generator
Cost Model
© 2020 OctoML and University of Washington
Statistical Cost Model
20
Search Space
Expression AutoOpt Code Generator
Our approach: Use machine learning to learn a statistical cost model
Statistical
Cost Model
Learning
Training data
Benefit: Automatically adapt to hardware type Important: How to design the cost model
© 2020 OctoML and University of Washington
Search
Space
Expression
2
2 AutoTVM
Shared
Cost Model
Code
Generator
New Tasks
Historical data from related operators
(tasks)
Need task invariant
representation
Transfer learning
AutoTVM Overview
21
Conv2D
Matmul
O(microseconds) inference vs. O(seconds) execution
Search
Space
Expression AutoTVM
Code
Generator
Statistical
Cost Model
Learning
Training data
High-level
configurations
Low-level
Abstract Syntax Tree
(AST)
Benefit: Low-level AST is a common representation (General, task
invariant)
Your favourite model
Statistical features
of AST
+ +
Learning to Optimize Tensor Programs. Chen et al. NeurIPS 18
© 2020 OctoML and University of Washington
Does it work?
22
Better than hand-tuned code in a few minutes
1.50x faster than hand-tuned in steady state
AutoTVM + transferred model
3x to 10x faster tuning w/ transfer
learning
© 2020 OctoML and University of Washington
Device Fleet: Distributed Test Bed for AutoTVM
23
Resource
Allocation
Resource
Token
Resource Manager (Tracker)
Nvidia GPU Server
RPC RT CUDA
Android Phone
RPC RT OpenCL
Zynq FPGA Board
RPC RT Bitstream
AutoTVM
Experiment 1
AutoTVM
Experiment 2
Persistent Remote Session
Scale up optimization
Resource sharing
…
© 2020 OctoML and University of Washington
State-of-the-art performance
24
Nvidia Titan X ARM GPU (MALI)
ARM CPU
(Cortex-A53)
Key point: TVM offers good performance with low manual effort
© 2020 OctoML and University of Washington 25
End-to-end,
framework to metal open
stack.
Research and deployment
High-Level Differentiable IR
Tensor Expression IR
LLVM, CUDA, Metal VTA
Edge
FPGA
Cloud
FPGA
ASIC
Open source synthesizable deep
learning accelerator design
Stack
© 2020 OctoML and University of Washington
DL Accelerator Design Challenges
26
CNN
GAN
RNN
MLP
DQNN
• Keeping up with algorithmic changes
• Finding the right generality/efficiency trade-off
• Enable a “day-0” software stack on top
• (VTA: two-level ISA, templatized design)
• (VTA: templatized design + HW parameter search)
• (VTA: tight coupling with TVM)
© 2020 OctoML and University of Washington
VTA:
Open & Flexible Deep Learning Accelerator
27
Current TVM Stack
VTA Runtime & JIT Compiler
VTA MicroArchitecture VTA Simulator
VTA Hardware/Software Interface (ISA)
• Move hardware complexity to
software via a two-level ISA
• Runtime JIT-compile
accelerator micro code
• Native support in TVM
• Support heterogenous devices
(split graph)
• Support for secure execution
(soon)
© 2020 OctoML and University of Washington
VTA Open Source Deep Learning accelerator
28
• Decoupled access-execute with explicit software control
• Two-level ISA: JIT breaks multi-cycle “CISC” instructions into micro-ops
• Enables model retargeting without HW changes
• Focused on FPGA deployments so far. Exploring custom silicon
possibilities
Note: HW-SW Blueprint for Flexible Deep Learning Acceleration. Moreau et al. IEEE Micro 2019.
Template
© 2020 OctoML and University of Washington
µTVM - Bare-metal model deployment for edge
devices
29
Optimize, compile and package model for standalone bare metal
deployment
See recent demo on TVM for Azure Sphere deployment.
µTVM
ML model
Optimized
model
Optimized
operators
Standalone
runtime
Edge device board
(ARM, MIPS, RISC-
V,...)
Flash code
© 2020 OctoML and University of Washington
Coming Soon - Ultra low bit-width quantization
Automatic quantization: 5-20x
performance gains with reasonable
accuracy loss.
TVM supports flexible code
generation for a variety of data
types
Squeezenet on RaspberryPi 3
© 2020 OctoML and University of Washington
What about training?
31
• Direct support for training in Apache TVM
coming soon!
• Automatic generation of gradient programs
• Support for customized data types and training
on FPGAs
High-Level Differentiable IR
Tensor Expression IR
LLVM, CUDA, Metal VTA
Edge
FPGA
Cloud
FPGA
ASIC
Standalone training deployment
Standalone inference deployment
Gradient Program for Training
Automatic Differentiation
© 2020 OctoML and University of Washington
Other Ongoing TVM efforts
32
• Autoscheduling (Zheng et al. OSDI’20 @ UCBerkeley)
• Automatic synthesis of operator implementations (Cowan et al. CGO’20 @ UWash)
• Sparse support (NLP, graph convolutional neural networks, etc…)
• Secure enclaves
• …
• Join the community!
© 2020 OctoML and University of Washington
https://tvm.ai
33
2nd TVM conference on Dec 5, 2019. 200+ ppl last year!
• Video tutorials
• iPython notebooks tutorials
3rd TVM conference on Dec 3/4, 2020. https://tvmconf.org
© 2020 OctoML and University of Washington 34
https://octoml.ai
© 2020 OctoML and University of Washington
What I would like you to remember…
35
TVM is an emerging open source standard for ML compilation and optimization
TVM offers
• Improved time to market for ML
• Performance
• Unified support for CPU, GPU, Accelerators
• On the framework of your choice
OctoML is here to help you succeed in you ML deployment needs
End-to-end,
framework to
metal open stack.
Research and
deployment
High-Level Differentiable IR
Tensor Expression IR
LLVM, CUDA, Metal VTA
Edge
FPGA
Cloud
FPGA
ASIC

More Related Content

PPTX
GraalVMの多言語実行機能が凄そうだったので試しにApache Sparkに組み込んで動かしてみたけどちょっとまだ早かったかもしれない(Open So...
PDF
Fault, Error, Failure の違い
PPTX
AWS Interview Questions Part - 1 | AWS Interview Questions And Answers Part -...
PPTX
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
PDF
The Parquet Format and Performance Optimization Opportunities
PDF
PostgreSQL17対応版 EXPLAINオプションについて (第49回PostgreSQLアンカンファレンス@東京 発表資料)
PPT
整数列圧縮
PPTX
Apache Avro vs Protocol Buffers
GraalVMの多言語実行機能が凄そうだったので試しにApache Sparkに組み込んで動かしてみたけどちょっとまだ早かったかもしれない(Open So...
Fault, Error, Failure の違い
AWS Interview Questions Part - 1 | AWS Interview Questions And Answers Part -...
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
The Parquet Format and Performance Optimization Opportunities
PostgreSQL17対応版 EXPLAINオプションについて (第49回PostgreSQLアンカンファレンス@東京 発表資料)
整数列圧縮
Apache Avro vs Protocol Buffers

What's hot (20)

PDF
MySQLの文字コード事情
PDF
Parallel Execution With Oracle Database 12c - Masterclass
PDF
KVM環境におけるネットワーク速度ベンチマーク
PDF
Efficient Data Storage for Analytics with Apache Parquet 2.0
PDF
分散ストレージソフトウェアCeph・アーキテクチャー概要
PPTX
Apache Ignite vs Alluxio: Memory Speed Big Data Analytics
PDF
Hive on Tezのベストプラクティス
PDF
2章 Linuxカーネル - メモリ管理1
PDF
KubernetesでRedisを使うときの選択肢
PPTX
Apache Spark on Kubernetes入門(Open Source Conference 2021 Online Hiroshima 発表資料)
PPTX
ESP32特集の内容紹介
PDF
P2P Container Image Distribution on IPFS With containerd and nerdctl
PDF
MySQLとPostgreSQLの基本的なレプリケーション設定比較
PDF
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
PDF
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
PPTX
ChainerMNについて
PDF
【プライム・ストラテジー】ローカルLLMを複数組み合わてみた(インフラエンジニアのためのChatGPT入門LT)
PDF
Magnum IO GPUDirect Storage 最新情報
PDF
今話題のいろいろなコンテナランタイムを比較してみた
PPTX
分散ストレージ技術Cephの最新情報
MySQLの文字コード事情
Parallel Execution With Oracle Database 12c - Masterclass
KVM環境におけるネットワーク速度ベンチマーク
Efficient Data Storage for Analytics with Apache Parquet 2.0
分散ストレージソフトウェアCeph・アーキテクチャー概要
Apache Ignite vs Alluxio: Memory Speed Big Data Analytics
Hive on Tezのベストプラクティス
2章 Linuxカーネル - メモリ管理1
KubernetesでRedisを使うときの選択肢
Apache Spark on Kubernetes入門(Open Source Conference 2021 Online Hiroshima 発表資料)
ESP32特集の内容紹介
P2P Container Image Distribution on IPFS With containerd and nerdctl
MySQLとPostgreSQLの基本的なレプリケーション設定比較
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
ChainerMNについて
【プライム・ストラテジー】ローカルLLMを複数組み合わてみた(インフラエンジニアのためのChatGPT入門LT)
Magnum IO GPUDirect Storage 最新情報
今話題のいろいろなコンテナランタイムを比較してみた
分散ストレージ技術Cephの最新情報
Ad

Similar to “Introduction to the TVM Open Source Deep Learning Compiler Stack,” a Presentation from OctoML (20)

PDF
Cray HPC Environments for Leading Edge Simulations
PDF
Automatic generation of hardware memory architectures for HPC
PDF
Keynote (Mike Muller) - Is There Anything New in Heterogeneous Computing - by...
PPT
B Kindilien-Does Manufacturing Have a Future?
PDF
Real time machine learning proposers day v3
PPTX
Cloud Roundtable at Microsoft Switzerland
PDF
Edge optimized architecture for fabric defect detection in real-time
PDF
“Deploying Large Models on the Edge: Success Stories and Challenges,” a Prese...
PDF
Lecture 1 Advanced Computer Architecture
PDF
Adapting to a Cambrian AI/SW/HW explosion with open co-design competitions an...
PPTX
Highway to heaven - Microservices Meetup Munich
PDF
SAMOS 2018: LEGaTO: first steps towards energy-efficient toolset for heteroge...
PPT
TeraGrid Communication and Computation
PDF
Full resume dr_russell_john_childs_2013
PPTX
MPEG-21-based Cross-Layer Optimization Techniques for enabling Quality of Exp...
PDF
How to use Apache TVM to optimize your ML models
PDF
QPACE - QCD Parallel Computing on the Cell Broadband Engine™ (Cell/B.E.)
PPTX
SS-CPSIoT 2023_Kevin Mika and Piotr Zierhoffer presentation
PDF
Open Source Possibilities for 5G Edge Computing Deployment
PPT
Cluster Tutorial
Cray HPC Environments for Leading Edge Simulations
Automatic generation of hardware memory architectures for HPC
Keynote (Mike Muller) - Is There Anything New in Heterogeneous Computing - by...
B Kindilien-Does Manufacturing Have a Future?
Real time machine learning proposers day v3
Cloud Roundtable at Microsoft Switzerland
Edge optimized architecture for fabric defect detection in real-time
“Deploying Large Models on the Edge: Success Stories and Challenges,” a Prese...
Lecture 1 Advanced Computer Architecture
Adapting to a Cambrian AI/SW/HW explosion with open co-design competitions an...
Highway to heaven - Microservices Meetup Munich
SAMOS 2018: LEGaTO: first steps towards energy-efficient toolset for heteroge...
TeraGrid Communication and Computation
Full resume dr_russell_john_childs_2013
MPEG-21-based Cross-Layer Optimization Techniques for enabling Quality of Exp...
How to use Apache TVM to optimize your ML models
QPACE - QCD Parallel Computing on the Cell Broadband Engine™ (Cell/B.E.)
SS-CPSIoT 2023_Kevin Mika and Piotr Zierhoffer presentation
Open Source Possibilities for 5G Edge Computing Deployment
Cluster Tutorial
Ad

More from Edge AI and Vision Alliance (20)

PDF
“Optimizing Real-time SLAM Performance for Autonomous Robots with GPU Acceler...
PDF
“LLMs and VLMs for Regulatory Compliance, Quality Control and Safety Applicat...
PDF
“Simplifying Portable Computer Vision with OpenVX 2.0,” a Presentation from AMD
PDF
“Quantization Techniques for Efficient Deployment of Large Language Models: A...
PDF
“Introduction to Data Types for AI: Trade-Offs and Trends,” a Presentation fr...
PDF
“Introduction to Radar and Its Use for Machine Perception,” a Presentation fr...
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
PDF
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
PDF
“Beyond the Demo: Turning Computer Vision Prototypes into Scalable, Cost-effe...
PDF
“Running Accelerated CNNs on Low-power Microcontrollers Using Arm Ethos-U55, ...
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
PDF
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
PDF
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
PDF
“Evolving Inference Processor Software Stacks to Support LLMs,” a Presentatio...
PDF
“Efficiently Registering Depth and RGB Images,” a Presentation from eInfochips
PDF
“How to Right-size and Future-proof a Container-first Edge AI Infrastructure,...
PDF
“Image Tokenization for Distributed Neural Cascades,” a Presentation from Goo...
“Optimizing Real-time SLAM Performance for Autonomous Robots with GPU Acceler...
“LLMs and VLMs for Regulatory Compliance, Quality Control and Safety Applicat...
“Simplifying Portable Computer Vision with OpenVX 2.0,” a Presentation from AMD
“Quantization Techniques for Efficient Deployment of Large Language Models: A...
“Introduction to Data Types for AI: Trade-Offs and Trends,” a Presentation fr...
“Introduction to Radar and Its Use for Machine Perception,” a Presentation fr...
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
“Beyond the Demo: Turning Computer Vision Prototypes into Scalable, Cost-effe...
“Running Accelerated CNNs on Low-power Microcontrollers Using Arm Ethos-U55, ...
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“Evolving Inference Processor Software Stacks to Support LLMs,” a Presentatio...
“Efficiently Registering Depth and RGB Images,” a Presentation from eInfochips
“How to Right-size and Future-proof a Container-first Edge AI Infrastructure,...
“Image Tokenization for Distributed Neural Cascades,” a Presentation from Goo...

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Cloud computing and distributed systems.
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
A Presentation on Artificial Intelligence
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation theory and applications.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Cloud computing and distributed systems.
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
A Presentation on Artificial Intelligence
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Empathic Computing: Creating Shared Understanding
Understanding_Digital_Forensics_Presentation.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation theory and applications.pdf
cuic standard and advanced reporting.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

“Introduction to the TVM Open Source Deep Learning Compiler Stack,” a Presentation from OctoML

  • 1. © 2020 OctoML and University of Washington Introduction to the TVM Open Source Deep Learning Compiler Stack Luis Ceze w/ Tianqi Chen, Thierry Moreau, Jared Roesch, Ziheng Jiang, Lianmin Zheng, Eddie Yan, Meghan Cowan, Chien-Yu Lin, Haichen Shen, Leyuan Wang, Yuwei Hu, Carlos Guestrin, Arvind Krishnamurthy, Zach Tatlock, and many in the Apache TVM community!
  • 2. © 2020 OctoML and University of Washington A perfect storm 2 Growing set of requirements: Cost, latency, power, security & privacy Cambrian explosion of models, workloads, and use cases CNN GAN RNN MLP DQNN Rapidly evolving ML software ecosystem Silicon scaling limitations (Dennard and Moore) Cambrian explosion of HW backends. Heterogeneous HW
  • 3. © 2020 OctoML and University of Washington Current Dominant Deep Learning Systems Landscape 3 Frameworks and Inference engines DL Compilers Kernel Libraries Hardware Orchestrators Azure ML GCP Datalab cuDNN NNPack MKL-DNN Open source, automated end-to-end optimization framework for deep learning Hand optimized
  • 4. © 2020 OctoML and University of Washington Stack 4 End-to-end, framework to metal open stack. Research and deployment. High-Level Differentiable IR Tensor Expression IR LLVM, CUDA, Metal VTA Edge FPGA Cloud FPGA ASIC Open source synthesizable deep learning accelerator design
  • 5. © 2020 OctoML and University of Washington Automated by Machine Learning 5 High-Level Differentiable IR Tensor Expression IR LLVM, CUDA, Metal VTA Edge FPGA Cloud FPGA ASIC TVM: Automated End-to-end Optimizations for Deep Learning. Chen et al. OSDI 18 ML-based Optimization AutoTVM AutoVTA Hardware Fleet
  • 6. © 2020 OctoML and University of Washington End-user perspective: Compile & deploy 6 import tvm from tvm import relay graph, params = Frontend.from_keras (keras_resnet50) graph, lib, params = Relay.build(graph, target) Compile Deploy
  • 7. © 2020 OctoML and University of Washington Open Source Community and Impact 7 Open source: ~420+ contributors from UW, Berkeley, Cornell, UCLA, Amazon, Huawei, NTT, Facebook, Microsoft, Qualcomm, Alibaba, Intel, … Incubated as Apache TVM. Independent governance, allowing competitors to collaborate. Used in production at leading companies Deep Learning Compiler Service DSP/Tensor engine for mobile Mobile and Server Optimizations Cloud-side model optimization
  • 8. © 2020 OctoML and University of Washington 8
  • 9. © 2020 OctoML and University of Washington Existing Deep Learning Frameworks 9 Frameworks Hardware Primitive Tensor operators such as Conv2D High-level data flow graph Offload to heavily optimized DNN operator library eg. cuDNN
  • 10. © 2020 OctoML and University of Washington Engineering costs limits progress 10 cuDNN Engineering intensive New operator introduced by operator fusion optimization potential benefit: 1.5x speedup Frameworks
  • 11. © 2020 OctoML and University of Washington Our approach: Learning-based Learning System 11 Frameworks Hardware Directly generate optimized program for new operator workloads and hardware High-level data flow graph and optimizations Machine Learning based Program Optimizer
  • 12. © 2020 OctoML and University of Washington Tensor Compilation/Optimization as a search problem 12 Tensor Expression (Specification) C = tvm.compute((m, n), lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k)) Search Space of Possible Program Optimizations Low-level Program Variants
  • 13. © 2020 OctoML and University of Washington Search Space Example (1/3) 13 Search Space of Possible Program Optimizations Vanilla Code Tensor Expression (Specification) C = tvm.compute((m, n), lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
  • 14. © 2020 OctoML and University of Washington Search Space Example (2/3) 14 Search Space of Possible Program Optimizations Loop Tiling for Locality Tensor Expression (Specification) C = tvm.compute((m, n), lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
  • 15. © 2020 OctoML and University of Washington Search Space Example (3/3) 15 Search Space of Possible Program Optimizations Map to Accelerators Tensor Expression (Specification) C = tvm.compute((m, n), lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
  • 16. © 2020 OctoML and University of Washington Optimization space is really large… 16 Loop Transformations Thread Bindings Cache Locality Thread Cooperation Tensorization Latency Hiding Typically explored via human intuition. How can we automate this? Auto-tuning is too slow. Billions of possible optimization choices Tensor Expression (Specification) C = tvm.compute((m, n), lambda y, x: tvm.sum(A[k, y] * B[k, x], axis=k))
  • 17. © 2020 OctoML and University of Washington Problem Formalization 17 Search Space Expression Objective Code Generator Optimization Configuration Cost: Execute Time Program AutoOpt
  • 18. © 2020 OctoML and University of Washington Black-box Optimization 18 Challenge: Lots of experimental trials, each trial costs ~1 second Code Generator Try each configuration until we find a good one Search Space Expression AutoTVM
  • 19. © 2020 OctoML and University of Washington Cost-model Driven Approach 19 Search Space Expression AutoOpt Challenge: Need reliable cost model per hardware Use cost model to pick configuration Code Generator Cost Model
  • 20. © 2020 OctoML and University of Washington Statistical Cost Model 20 Search Space Expression AutoOpt Code Generator Our approach: Use machine learning to learn a statistical cost model Statistical Cost Model Learning Training data Benefit: Automatically adapt to hardware type Important: How to design the cost model
  • 21. © 2020 OctoML and University of Washington Search Space Expression 2 2 AutoTVM Shared Cost Model Code Generator New Tasks Historical data from related operators (tasks) Need task invariant representation Transfer learning AutoTVM Overview 21 Conv2D Matmul O(microseconds) inference vs. O(seconds) execution Search Space Expression AutoTVM Code Generator Statistical Cost Model Learning Training data High-level configurations Low-level Abstract Syntax Tree (AST) Benefit: Low-level AST is a common representation (General, task invariant) Your favourite model Statistical features of AST + + Learning to Optimize Tensor Programs. Chen et al. NeurIPS 18
  • 22. © 2020 OctoML and University of Washington Does it work? 22 Better than hand-tuned code in a few minutes 1.50x faster than hand-tuned in steady state AutoTVM + transferred model 3x to 10x faster tuning w/ transfer learning
  • 23. © 2020 OctoML and University of Washington Device Fleet: Distributed Test Bed for AutoTVM 23 Resource Allocation Resource Token Resource Manager (Tracker) Nvidia GPU Server RPC RT CUDA Android Phone RPC RT OpenCL Zynq FPGA Board RPC RT Bitstream AutoTVM Experiment 1 AutoTVM Experiment 2 Persistent Remote Session Scale up optimization Resource sharing …
  • 24. © 2020 OctoML and University of Washington State-of-the-art performance 24 Nvidia Titan X ARM GPU (MALI) ARM CPU (Cortex-A53) Key point: TVM offers good performance with low manual effort
  • 25. © 2020 OctoML and University of Washington 25 End-to-end, framework to metal open stack. Research and deployment High-Level Differentiable IR Tensor Expression IR LLVM, CUDA, Metal VTA Edge FPGA Cloud FPGA ASIC Open source synthesizable deep learning accelerator design Stack
  • 26. © 2020 OctoML and University of Washington DL Accelerator Design Challenges 26 CNN GAN RNN MLP DQNN • Keeping up with algorithmic changes • Finding the right generality/efficiency trade-off • Enable a “day-0” software stack on top • (VTA: two-level ISA, templatized design) • (VTA: templatized design + HW parameter search) • (VTA: tight coupling with TVM)
  • 27. © 2020 OctoML and University of Washington VTA: Open & Flexible Deep Learning Accelerator 27 Current TVM Stack VTA Runtime & JIT Compiler VTA MicroArchitecture VTA Simulator VTA Hardware/Software Interface (ISA) • Move hardware complexity to software via a two-level ISA • Runtime JIT-compile accelerator micro code • Native support in TVM • Support heterogenous devices (split graph) • Support for secure execution (soon)
  • 28. © 2020 OctoML and University of Washington VTA Open Source Deep Learning accelerator 28 • Decoupled access-execute with explicit software control • Two-level ISA: JIT breaks multi-cycle “CISC” instructions into micro-ops • Enables model retargeting without HW changes • Focused on FPGA deployments so far. Exploring custom silicon possibilities Note: HW-SW Blueprint for Flexible Deep Learning Acceleration. Moreau et al. IEEE Micro 2019. Template
  • 29. © 2020 OctoML and University of Washington µTVM - Bare-metal model deployment for edge devices 29 Optimize, compile and package model for standalone bare metal deployment See recent demo on TVM for Azure Sphere deployment. µTVM ML model Optimized model Optimized operators Standalone runtime Edge device board (ARM, MIPS, RISC- V,...) Flash code
  • 30. © 2020 OctoML and University of Washington Coming Soon - Ultra low bit-width quantization Automatic quantization: 5-20x performance gains with reasonable accuracy loss. TVM supports flexible code generation for a variety of data types Squeezenet on RaspberryPi 3
  • 31. © 2020 OctoML and University of Washington What about training? 31 • Direct support for training in Apache TVM coming soon! • Automatic generation of gradient programs • Support for customized data types and training on FPGAs High-Level Differentiable IR Tensor Expression IR LLVM, CUDA, Metal VTA Edge FPGA Cloud FPGA ASIC Standalone training deployment Standalone inference deployment Gradient Program for Training Automatic Differentiation
  • 32. © 2020 OctoML and University of Washington Other Ongoing TVM efforts 32 • Autoscheduling (Zheng et al. OSDI’20 @ UCBerkeley) • Automatic synthesis of operator implementations (Cowan et al. CGO’20 @ UWash) • Sparse support (NLP, graph convolutional neural networks, etc…) • Secure enclaves • … • Join the community!
  • 33. © 2020 OctoML and University of Washington https://tvm.ai 33 2nd TVM conference on Dec 5, 2019. 200+ ppl last year! • Video tutorials • iPython notebooks tutorials 3rd TVM conference on Dec 3/4, 2020. https://tvmconf.org
  • 34. © 2020 OctoML and University of Washington 34 https://octoml.ai
  • 35. © 2020 OctoML and University of Washington What I would like you to remember… 35 TVM is an emerging open source standard for ML compilation and optimization TVM offers • Improved time to market for ML • Performance • Unified support for CPU, GPU, Accelerators • On the framework of your choice OctoML is here to help you succeed in you ML deployment needs End-to-end, framework to metal open stack. Research and deployment High-Level Differentiable IR Tensor Expression IR LLVM, CUDA, Metal VTA Edge FPGA Cloud FPGA ASIC