CUDA Graph Capture: Static-Shape Inference Graph + Latency Tail Bitirme
CUDA Graph — kernel launch overhead'ini eliminating teknik. Bir compute graph'i tek seferlik 'capture' et, sonra 'replay' et — her replay 5-10 µs (kernel launch'un 30-50 µs'sinden çok daha az). Inference latency için kritik (özellikle decoded tokens fast-path). vLLM kullanır. Static-shape gerek (shape değişirse re-capture).
Şükrü Yusuf KAYA
22 dakikalık okuma
İleripython
# === CUDA Graph manual capture ===import torch # Warmupfor _ in range(3): out = model(input_ids)torch.cuda.synchronize() # Static buffersstatic_input = torch.zeros_like(input_ids)static_output = torch.zeros_like(out) # Captureg = torch.cuda.CUDAGraph()with torch.cuda.graph(g): static_output.copy_(model(static_input)) # Replay (fast path)def fast_inference(new_input): static_input.copy_(new_input) g.replay() return static_output.clone() # Bench (Llama 3.1 8B, seq=1024, decode step):# torch.eager: 45 µs / step# torch.compile: 32 µs / step# CUDA graph replay: 8 µs / stepmanual CUDA Graph capture
✅ Teslim
- Mini model üzerinde CUDA Graph capture-replay test. 2) Sonraki ders: 13.8 — Speculative Decoding FT (EAGLE-2 + MEDUSA).
Yorumlar & Soru-Cevap
(0)Yorum yazmak için giriş yap.
Yorumlar yükleniyor...
İlgili İçerikler
Part 0 — Engineering Foundations
Fine-Tuning Cookbook'a Hoş Geldin: Sistematik, Stage Taksonomisi ve Reproducibility Kontratı
Öğrenmeye BaşlaPart 0 — Engineering Foundations
Reproducibility Stack: Seeds, cuDNN Flags ve Deterministic CUDA — 'Sende Niye Çalışıyor Bende Çalışmıyor' Sorununu Bitir
Öğrenmeye BaşlaPart 0 — Engineering Foundations