왜 이 글이 필요한가

PyTorch internals와 distributed training은 따로 떨어진 주제가 아니다. DDP와 FSDP는 autograd 흐름, tensor state, dispatcher 경로와 직접 연결된다.

예를 들어 DDP의 bucket scheduling은 gradient가 준비되는 시점을 autograd hook 수준에서 본다. FSDP는 parameter shard와 gather를 runtime에 섞는다.

즉 distributed runtime을 이해하려면 PyTorch internals 감각이 필요하다.

다음 글에서는 extension을 실제 프로젝트에서 배포 가능하게 만드는 packaging, testing, ABI 관점으로 간다.