Hardware

Hardware note는 AI system 뒤의 physical resource ladder를 설명합니다. CPU register/cache, SRAM, RAM, GPU VRAM, storage, network가 여기에 들어갑니다. 목표는 vendor별 숫자를 외우는 것이 아니라 어떤 layer가 workload를 제한하는지 판단하는 것입니다.

대부분의 infra 문제는 하나의 질문으로 줄일 수 있습니다.

Hardware Map

AreaUse forStart
Memory hierarchyregister, L1/L2/L3 cache, SRAM, DRAM, VRAM, disk, network latencyMemory hierarchy
Storage and networklocal disk, shared filesystem, object storage, Ethernet, InfiniBand-style interconnectStorage and network
GPU systemsVRAM, HBM bandwidth, tensor compute, host-device transfer, interconnectGPU
HPC executionscheduler, allocation, Slurm, distributed job, checkpoint/restartHPC

Performance Ladder

유용한 mental model은 가장 빠르고 작은 층에서 가장 느리고 큰 층으로 내려가는 ladder입니다.

Data를 이 ladder 아래로 내릴수록 capacity는 보통 커지지만 latency도 커집니다. Training과 inference performance는 hot working set을 compute unit 가까이에 유지할 수 있는지에 크게 좌우됩니다.

Read This First When

SymptomLikely layer
GPU utilization이 낮음data loading, CPU preprocessing, synchronization, network, tiny kernel
model이 memory에 들어가지 않음GPU VRAM, activation memory, optimizer state, KV cache
worker를 늘려도 빨라지지 않음storage metadata, CPU contention, network, all-reduce, scheduler layout
training이 몇 step마다 멈춤checkpoint IO, logging, validation, dataloader refill
distributed run scaling이 나쁨interconnect bandwidth/latency, batch size, gradient synchronization
inference latency tail이 큼batching policy, KV cache pressure, queueing, network, cold load

Resource Axes

AxisMeaningTypical fix direction
Computearithmetic unit이 limitlarger batch, fused kernel, 더 좋은 tensor shape
Capacitymodel 또는 batch가 들어가지 않음smaller batch/context, checkpointing, sharding
Bandwidthdata movement가 arithmetic을 지배layout, precision, fusion, cache locality
Latency많은 small wait가 지배batching, fewer round trip, local cache
IOstorage가 compute를 먹이지 못함materialization, streaming format, local scratch
Networkremote transfer 또는 all-reduce가 지배placement, fewer sync, better sharding