본문 바로가기

GPU-KERNEL

compute-bound, memory-bound, memory-stall - 문제가 아닌 커널의 본질적 성질

이 커널이 어떤자원 resource 을 중심으로 성능이 결정되는가를 나타내는 성격 characteristic

 

1. compute-bound = 연산이 중심인 커널의 성질

FMA, mul-add, tensor core 작업이 훨씬 많고 메모리 접근량은 상대적으로 적음

compute pipe 의 작업으로 성능 상한은 ALU 에서 결정

occupancy 를 올릴 필요 없음, register tile 크기를 키워 compute 밀도를 올리는 것이 핵심

compute-bound 는 성능이 잘 나오는 커널들이 보이는 전형적 성질

 

2. memory-bound = 메모리 트래픽이 지배적인 성질

bandwidth-limited kernel 이라는 정상적인 범주

  • softmax
  • layer norm
  • embedding lookup
  • scatter/gather
  • elementwise 개념

메모리 로딩이 본질, 메모리 바운드, 

메모리 패턴 최적화가 핵심 포인트

 

3. memory stall = 대부분은 커널의 작업 성질

두 가지 Memory Stall

본질적 memory stall

  • DRAM latency 는 피할 수 없음
  • gather/scatter 처럼 irregular 한 작업
  • 작업 자체가 memeory-centric 인 형태

비정상 memory stall

  • coalescing 실패
  • shared memory bank conflict
  • 불필요한 global memory 왕복
  • cache miss 최적화 가능

 

compute-bound, memory-bound, memory-stall 은 이 커널이 어떤 리소스를 중심으로 동작하는가를 뜻하는 성질, 

문제 상태라기 보다 커널을 분류하는 특성

어떤 커널 방식에서 자연스럽게 나타나는 정상 동작