3단 tile 피라미드 — 같은 모양, 두 생태계
CUDA랑 Metal에서 state-of-the-art GEMM이 같은 3단 tiling 구조로 수렴. Outer tile은 shared / threadgroup memory에 fit. Middle tile은 register에 fit. Inner tile은 matrix unit의 native 모양. 차이는 spell이랑 정확한 dimension이지 개념 아냐.
CUDA (Ada Lovelace / Hopper)
┌── 128×128 thread-block tile (CTA) ───┐
│ ┌─ 64×64 warp tile ─┐ │
│ │ 16×8×16 tensor-core │ · │ ← register + tensor core
│ │ 16×8×16 tensor-core │ · │
│ └────────────────────┘ · │
└──────────────────────────────────────┘ ← shared memory (double-buffered)Metal (Apple M-series)
┌── 128×128 threadgroup tile ───┐
│ ┌─ 64×64 SIMD-group tile ─┐ │
│ │ 8×8 matrix unit (FP16) │··│ ← register + matrix coprocessor
│ └─────────────────────────┘··│
└────────────────────────────────┘ ← threadgroup memory (double-buffered)Takeaway 셋:
- 같은 피라미드, 다른 micro-tile size. NVIDIA Tensor Core는 instruction당 16×8×16 (m×n×k) FP16 tile에서 동작. Apple matrix unit은 8×8 FP16. 다른 vendor IP, 동일한 role.
- smem layer에서 double-buffering 필수. Warp가 tile i에 compute하는 동안 tile i+1의 next-tile load가 병렬로 일어남. 없으면 matrix unit stall.
- Tile size는 shape별 auto-tune. 128×128이 전형이지만 tall-skinny GEMM (m=4, n=4096, k=4096 — single-token decode)엔 라이브러리가 32×64 + split-K 픽 가능.