Przejdź do treści
Biblioteka skilli
Programowanie · Testowanie

tensor-core-utilization

/tensor-core-utilization

Przenosi mnożenia macierzy na rdzenie tensorowe przez poprawę kształtów, precyzji i wyrównania, a potem mierzy, czy rdzenie faktycznie zadziałały, gdy kernel GEMM lub attention działa poniżej deklarowanej przepustowości.

Repozytorium
AI-SKILLS ↗
Licencja
MIT
Ostatnia zmiana repozytorium
05.09.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 05.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Przenosi mnożenia macierzy na rdzenie tensorowe przez poprawę kształtów, precyzji i wyrównania, a potem mierzy, czy rdzenie faktycznie zadziałały, gdy kernel GEMM lub attention działa poniżej deklarowanej przepustowości.

Oryginalny opis (EN)

Get matrix multiplies onto the tensor cores by fixing shapes, precision, and alignment, then measure that the cores actually fired. Use when a GEMM or attention kernel runs far below the card's advertised throughput and you suspect it fell back to the CUDA cores.

Jak działa

  1. Method
  2. Checks
  3. Boundaries
Sekcje z nagłówków SKILL.md, w oryginale · 60 linii, 490 słów
Podgląd SKILL.md
---
name: tensor-core-utilization
description: Get matrix multiplies onto the tensor cores by fixing shapes, precision, and alignment, then measure that the cores actually fired. Use when a GEMM or attention kernel runs far below the card's advertised throughput and you suspect it fell back to the CUDA cores.
---

# Tensor core utilization

Tensor cores perform a small matrix multiply-accumulate per instruction and
supply most of a modern GPU's FLOPs, but only when shapes, dtype, and alignment
let the library dispatch to them. A GEMM that looks healthy can quietly run on
the slower FP32 CUDA cores at a fraction of peak because one dimension is odd or
the inputs are the wrong precision. The job is to satisfy the dispatch
conditions and then confirm the cores lit up.

## Method

1. **Feed the shapes the MMA units want.** The units work on fixed tiles, so
   keep M, N, and K multiples of 8 for FP16 and BF16, and multiples of 16 for
   INT8. On A100 and newer, cuBLAS is happiest when all three are multiples of
   16. Pad a dimension like 4095 up rather than leaving it odd.
2. **Use a precision the cores accept.** Tensor cores run FP16, BF16, TF32,
   INT8, and FP8 on Hopper, not plain FP32. On Ampere and later, enable TF32
   (`torch.backends.cuda.matmul.allow_tf32 = True`) so existing FP32 matmuls
   dispatch to tensor cores with minimal accuracy loss. Prefer BF16 for training
   because of its wider exponent range.
3. **Align pointers and leading dimensions.** Best throughput needs inputs
   aligned to 16 bytes, and cuBLASLt prefers leading dimensions that are
   multiples of 8 elements. Misaligned or non-contiguous tensors force a slower
   path or extra copies; avoid slicing that produces unaligned views into the
   matmul.
4. **Let the library choose the kernel, then pin it.** cuBLAS and CUTLASS ship
   tuned tensor-core kernels. Enable autotuning
   (`torch.backends.cudnn.benchmark = True` for fixed shapes) so it picks the
   best tile, and cache that choice for stable shapes instead of re-searching
   every step.
5. **Measure that tensor cores actually ran.** Do not assume. In Nsight Compute
   read `sm__pipe_tensor_op_hmma.avg.pct_of_peak_sustained_active`; near zero
   means the work fell to CUDA cores. Across a cluster, watch the DCGM field
   `DCGM_FI_PROF_PIPE_TENSOR_ACTIVE`. A profiler trace showing kernels named
   `s16816gemm` or `cutlass...tensorop` also confirms the path.
6. **Raise arithmetic intensity so the cores stay fed.** Tensor cores are fast
   enough that many GEMMs turn memory-bound. Fuse the epilogue (bias,
   activation) into the GEMM, batch small matmuls together, and increase tile
   reuse so HBM bandwidth is not the ceiling that hides the compute you
   unlocked.

## Checks

- Does the tensor-pipe utilization metric sit well above zero for the target
  kernel?
- Are M, N, and K all multiples of 8 (16 for INT8), with any odd dimension
  padded?
- Are the inputs a tensor-core dtype (FP16, BF16, TF32, INT8, FP8), not FP32?
- Does measured TFLOP/s approach a real fraction of the card's tensor-core peak,
  not its FP32 peak?

## Boundaries

This covers making matmul-shaped work reach the tensor cores and confirming it.
The numerical safety of running in FP16 or BF16 (loss scaling, overflow) is
mixed-precision-deployment; INT8 calibration and accuracy gates are
quantization-deployment. Shapes fixed by model architecture may resist padding,
which is a modeling trade-off, not a kernel fix.

Wersje

W bazie nie ma innych skilli o nazwie tensor-core-utilization.

Migawka bazy z 13.11.2026 · wersja paczki 71ed71f00269 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90cuda-cpp-kernels
    Pisze jądra CUDA C++ do przyspieszania obliczeń przez torch.utils.cpp_extension i nvcc, z redukcjami i tensor cores.
  • 100kernel-cute-writing
    Pisze kernele GPU w NVIDIA CuTe DSL (API Python CUTLASS 4.x): kernele elementwise, wzorce GEMM, redukcje, hierarchię pamięci z TMA i operacje MMA na tensor core.
  • 96cuda-streams
    Zarządza czasem życia tensorów na strumieniach CUDA i pomaga ocenić, czy record_stream da się uniknąć, w tym wait_stream, zdarzenia CUDA i API przekazujące tensory ze strumieni bocznych.
  • 100cuda-attention-kernel-patterns
    Opisuje wzorce i pułapki implementacji CUDA operatora Attention domeny ONNX (opset 23 i 24): kaskada dyspozycji w attention.cc, kernele masek i biasu oraz diagnoza routingu testów.
  • 90cuda-kernel-basics
    Uczy pisać pierwsze kernele CUDA, które mapują pracę na siatkę, łączą dostępy do pamięci globalnej i utrzymują dość warpów, by ukryć opóźnienia, gdy kernel działa daleko poniżej możliwości karty.
  • 85kernel-evolution
    Decyduje, czy warto zmieniać jądro GPU, a potem pisze, weryfikuje i mierzy zmianę, także przy decyzji o łączeniu operatorów.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.