You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c1bcfcf
Browse filesBrowse the repository at this point in the historyBrowse files
add light-mode images and Chinese translation for dense GEMM tutorial
Generate both dark and light variants of all 5 tutorial diagrams so
MkDocs Material can switch them via #only-dark / #only-light. Add
full Chinese translation of the dense-gemm-fp16-from-naive tutorial.
Made-with: Cursor
Copy file name to clipboardExpand all lines: optimization/dense-gemm-fp16-from-naive.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,8 @@ __co__ void matmul(
72
72
|`foreach {iv_k} in [K]`| A plain sequential loop — no parallelism, no reordering. |
73
73
|`.at(i, j)`| Element-level accessor into a 2-D tensor. |
74
74
75
-

75
+

76
+

76
77
77
78
### Generated CUDA (v0)
78
79
@@ -149,7 +150,8 @@ __co__ void matmul(
149
150
|`dma.copy src => dst`| Cooperative DMA: all threads in the block collectively transfer `src` to `dst`. Croqtile partitions the transfer across threads, generates coalesced loads, and inserts `__syncthreads()`. One line replaces ~20 lines of manual CUDA. |
150
151
|`.subspan(TILE_M, TILE_K).at(i, j)`| Selects the tile of shape `[TILE_M, TILE_K]` at grid position `(i, j)` within the tensor. |
151
152
152
-

153
+

154
+

153
155
154
156
### Generated CUDA (v1) — what `dma.copy` expands to
155
157
@@ -446,7 +448,8 @@ The full kernel is identical to v3 except for these defines — same 60 lines of
446
448
447
449
With two buffer slots the producer can prefetch the next tile while the consumer computes the current one:
448
450
449
-

451
+

452
+

450
453
451
454
### NCU snapshot (v4)
452
455
@@ -547,7 +550,8 @@ With the kernel compute-bound, tuning `WARP_N` changes the balance between:
547
550
!!! warning "Hardware constraint"
548
551
WGMMA requires `WARP_N` to be a **multiple of 8**. Values like 180 or 188 compile-fail with `MMA m64n180k16 not supported`. Discovered during iter019–020.
549
552
550
-

553
+

554
+

551
555
552
556
The sweet spot is **WARP_N = 176–192**. Going beyond 192 adds shared memory without enough extra work to compensate — WARP_N=224 drops to 364 TFLOPS because the larger smem footprint prevents 2 concurrent blocks per SM.
553
557
@@ -602,7 +606,8 @@ All three can be expressed in Croqtile — the production-grade kernels in the r
602
606
603
607
## The optimization ladder
604
608
605
-

609
+

610
+

0 commit comments