SlideShare a Scribd company logo
1 of 51
Download to read offline
Versatile Tensor Accelerator (VTA)
소개 및 활용법
2019.7.16
이제민
목
차
NPU 시작의 배경1
VTA 구조 및 성능2
코드 분석 및 튜토리얼 소개3
| 2 |
향후 계획4
Idea: tailor your chip architecture to the characteristics of a stable
workload
Hardware Specialization
NPU 시작의 배경
| 3 |
Evolution of Deep Learning
NPU 시작의 배경
| 4 |
Tape-out costs for ASICs is exorbitant 10x cost gap between 16nm
and 65nm
Flexibility vsRisky bet to design hardware accelerators for ever-
changing applications
. Efficiency Tradeoffs
• Does deep learning constitute a stable workload to justify ASIC-based
hardware accelerator?
Specialization challenge
NPU 시작의 배경
| 5 |
Highlights:
• Custom ASIC deployed in datacenters since 2015
• 65k 8-bit matrix multiply that offers peak throughput of 92 TOPS
• Targets mainstream NN applications (MLPs, CNNs, and LSTMs)
• Shows 30-80x improved TOPS/Watt over K80
What make TPUs Efficient?
• Integer inference (saves 6-30x energy over 16bit FP)
• Large amount of MACs (25x over K80)
• Large amount of on-chip memory (3.5x over K80)
TPU: Google’s Entry in the Deep Learning Acceleration Race
NPU 시작의 배경
| 6 |
[1] Jouppi et al., In-Datacenter Performance Analysis of a Tensor Processing Unit, ISCA 2017
Implementing a Convolutional Layer with matrix Multiplication
NPU 시작의 배경
| 7 |
Problem: Reading a large SRAM uses much more power than
arithmetic
Solution: Using “Systolic Execution” to save energy by reducing
reads and writes of the Unified Buffer
A systolic array is two dimensional collection of arithmetic units
that each independently compute a partial result as a function of
inputs from other arithmetic units that are considered upstream to
each unit
It is similar to blood being pumped through the human circulatory
system by heart, which is the origin of the systolic name
Systolic Execution in Matrix Array
NPU 시작의 배경
| 8 |
[1] Why systolic architectures?, IEEE computer ,1982.
Systolic Execution in one dimension
NPU 시작의 배경
| 9 |
Systolic Execution in two dimension
NPU 시작의 배경
| 10 |
In the TPU, the systolic array is rotated
• Weights are loaded from the top and the input data flows into the array in from the left
• Weights are preloaded and take effect with the advancing wave alongside the first data of a
new block
Pros & Cons
• Principled: Efficiently makes use of limited memory bandwidth, balances
computation to bandwidth availability.
• Specialized (computation needs to fit PE organization/functions)
- Improved efficiency, simple design, high concurrency/performance
- Good to do more with less memory bandwidth requirement
• Specialized: Not generally applicable because computation needs to fit the PE
functions/organization
Systolic array architecture
NPU 시작의 배경
| 11 |
TPU 성능 (Roofline)
NPU 시작의 배경
| 12 |
목
차
NPU 시작의 배경1
VTA 구조 및 성능2
코드 분석 및 튜토리얼 소개3
| 13 |
향후 계획4
전체 구조
VTA 구조 및 성능
| 14 |
4 modules: fetch, load, compute, store
3 stage architecture: load, compute, store
Two-Level ISA: provide the right tradeoff between expressiveness
and code compactness
• LOAD, GEMM, ALU, STORE instructions (CISC-like instructions)
- Multi-cycle compute and memory operations
• Use RISC micro-ops to perform single-cycle tensor operations
Parameterizablility
Exposing Task-level pipeline Parallelism: TLPP is based on the
paradigm of access-execute decoupling [1].
VTA Hardware Architecture 특징
VTA 구조 및 성능
| 15 |
[1] Decoupled access/execute computer architectures, ISCA’82
VTA Modules
VTA 구조 및 성능
| 16 |
Fetch module
VTA 구조 및 성능
| 17 |
Load Module
VTA 구조 및 성능
| 18 |
Compute Module
VTA 구조 및 성능
| 19 |
Store Module
VTA 구조 및 성능
| 20 |
3 stage pipeline (1)
VTA 구조 및 성능
| 21 |
3 stage pipeline (2)
VTA 구조 및 성능
| 22 |
How the GEMM core performs computation over data stored in
the input, weight, and accumulator memories.
No control flow: need to be unrolled
Two types of compute micro-ops: ALU and GEMM operations.
VTA GEMM core
VTA 구조 및 성능
| 23 |
Vta/hardware/Xilinx/sources
• vta.cc: VTA module의 정의와 모델 동작들을 정의한다.
• vta.h: ap_int의 타입과 함수들의 프로토타입의 정의
• `vta/include/vta/hw_spec.h`
• 이 파라메터를 가지고 `vta/config/vta_config.json`이 생성된다. 그리고 이건
`vta/config/vta_config.py`에 의해서 생성된다.
Vivado High-level synthesis, Xilinx
VTA 구조 및 성능
| 24 |
The shape of the tensor intrinsic
Clock frequency
Pipelining
Data type width
On-chip buffer sizes
LOG_INP_WIDTH,
LOG_WGT_WIDTH,
LOG_OUT_WIDTH는 같도록 설계
H/W parameters
VTA 구조 및 성능
| 25 |
Pipelining Tasks to Hide Memory Latency
VTA 구조 및 성능
| 26 |
[1] Decoupled access/execute computer architectures, ISCA’82
Addressing the programmability challenge
VTA 구조 및 성능
| 27 |
NNVM
• graph-level IR 이걸로 합치면서 효율성을 높인다.
VTA Runtime
• JIT compilation of VTA binaries (instruction streams and micro-kernel
code)
• manages shared memory
• performs synchronization to hand off execution to VTA
VTAs two-level ISAs
• high-level CISC ISA
- latency operation들을 정의함
- DMA loads, deep learning operators
• low-level and fixed latency RISC ISA
- low-level matrix-matrix operations.
VTA micro-architecture
• 딥러닝 하드웨어의 상세 디자인을 유연하게 하기 위함.
TVM stack에서의 각각의 컴포넌트
VTA 구조 및 성능
| 28 |
VTA’s JIT runtime enables cooperative execution of deep learning
workloads between a CPU host and the accelerator.
• 1) enable heterogeneous execution: one challenge present in fixed
function accelerators is model evolution, because most of these
accelerators are built for fixed models. Heterogeneous execution
overcomes this limitation by properly scheduling operators into
targets(e.g., CPUs or VTs), depending on their affinity for different
types of operators.
- Ex: it is well known that the first convolutional layer in most CNNs
contains operators with low arithmetic intensity that perform well on
CPUs.
- Another motivation behind heterogeneous execution is providing a
fallback mechanism for supporting emerging operators that are not yet
supported by VTA.
• 2) lower compiler design complexity
• 3) overcome physical limitations
• 4) reduce binary bloat
• 5) future proofing: Advances in system show trends towards
heterogeneous multi-accelerator system and scale-out acceleration.
JIT Runtime System
VTA 구조 및 성능
| 29 |
Full evaluation on PYNQ FPGA board (Z1)
Full Stack Evaluation (TVM)
VTA 구조 및 성능
| 30 |
TVM can offload most convolution operations to
the FPGA (40x speedup on off-loadable layers)
For comparable systems, VTA provides a significant performance
edge over conventional CPU and GPU-based inference
Evaluation over multiple CPU, GPU, and FPGA-quipped edge systems
VTA 구조 및 성능
| 31 |
목
차
NPU 시작의 배경1
VTA 구조 및 성능2
코드 분석 및 튜토리얼 소개3
| 32 |
향후 계획4
실행 환경
코드 분석 및 튜토리얼 소개
| 33 |
FPGA Programming
코드 분석 및 튜토리얼 소개
| 34 |
연산정의: A[1024] + B[1024] = C[1024]
Computation declaration
코드 분석 및 튜토리얼 소개
| 35 |
연산 정의
코드 분석 및 튜토리얼 소개
| 36 |
Batch, block_out이 기본 1,16 이다.
64 * 16 = 1024 연산
아래는 정의만 할 뿐 연산 되지는 않는다.
Computation C를 획득하는 방법은 다양함
가장 기본적인 방법으로 Schedule을 해서 VTA hardware primitives를
생성하면 아래와 같음
Scheduling the Computation
코드 분석 및 튜토리얼 소개
| 37 |
Default Schedule (tvm.lowering, pass 12개)
코드 분석 및 튜토리얼 소개
| 38 |
버퍼 정의
버퍼 lowering
z
버퍼 lowering
결과 버퍼에 저장
최종 결과 저장
Default Schedule (vta.lowering, pass 9개)
코드 분석 및 튜토리얼 소개
| 39 |
z VTA buffe로 접근하는
CPU Access 표시
z
z
VTA hardware intrinsic로 변환 되기 위해서는 아래의 조건을 포함
해야함.
• DMA copy operations: global scope을 local scope으로 copy하는
operation을 의미함
• Vector ALU operation들은 vector add를 실행해서 수행 해야 한다.
VTA는 아래 세 가지의 On-Chip SRAMs를 보유하고 있음
• env.inp_scope (read-only)
- 입력 행렬을 저장함
- 모양은 env.BATCH, env.BLOCK_IN (env.inp_dtype)
• env.wgt_scope (read-only)
- Weight matric을 저장
- 모양은 env.BLOCK_OUT, env.BLOCK_IN (type = env.wgt_dtype)
• env.acc_scope (read/write SRAM buffer): general purpose register file
- Accumulator 행렬
- 모양은 env.BATCH, env.BLOCK_OUT (type = env.acc_dtype)
Default Schedule에서 부족한 점
코드 분석 및 튜토리얼 소개
| 40 |
On-chip scoping 적용 후의 LowredFunc
코드 분석 및 튜토리얼 소개
| 41 |
Hardware accelerator에서 통상적으로 사용하는 방식
• DRAM에서 VTA on-chip buffer로 데이터 이동
- Pragmas 함수가 compiler에 DMA를 이용해서 copy operation을 bulk로
실행하라는 의미를 전달
ALU Operations
• VTA는 Accumulator buffer를 이용해서 tensor들을 연산하는 ALU가 내장
되어 있다.
• Vector addition loop를 VTA의 ALU를 이용하라고 명시적으로 지칭
해주어야한다.
DMA Transfers and ALU Operations
코드 분석 및 튜토리얼 소개
| 42 |
VTA에 맞게 변경된 Lowered TVM Schedule 코드
코드 분석 및 튜토리얼 소개
| 43 |
z
z
z ALU를 이용해서 연산 수행
VTA buffe로 접근하는
CPU Access 표시
Z
연산 처리 결과 내용 저장
컴파일, 실행, 검증
코드 분석 및 튜토리얼 소개
| 44 |
컴파일
실행
검증
TVM 함수로 컴파일 함
Tvm.build를 이용해서 function을 생성
• Schedule, desired signature of the function (inputs and outputs),
target language
모듈로 저장
• 모듈을 파일로 저장
• 추후에 로드함
• Ahead of time compilation의 기능
• Cross-compile the executable을 다른 환경으로 전달 할 수 있음 (RPC를
이용한 방법)
로드 하기
TVM Compilation
코드 분석 및 튜토리얼 소개
| 45 |
C api로 작성된 compiled tvm은 결국 어떤 언어를 이용해서도 invoke할
수 있음
DLPack에 기반한 array 접근 API를 제공함 (quick testing과 prototping)
• Remote context 생성 (pynq)
• Tvm.nd.array
• F()가 actual computation을 실행
• Asnumpy() 해석 가능 할 수 있게 결과를 복사해오고 포멧팅
Running the function
코드 분석 및 튜토리얼 소개
| 46 |
Assert를 이용해서 마지막으로 검증
Verifying Correctness
코드 분석 및 튜토리얼 소개
| 47 |
Pynq-z1 board: RPC server session
Print Instructions on PYNQ-Z1 (debug option)
코드 분석 및 튜토리얼 소개
| 48 |
Schedule to Machine code
튜토리얼
| 49 |
TVM Schedule
Lowering
LowerdFunc
runtime
Machine
Code
IR_PASS (11, 9)
CPU, VTA 코드
Ir.pass.py::Irb.emit(“VTAStoreBuff2D”)
Jit Compilation (Runtime.cc): 각각의 call들을 machine code로
변환
VTABufferAlloc
VTABufferFree
VTABufferCopy
A[1024] + B[1024] = C[1024]
VTATLSCommandHandle
VTARuntimeShutdown
VTASetDebugMode
VTABufferCPUPtr
VTAWriteBarrier
VTAReadBarrier
VTALoadBuffer2D
VTAStoreBUffer2D
VTAUopPush
VTAUopLoopBegin
VTAUopLoopEnd
VTAPushGEMMOp
VTAPushALUOp
VTADepPush
VTADepPop
VTASynchronize
목
차
NPU 시작의 배경1
VTA 구조 및 성능2
코드 분석 및 튜토리얼 소개3
| 50 |
향후 계획4
TVM, VTA 분석
• 각 IR PASS들이 어떻게 코드 변환을 수행하는 분석 중 (디버깅 환경에서)
- TVM IR PASS
- VTA IR PASS
• JIT compilation and runtime 분석
딥러닝 컴파일러 스택 개발
• Lowering 부분을 개발하여 통합 진행 (with 유미선 책임, 김영주 박사)
• A[1024] + B[1024] = C[1024] #vector addition
ResNet-18 network의 operation 분석
• VTA에서 실행 가능하도록 변환 되는 부분들 분석
안건
향후 계획
| 51 |

More Related Content

What's hot

OpenStack マルチノード環境構築
OpenStack マルチノード環境構築OpenStack マルチノード環境構築
OpenStack マルチノード環境構築HommasSlide
 
Efficient execution of quantized deep learning models a compiler approach
Efficient execution of quantized deep learning models a compiler approachEfficient execution of quantized deep learning models a compiler approach
Efficient execution of quantized deep learning models a compiler approachjemin lee
 
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning CompilerTae Young Lee
 
今もう一度知ろう。 Solarisのコンテナ型仮想化技術
今もう一度知ろう。 Solarisのコンテナ型仮想化技術今もう一度知ろう。 Solarisのコンテナ型仮想化技術
今もう一度知ろう。 Solarisのコンテナ型仮想化技術悟 宮崎
 
AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門kk_Ataka
 
Google Perf Tools (tcmalloc) の使い方
Google Perf Tools (tcmalloc) の使い方Google Perf Tools (tcmalloc) の使い方
Google Perf Tools (tcmalloc) の使い方Kazuki Ohta
 
Struts2を始めよう!
Struts2を始めよう!Struts2を始めよう!
Struts2を始めよう!Shinpei Ohtani
 
Wiresharkで検出できないチャットプログラム
Wiresharkで検出できないチャットプログラムWiresharkで検出できないチャットプログラム
Wiresharkで検出できないチャットプログラムShinichi Hirauchi
 
Qlik Replicate - IBM DB2 for LUWを ソースおよびターゲットエンドポイントとして使用する
Qlik Replicate - IBM DB2 for LUWをソースおよびターゲットエンドポイントとして使用するQlik Replicate - IBM DB2 for LUWをソースおよびターゲットエンドポイントとして使用する
Qlik Replicate - IBM DB2 for LUWを ソースおよびターゲットエンドポイントとして使用するQlikPresalesJapan
 
Aula 02 - Classes em C++ ( Parte 1 )
Aula 02 - Classes em C++ ( Parte 1 )Aula 02 - Classes em C++ ( Parte 1 )
Aula 02 - Classes em C++ ( Parte 1 )PeslPinguim
 
Windowsのパケットモニタ作成
Windowsのパケットモニタ作成Windowsのパケットモニタ作成
Windowsのパケットモニタ作成Shinichi Hirauchi
 
4章 Linuxカーネル - 割り込み・例外 2
4章 Linuxカーネル - 割り込み・例外 24章 Linuxカーネル - 割り込み・例外 2
4章 Linuxカーネル - 割り込み・例外 2mao999
 
Eclipse xtext 紹介
Eclipse xtext 紹介Eclipse xtext 紹介
Eclipse xtext 紹介Akira Tanaka
 
なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...
なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...
なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...whywaita
 
今だからこそ知りたい Docker Compose/Swarm 入門
今だからこそ知りたい Docker Compose/Swarm 入門今だからこそ知りたい Docker Compose/Swarm 入門
今だからこそ知りたい Docker Compose/Swarm 入門Masahito Zembutsu
 
Kubernetesのワーカーノードを自動修復するために必要だったこと
Kubernetesのワーカーノードを自動修復するために必要だったことKubernetesのワーカーノードを自動修復するために必要だったこと
Kubernetesのワーカーノードを自動修復するために必要だったことh-otter
 

What's hot (20)

OpenStack マルチノード環境構築
OpenStack マルチノード環境構築OpenStack マルチノード環境構築
OpenStack マルチノード環境構築
 
【BS4】時は来たれり。今こそ .NET 6 へ移行する時。
【BS4】時は来たれり。今こそ .NET 6 へ移行する時。 【BS4】時は来たれり。今こそ .NET 6 へ移行する時。
【BS4】時は来たれり。今こそ .NET 6 へ移行する時。
 
Efficient execution of quantized deep learning models a compiler approach
Efficient execution of quantized deep learning models a compiler approachEfficient execution of quantized deep learning models a compiler approach
Efficient execution of quantized deep learning models a compiler approach
 
The Deep Learning Compiler
The Deep Learning CompilerThe Deep Learning Compiler
The Deep Learning Compiler
 
今もう一度知ろう。 Solarisのコンテナ型仮想化技術
今もう一度知ろう。 Solarisのコンテナ型仮想化技術今もう一度知ろう。 Solarisのコンテナ型仮想化技術
今もう一度知ろう。 Solarisのコンテナ型仮想化技術
 
AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門AnsibleによるInfrastructure as code入門
AnsibleによるInfrastructure as code入門
 
Google Perf Tools (tcmalloc) の使い方
Google Perf Tools (tcmalloc) の使い方Google Perf Tools (tcmalloc) の使い方
Google Perf Tools (tcmalloc) の使い方
 
Struts2を始めよう!
Struts2を始めよう!Struts2を始めよう!
Struts2を始めよう!
 
Java8勉強会
Java8勉強会Java8勉強会
Java8勉強会
 
Wiresharkで検出できないチャットプログラム
Wiresharkで検出できないチャットプログラムWiresharkで検出できないチャットプログラム
Wiresharkで検出できないチャットプログラム
 
Qlik Replicate - IBM DB2 for LUWを ソースおよびターゲットエンドポイントとして使用する
Qlik Replicate - IBM DB2 for LUWをソースおよびターゲットエンドポイントとして使用するQlik Replicate - IBM DB2 for LUWをソースおよびターゲットエンドポイントとして使用する
Qlik Replicate - IBM DB2 for LUWを ソースおよびターゲットエンドポイントとして使用する
 
Aula 02 - Classes em C++ ( Parte 1 )
Aula 02 - Classes em C++ ( Parte 1 )Aula 02 - Classes em C++ ( Parte 1 )
Aula 02 - Classes em C++ ( Parte 1 )
 
Windowsのパケットモニタ作成
Windowsのパケットモニタ作成Windowsのパケットモニタ作成
Windowsのパケットモニタ作成
 
LLVM最適化のこつ
LLVM最適化のこつLLVM最適化のこつ
LLVM最適化のこつ
 
4章 Linuxカーネル - 割り込み・例外 2
4章 Linuxカーネル - 割り込み・例外 24章 Linuxカーネル - 割り込み・例外 2
4章 Linuxカーネル - 割り込み・例外 2
 
Eclipse xtext 紹介
Eclipse xtext 紹介Eclipse xtext 紹介
Eclipse xtext 紹介
 
なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...
なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...
なぜディスクレスハイパーバイザに至ったのか / Why did we select to the diskless hypervisor? #builde...
 
今だからこそ知りたい Docker Compose/Swarm 入門
今だからこそ知りたい Docker Compose/Swarm 入門今だからこそ知りたい Docker Compose/Swarm 入門
今だからこそ知りたい Docker Compose/Swarm 入門
 
入門Ansible
入門Ansible入門Ansible
入門Ansible
 
Kubernetesのワーカーノードを自動修復するために必要だったこと
Kubernetesのワーカーノードを自動修復するために必要だったことKubernetesのワーカーノードを自動修復するために必要だったこと
Kubernetesのワーカーノードを自動修復するために必要だったこと
 

Similar to Versatile tensor accelerator (vta) introduction and usage

Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014Gruter
 
[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance TuningJi-Woong Choi
 
[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How To[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How ToJi-Woong Choi
 
NSO Introduction
NSO IntroductionNSO Introduction
NSO IntroductionJunho Lee
 
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...OpenStack Korea Community
 
Cloud datacenter network architecture (2014)
Cloud datacenter network architecture (2014)Cloud datacenter network architecture (2014)
Cloud datacenter network architecture (2014)Gasida Seo
 
세션3_데보션테크데이_gitopsinfra_v1.1.pdf
세션3_데보션테크데이_gitopsinfra_v1.1.pdf세션3_데보션테크데이_gitopsinfra_v1.1.pdf
세션3_데보션테크데이_gitopsinfra_v1.1.pdfJaesuk Ahn
 
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arcNAVER D2
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험NHN FORWARD
 
MCU(nanheekim)
MCU(nanheekim)MCU(nanheekim)
MCU(nanheekim)Nanhee Kim
 
"Learning transferable architectures for scalable image recognition" Paper Re...
"Learning transferable architectures for scalable image recognition" Paper Re..."Learning transferable architectures for scalable image recognition" Paper Re...
"Learning transferable architectures for scalable image recognition" Paper Re...LEE HOSEONG
 
3rd SDN Interest Group Seminar-Session 3 (130123)
3rd SDN Interest Group Seminar-Session 3 (130123)3rd SDN Interest Group Seminar-Session 3 (130123)
3rd SDN Interest Group Seminar-Session 3 (130123)NAIM Networks, Inc.
 
네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLD네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLDKim Junghoon
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsTae Young Lee
 
2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)
2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)
2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)khuhacker
 
Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기
Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기
Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기Jongwon Han
 
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트OpenStack Korea Community
 

Similar to Versatile tensor accelerator (vta) introduction and usage (20)

Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014Vectorized processing in_a_nutshell_DeView2014
Vectorized processing in_a_nutshell_DeView2014
 
[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning[오픈소스컨설팅]Java Performance Tuning
[오픈소스컨설팅]Java Performance Tuning
 
[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How To[오픈소스컨설팅]Performance Tuning How To
[오픈소스컨설팅]Performance Tuning How To
 
NSO Introduction
NSO IntroductionNSO Introduction
NSO Introduction
 
Teratec Cluster
Teratec ClusterTeratec Cluster
Teratec Cluster
 
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
[OpenStack Days Korea 2016] Track2 - How to speed up OpenStack network with P...
 
Cloud datacenter network architecture (2014)
Cloud datacenter network architecture (2014)Cloud datacenter network architecture (2014)
Cloud datacenter network architecture (2014)
 
세션3_데보션테크데이_gitopsinfra_v1.1.pdf
세션3_데보션테크데이_gitopsinfra_v1.1.pdf세션3_데보션테크데이_gitopsinfra_v1.1.pdf
세션3_데보션테크데이_gitopsinfra_v1.1.pdf
 
Chapter2 ap group11
Chapter2 ap group11Chapter2 ap group11
Chapter2 ap group11
 
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
3.[d2 오픈세미나]분산시스템 개발 및 교훈 n base arc
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
 
MCU(nanheekim)
MCU(nanheekim)MCU(nanheekim)
MCU(nanheekim)
 
"Learning transferable architectures for scalable image recognition" Paper Re...
"Learning transferable architectures for scalable image recognition" Paper Re..."Learning transferable architectures for scalable image recognition" Paper Re...
"Learning transferable architectures for scalable image recognition" Paper Re...
 
3rd SDN Interest Group Seminar-Session 3 (130123)
3rd SDN Interest Group Seminar-Session 3 (130123)3rd SDN Interest Group Seminar-Session 3 (130123)
3rd SDN Interest Group Seminar-Session 3 (130123)
 
3. stream api
3. stream api3. stream api
3. stream api
 
네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLD네트워크 경량화 이모저모 @ 2020 DLD
네트워크 경량화 이모저모 @ 2020 DLD
 
Exploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMsExploring Deep Learning Acceleration Technology Embedded in LLMs
Exploring Deep Learning Acceleration Technology Embedded in LLMs
 
2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)
2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)
2015 제2회 동아리 해커 세미나 - 병렬컴퓨팅 소개 (16기 김정현)
 
Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기
Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기
Daily Continuous Deployment를 위한 Custom CLI 개발 및
 AWS Elastic Beanstalk에 적용하기
 
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
[OpenStack Days Korea 2016] Track3 - 방송제작용 UHD 스트로지 구성 및 테스트
 

Recently uploaded

MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionKim Daeun
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Kim Daeun
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Wonjun Hwang
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Wonjun Hwang
 

Recently uploaded (6)

MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 

Versatile tensor accelerator (vta) introduction and usage

  • 1. Versatile Tensor Accelerator (VTA) 소개 및 활용법 2019.7.16 이제민
  • 2. 목 차 NPU 시작의 배경1 VTA 구조 및 성능2 코드 분석 및 튜토리얼 소개3 | 2 | 향후 계획4
  • 3. Idea: tailor your chip architecture to the characteristics of a stable workload Hardware Specialization NPU 시작의 배경 | 3 |
  • 4. Evolution of Deep Learning NPU 시작의 배경 | 4 |
  • 5. Tape-out costs for ASICs is exorbitant 10x cost gap between 16nm and 65nm Flexibility vsRisky bet to design hardware accelerators for ever- changing applications . Efficiency Tradeoffs • Does deep learning constitute a stable workload to justify ASIC-based hardware accelerator? Specialization challenge NPU 시작의 배경 | 5 |
  • 6. Highlights: • Custom ASIC deployed in datacenters since 2015 • 65k 8-bit matrix multiply that offers peak throughput of 92 TOPS • Targets mainstream NN applications (MLPs, CNNs, and LSTMs) • Shows 30-80x improved TOPS/Watt over K80 What make TPUs Efficient? • Integer inference (saves 6-30x energy over 16bit FP) • Large amount of MACs (25x over K80) • Large amount of on-chip memory (3.5x over K80) TPU: Google’s Entry in the Deep Learning Acceleration Race NPU 시작의 배경 | 6 | [1] Jouppi et al., In-Datacenter Performance Analysis of a Tensor Processing Unit, ISCA 2017
  • 7. Implementing a Convolutional Layer with matrix Multiplication NPU 시작의 배경 | 7 |
  • 8. Problem: Reading a large SRAM uses much more power than arithmetic Solution: Using “Systolic Execution” to save energy by reducing reads and writes of the Unified Buffer A systolic array is two dimensional collection of arithmetic units that each independently compute a partial result as a function of inputs from other arithmetic units that are considered upstream to each unit It is similar to blood being pumped through the human circulatory system by heart, which is the origin of the systolic name Systolic Execution in Matrix Array NPU 시작의 배경 | 8 | [1] Why systolic architectures?, IEEE computer ,1982.
  • 9. Systolic Execution in one dimension NPU 시작의 배경 | 9 |
  • 10. Systolic Execution in two dimension NPU 시작의 배경 | 10 |
  • 11. In the TPU, the systolic array is rotated • Weights are loaded from the top and the input data flows into the array in from the left • Weights are preloaded and take effect with the advancing wave alongside the first data of a new block Pros & Cons • Principled: Efficiently makes use of limited memory bandwidth, balances computation to bandwidth availability. • Specialized (computation needs to fit PE organization/functions) - Improved efficiency, simple design, high concurrency/performance - Good to do more with less memory bandwidth requirement • Specialized: Not generally applicable because computation needs to fit the PE functions/organization Systolic array architecture NPU 시작의 배경 | 11 |
  • 12. TPU 성능 (Roofline) NPU 시작의 배경 | 12 |
  • 13. 목 차 NPU 시작의 배경1 VTA 구조 및 성능2 코드 분석 및 튜토리얼 소개3 | 13 | 향후 계획4
  • 14. 전체 구조 VTA 구조 및 성능 | 14 |
  • 15. 4 modules: fetch, load, compute, store 3 stage architecture: load, compute, store Two-Level ISA: provide the right tradeoff between expressiveness and code compactness • LOAD, GEMM, ALU, STORE instructions (CISC-like instructions) - Multi-cycle compute and memory operations • Use RISC micro-ops to perform single-cycle tensor operations Parameterizablility Exposing Task-level pipeline Parallelism: TLPP is based on the paradigm of access-execute decoupling [1]. VTA Hardware Architecture 특징 VTA 구조 및 성능 | 15 | [1] Decoupled access/execute computer architectures, ISCA’82
  • 16. VTA Modules VTA 구조 및 성능 | 16 |
  • 17. Fetch module VTA 구조 및 성능 | 17 |
  • 18. Load Module VTA 구조 및 성능 | 18 |
  • 19. Compute Module VTA 구조 및 성능 | 19 |
  • 20. Store Module VTA 구조 및 성능 | 20 |
  • 21. 3 stage pipeline (1) VTA 구조 및 성능 | 21 |
  • 22. 3 stage pipeline (2) VTA 구조 및 성능 | 22 |
  • 23. How the GEMM core performs computation over data stored in the input, weight, and accumulator memories. No control flow: need to be unrolled Two types of compute micro-ops: ALU and GEMM operations. VTA GEMM core VTA 구조 및 성능 | 23 |
  • 24. Vta/hardware/Xilinx/sources • vta.cc: VTA module의 정의와 모델 동작들을 정의한다. • vta.h: ap_int의 타입과 함수들의 프로토타입의 정의 • `vta/include/vta/hw_spec.h` • 이 파라메터를 가지고 `vta/config/vta_config.json`이 생성된다. 그리고 이건 `vta/config/vta_config.py`에 의해서 생성된다. Vivado High-level synthesis, Xilinx VTA 구조 및 성능 | 24 |
  • 25. The shape of the tensor intrinsic Clock frequency Pipelining Data type width On-chip buffer sizes LOG_INP_WIDTH, LOG_WGT_WIDTH, LOG_OUT_WIDTH는 같도록 설계 H/W parameters VTA 구조 및 성능 | 25 |
  • 26. Pipelining Tasks to Hide Memory Latency VTA 구조 및 성능 | 26 | [1] Decoupled access/execute computer architectures, ISCA’82
  • 27. Addressing the programmability challenge VTA 구조 및 성능 | 27 |
  • 28. NNVM • graph-level IR 이걸로 합치면서 효율성을 높인다. VTA Runtime • JIT compilation of VTA binaries (instruction streams and micro-kernel code) • manages shared memory • performs synchronization to hand off execution to VTA VTAs two-level ISAs • high-level CISC ISA - latency operation들을 정의함 - DMA loads, deep learning operators • low-level and fixed latency RISC ISA - low-level matrix-matrix operations. VTA micro-architecture • 딥러닝 하드웨어의 상세 디자인을 유연하게 하기 위함. TVM stack에서의 각각의 컴포넌트 VTA 구조 및 성능 | 28 |
  • 29. VTA’s JIT runtime enables cooperative execution of deep learning workloads between a CPU host and the accelerator. • 1) enable heterogeneous execution: one challenge present in fixed function accelerators is model evolution, because most of these accelerators are built for fixed models. Heterogeneous execution overcomes this limitation by properly scheduling operators into targets(e.g., CPUs or VTs), depending on their affinity for different types of operators. - Ex: it is well known that the first convolutional layer in most CNNs contains operators with low arithmetic intensity that perform well on CPUs. - Another motivation behind heterogeneous execution is providing a fallback mechanism for supporting emerging operators that are not yet supported by VTA. • 2) lower compiler design complexity • 3) overcome physical limitations • 4) reduce binary bloat • 5) future proofing: Advances in system show trends towards heterogeneous multi-accelerator system and scale-out acceleration. JIT Runtime System VTA 구조 및 성능 | 29 |
  • 30. Full evaluation on PYNQ FPGA board (Z1) Full Stack Evaluation (TVM) VTA 구조 및 성능 | 30 | TVM can offload most convolution operations to the FPGA (40x speedup on off-loadable layers)
  • 31. For comparable systems, VTA provides a significant performance edge over conventional CPU and GPU-based inference Evaluation over multiple CPU, GPU, and FPGA-quipped edge systems VTA 구조 및 성능 | 31 |
  • 32. 목 차 NPU 시작의 배경1 VTA 구조 및 성능2 코드 분석 및 튜토리얼 소개3 | 32 | 향후 계획4
  • 33. 실행 환경 코드 분석 및 튜토리얼 소개 | 33 |
  • 34. FPGA Programming 코드 분석 및 튜토리얼 소개 | 34 |
  • 35. 연산정의: A[1024] + B[1024] = C[1024] Computation declaration 코드 분석 및 튜토리얼 소개 | 35 |
  • 36. 연산 정의 코드 분석 및 튜토리얼 소개 | 36 | Batch, block_out이 기본 1,16 이다. 64 * 16 = 1024 연산 아래는 정의만 할 뿐 연산 되지는 않는다.
  • 37. Computation C를 획득하는 방법은 다양함 가장 기본적인 방법으로 Schedule을 해서 VTA hardware primitives를 생성하면 아래와 같음 Scheduling the Computation 코드 분석 및 튜토리얼 소개 | 37 |
  • 38. Default Schedule (tvm.lowering, pass 12개) 코드 분석 및 튜토리얼 소개 | 38 | 버퍼 정의 버퍼 lowering z 버퍼 lowering 결과 버퍼에 저장 최종 결과 저장
  • 39. Default Schedule (vta.lowering, pass 9개) 코드 분석 및 튜토리얼 소개 | 39 | z VTA buffe로 접근하는 CPU Access 표시 z z
  • 40. VTA hardware intrinsic로 변환 되기 위해서는 아래의 조건을 포함 해야함. • DMA copy operations: global scope을 local scope으로 copy하는 operation을 의미함 • Vector ALU operation들은 vector add를 실행해서 수행 해야 한다. VTA는 아래 세 가지의 On-Chip SRAMs를 보유하고 있음 • env.inp_scope (read-only) - 입력 행렬을 저장함 - 모양은 env.BATCH, env.BLOCK_IN (env.inp_dtype) • env.wgt_scope (read-only) - Weight matric을 저장 - 모양은 env.BLOCK_OUT, env.BLOCK_IN (type = env.wgt_dtype) • env.acc_scope (read/write SRAM buffer): general purpose register file - Accumulator 행렬 - 모양은 env.BATCH, env.BLOCK_OUT (type = env.acc_dtype) Default Schedule에서 부족한 점 코드 분석 및 튜토리얼 소개 | 40 |
  • 41. On-chip scoping 적용 후의 LowredFunc 코드 분석 및 튜토리얼 소개 | 41 |
  • 42. Hardware accelerator에서 통상적으로 사용하는 방식 • DRAM에서 VTA on-chip buffer로 데이터 이동 - Pragmas 함수가 compiler에 DMA를 이용해서 copy operation을 bulk로 실행하라는 의미를 전달 ALU Operations • VTA는 Accumulator buffer를 이용해서 tensor들을 연산하는 ALU가 내장 되어 있다. • Vector addition loop를 VTA의 ALU를 이용하라고 명시적으로 지칭 해주어야한다. DMA Transfers and ALU Operations 코드 분석 및 튜토리얼 소개 | 42 |
  • 43. VTA에 맞게 변경된 Lowered TVM Schedule 코드 코드 분석 및 튜토리얼 소개 | 43 | z z z ALU를 이용해서 연산 수행 VTA buffe로 접근하는 CPU Access 표시 Z 연산 처리 결과 내용 저장
  • 44. 컴파일, 실행, 검증 코드 분석 및 튜토리얼 소개 | 44 | 컴파일 실행 검증
  • 45. TVM 함수로 컴파일 함 Tvm.build를 이용해서 function을 생성 • Schedule, desired signature of the function (inputs and outputs), target language 모듈로 저장 • 모듈을 파일로 저장 • 추후에 로드함 • Ahead of time compilation의 기능 • Cross-compile the executable을 다른 환경으로 전달 할 수 있음 (RPC를 이용한 방법) 로드 하기 TVM Compilation 코드 분석 및 튜토리얼 소개 | 45 |
  • 46. C api로 작성된 compiled tvm은 결국 어떤 언어를 이용해서도 invoke할 수 있음 DLPack에 기반한 array 접근 API를 제공함 (quick testing과 prototping) • Remote context 생성 (pynq) • Tvm.nd.array • F()가 actual computation을 실행 • Asnumpy() 해석 가능 할 수 있게 결과를 복사해오고 포멧팅 Running the function 코드 분석 및 튜토리얼 소개 | 46 |
  • 47. Assert를 이용해서 마지막으로 검증 Verifying Correctness 코드 분석 및 튜토리얼 소개 | 47 |
  • 48. Pynq-z1 board: RPC server session Print Instructions on PYNQ-Z1 (debug option) 코드 분석 및 튜토리얼 소개 | 48 |
  • 49. Schedule to Machine code 튜토리얼 | 49 | TVM Schedule Lowering LowerdFunc runtime Machine Code IR_PASS (11, 9) CPU, VTA 코드 Ir.pass.py::Irb.emit(“VTAStoreBuff2D”) Jit Compilation (Runtime.cc): 각각의 call들을 machine code로 변환 VTABufferAlloc VTABufferFree VTABufferCopy A[1024] + B[1024] = C[1024] VTATLSCommandHandle VTARuntimeShutdown VTASetDebugMode VTABufferCPUPtr VTAWriteBarrier VTAReadBarrier VTALoadBuffer2D VTAStoreBUffer2D VTAUopPush VTAUopLoopBegin VTAUopLoopEnd VTAPushGEMMOp VTAPushALUOp VTADepPush VTADepPop VTASynchronize
  • 50. 목 차 NPU 시작의 배경1 VTA 구조 및 성능2 코드 분석 및 튜토리얼 소개3 | 50 | 향후 계획4
  • 51. TVM, VTA 분석 • 각 IR PASS들이 어떻게 코드 변환을 수행하는 분석 중 (디버깅 환경에서) - TVM IR PASS - VTA IR PASS • JIT compilation and runtime 분석 딥러닝 컴파일러 스택 개발 • Lowering 부분을 개발하여 통합 진행 (with 유미선 책임, 김영주 박사) • A[1024] + B[1024] = C[1024] #vector addition ResNet-18 network의 operation 분석 • VTA에서 실행 가능하도록 변환 되는 부분들 분석 안건 향후 계획 | 51 |