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

less than 1 minute read

Published:

Step 7: cuBLAS Comparison

결과

전체 비교 (평균)

구현성능cuBLAS 대비
NumPy (CPU)13 GFLOPS0.6%
TVM Step 61039 GFLOPS50.1%
cuBLAS (NVIDIA)2074 GFLOPS100%

크기별 상세

크기TVM Step 6 (Unrolling)cuBLASTVM/cuBLAS
512x5121028 GFLOPS1302 GFLOPS79.0%
1024x10241050 GFLOPS2846 GFLOPS36.9%

분석

TVM Step 6(Unrolling)의 성능 특성

512x512 크기에서 약 79% 달성:

  • 작은 행렬 크기에서는 Step 1~5에서 적용한 Tiling, Shared Memory, Software Pipelining 위에 Loop Unrolling까지 더해져, cuBLAS 대비 상당히 근접한 성능을 보입니다.

1024x1024 크기에서 약 37%:

  • 큰 행렬에서는 여전히 cuBLAS의 고급 최적화 기법(예: Tensor Core 활용, 더 공격적인 타일링/벡터화)이 더 효과적입니다.

실행

# cuBLAS 벤치마크
python benchmarks/cublas_baseline.py

# TVM vs cuBLAS 비교
python benchmarks/compare_all_with_cublas.py

코드는 https://github.com/kimm240/matrix-multiplication-optimization-with-tvm에서 찾아볼 수 있습니다.


시리즈 포스트

Language: English