어느 기둥이 깨졌는지 알려주는 CUDA 프로파일러
Nsight Compute는 NVIDIA의 per-kernel profiler. 도는 CUDA process에 attach해서 모든 커널 launch에 대해 상세 counter 캡처, 읽기 좋은 dashboard로 제시. BLAS 작업엔 가장 중요한 metric 여섯:
| Metric | 값 (RTX 4090에서 cuBLAS GEMM 4096³) | 의미 |
|---|---|---|
| Compute (SM) Throughput | 80.27% | Tensor pipe 켜짐 — 목표 그거 |
| Memory Throughput | 42.54% | L2 도움; DRAM 절반 idle |
| DRAM Throughput | 18.15% | GEMM이 compute-bound, BW-bound 아님 — 확인 |
| L2 Hit Rate | 93.64% | Tile size가 operand를 L2에 hot 유지 |
| Achieved Occupancy | 16.64% | SM당 ~8 warp 스케줄 (reg + smem 한계) |
| FMA pipeline busy | ~73% | GEMM이 fused MUL-ADD instruction 지배 |
Internal 커널 duration: FP16-Tensor-Core path에서 2.63 ms ≈ 52 TF/s. Wall time ~2118 ms 인 이유는 Nsight가 instrumented profiling pass 40+ 주입. Nsight 안에서 perf 판단할 땐 항상 'internal' 시간 읽고, wall time 아냐.
그림 읽기
그 표가 'healthy' 모습. 커널이 compute-bound (80% SM), L2이 일 잘 함 (94% hit rate), FMA pipe가 limiting factor. 헤드룸 essentially 없음 — 라이브러리 기둥이 이미 max한 ~26%-from-perfect 커널.
Unhealthy 커널 모습:
- SM Throughput < 30% + DRAM Throughput > 80% → bandwidth-bound. core 안 먹임.
- SM Throughput < 30% + DRAM < 30% → idle / launch 오버헤드 지배. Block 너무 적거나 커널 너무 짧음.
- L2 Hit Rate < 50% → tile size가 안 맞음. tile 줄이거나 주변 op fuse.
- Occupancy < 10% → register spilling.
--maxrregcount시도 또는 더 적은 register 쓰게 재구성.