TVM

TVM 행렬 곱셈 최적화 - Step 7: cuBLAS Comparison

less than 1 minute read

Published:

TVM으로 최적화한 행렬 곱셈 구현을 NVIDIA cuBLAS와 비교합니다. Step 6에서 달성한 1053 GFLOPS는 cuBLAS의 50.7%에 해당하며, 512x512 크기에서는 85.6%의 성능을 달성했습니다.

TVM 행렬 곱셈 최적화 - Step 6: Loop Unrolling

1 minute read

Published:

Loop Unrolling을 통해 1050 GFLOPS를 달성했습니다. 루프 오버헤드를 제거하고 Instruction-Level Parallelism을 향상시켜 최종 성능을 끌어올렸습니다.

TVM 행렬 곱셈 최적화 - Step 5: Software Pipelining

3 minute read

Published:

Software Pipelining을 통해 1029 GFLOPS를 달성했습니다. 메모리 레이턴시를 연산으로 은폐하여 평균 58% 성능 향상을 달성했습니다. 이 포스트에서는 여러 반복을 겹쳐서 실행하는 Software Pipelining 기법을 다룹니다.

TVM Matrix Multiplication Optimization - Step 5: Software Pipelining

1 minute read

Published:

We achieved 1029 GFLOPS through Software Pipelining. We achieved an average 58% performance improvement by hiding memory latency with computation. This post covers Software Pipelining techniques that execute multiple iterations overlapped.

TVM 행렬 곱셈 최적화 - Step 4: Vectorization + Local Memory

2 minute read

Published:

Vectorization과 Local Memory(레지스터) 캐싱을 통해 평균 614 GFLOPS를 달성했습니다. 이 포스트에서는 Scalar Replacement 기법을 통한 레지스터 최적화와 벡터화를 통한 메모리 대역폭 활용을 다룹니다.

TVM 행렬 곱셈 최적화 - Step 3: Shared Memory

3 minute read

Published:

Shared Memory를 활용하여 큰 행렬(2048x2048)에서 101% 성능 향상을 달성했습니다. 이 포스트에서는 GPU 메모리 계층 구조와 Shared Memory를 통한 캐싱 전략, Cooperative Fetching 기법을 다룹니다.

TVM Matrix Multiplication Optimization - Step 3: Shared Memory

2 minute read

Published:

We achieved 101% performance improvement on large matrices (2048x2048) using Shared Memory. This post covers GPU memory hierarchy and caching strategies through Shared Memory, and Cooperative Fetching techniques.

TVM 행렬 곱셈 최적화 - Step 2: Tiling + Loop Reordering

5 minute read

Published:

Tiling과 Loop Reordering을 통해 481 GFLOPS를 달성했습니다. Step 1 대비 5.1배 향상된 성능을 보여줍니다. 이 포스트에서는 캐시 최적화를 위한 Tiling 기법과 레지스터 재사용을 극대화하는 Loop Reordering을 다룹니다.

TVM 행렬 곱셈 최적화 - Step 1: Simple GPU Binding

4 minute read

Published:

기본 GPU 구현으로 95 GFLOPS를 달성했습니다. CPU 대비 6.3배 향상된 성능을 보여주지만, A500 Peak (3.072 TFLOPS)의 3.1%에 불과합니다. 이 포스트에서는 Data Parallelism과 2D Thread Mapping을 통한 기본 GPU 구현을 다룹니다.

TVM Matrix Multiplication Optimization - Step 1: Simple GPU Binding

4 minute read

Published:

We achieved 95 GFLOPS with basic GPU implementation. This shows 6.3x performance improvement over CPU, but it is only 3.1% of A500 Peak (3.072 TFLOPS). This post covers basic GPU implementation through Data Parallelism and 2D Thread Mapping.

YOLOv4 → Vitis AI DPU 호환 TVM Transform Pass 구현

4 minute read

Published:

Vitis-AI의 Model Zoo는 DPU 제약을 고려해 이미 최적화된 AI 모델을 제공합니다. 본 문서는 TVM의 패턴 변환 패스를 활용해 원본 YOLOv4를 DPU 호환 YOLOv4-Leaky로 자동 변환하여, Model Zoo에서 제공하는 결과와 동등한 구조를 자동화하는 방법을 정리합니다.

YOLOv4 → Vitis AI DPU Compatible TVM Transform Pass Implementation

5 minute read

Published:

Vitis-AI Model Zoo provides AI models already optimized considering DPU constraints. This document summarizes how to automatically convert original YOLOv4 to DPU-compatible YOLOv4-Leaky using TVM pattern transformation passes, automating the same structure provided by Model Zoo.

[TIR][Schedule] Add FuseReductionEpilogue primitive to fuse epilogue into reduction init - 1. 문제 분석과 기존 솔루션의 한계

3 minute read

Published:

대부분의 AI 가속기는 Output = Input * Weight + Bias를 한 번의 사이클에 처리하는 MAC(Multiply-Accumulate) 명령어를 지원합니다. 하지만 컴파일러가 생성한 중간 코드(TIR)에서 이 두 연산이 분리되어 있다면, 하드웨어의 성능을 온전히 끌어낼 수 없습니다. 이 포스트에서는 TVM의 MatMul 블록에 Bias Addition을 인라인할 수 없는 문제를 분석하고, 기존 스케줄링 프리미티브의 한계를 살펴봅니다.

[TIR][Schedule] Add FuseReductionEpilogue primitive to fuse epilogue into reduction init - 1. Problem Analysis and Limitations of Existing Solutions

4 minute read

Published:

Most AI accelerators support MAC (Multiply-Accumulate) instructions that process Output = Input * Weight + Bias in a single cycle. However, if these two operations are separated in the intermediate code (TIR) generated by the compiler, the hardware performance cannot be fully utilized. This post analyzes the problem of not being able to inline Bias Addition into TVM MatMul blocks and examines the limitations of existing scheduling primitives.

[Optimization][Operator] Implement and enable Conv2d-Reshape-Add-ReLU fusion

3 minute read

Published:

Conv2d + Bias + ReLU는 딥러닝에서 가장 흔한 패턴입니다. 하지만 PyTorch 모델을 TVM으로 가져올 때 Reshape 노드가 중간에 삽입되어 퓨전이 깨지는 문제가 발생합니다. 이 포스트는 이 문제를 해결하기 위한 패턴 매칭 기반 퓨전 패스 구현 과정을 다룹니다.

[Optimization][Operator] Implement and enable Conv2d-Reshape-Add-ReLU fusion

3 minute read

Published:

Conv2d + Bias + ReLU is the most common pattern in deep learning. However, when importing PyTorch models into TVM, Reshape nodes are inserted in the middle, breaking fusion. This post covers the implementation process of a pattern matching-based fusion pass to solve this problem.