İç Çarpımı Döşeyin
Her aşamada A ve B'nin alt döşemelerini yükleyin.
İç Çarpımı Döşeyin, CoddyKit'te ücretsiz bir CUDA Academy dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, CUDA Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. CUDA Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
The Tiling Idea
Tiling breaks the matrices into small square tiles that fit in fast on-chip memory. Threads cooperate to load a tile once and reuse it many times.
Why Shared Memory
A tile lives in __shared__ memory, visible to every thread in the block. Reading it is far faster than hitting global memory again and again. ⚡
__shared__ float As[TILE][TILE];
__shared__ float Bs[TILE][TILE];One Block, One Output Tile
Each block is responsible for one TILE-by-TILE patch of the output C. Its threads team up to compute that whole patch together.
Tile Size Matches Block
You pick TILE equal to the block's width, often 16 or 32. That way each thread loads exactly one element of each tile.
#define TILE 16
dim3 threads(TILE, TILE);Mapping Thread to Tile Slot
Inside the tile, a thread's slot is just its threadIdx. Its global row and col still come from the block and thread indices.
int ty = threadIdx.y, tx = threadIdx.x;
int row = blockIdx.y*TILE + ty;
int col = blockIdx.x*TILE + tx;Loading a Tile of A
Each thread copies one element of A's current tile into shared memory. Together the block stages a full TILE-by-TILE block of A.
As[ty][tx] = A[row*N + (phase*TILE + tx)];Loading a Tile of B
At the same time, each thread loads one element of B's tile. Now both tiles sit on chip, ready for fast repeated reads.
Bs[ty][tx] = B[(phase*TILE + ty)*N + col];Sync Before You Compute
Call __syncthreads() so every thread finishes loading before anyone reads the tile. Skipping this gives garbage results.
__syncthreads();Compute on the Tile
Now each thread does a short loop over the tile, reading only shared memory. These reads are dramatically cheaper than global ones.
for (int k = 0; k < TILE; ++k)
sum += As[ty][k] * Bs[k][tx];The Reuse Payoff
Every loaded value gets used by TILE threads instead of one. That data reuse is the whole reason tiled matmul flies.
One Tile Is Not Enough
A single tile only covers part of the dot product. You repeat the load-sync-compute steps across many phases, which the next lesson handles.
Quick Check
Recall the order of steps when working with a shared tile.
Recap
You staged tiles of A and B into shared memory, synced, then computed with cheap on-chip reads. Reuse is the win. Phases come next. 🧱
Sıkça Sorulan Sorular
“İç Çarpımı Döşeyin” dersi ücretsiz mi?
Evet — “İç Çarpımı Döşeyin” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve CUDA Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. CUDA Academy kursu toplamda 4 dersten oluşur.
“İç Çarpımı Döşeyin” dersinde ne öğreneceğim?
Her aşamada A ve B'nin alt döşemelerini yükleyin. CUDA Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
CUDA Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te CUDA Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.
“İç Çarpımı Döşeyin” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu CUDA Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her CUDA Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.