Das Load-Sync-Compute-Muster
Laden Sie Kacheln, bevor Sie sie verarbeiten.
Das Load-Sync-Compute-Muster ist eine kostenlose CUDA Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des CUDA Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der CUDA Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Three Simple Phases
Tiling follows one rhythm in every kernel: load a tile into shared memory, sync, then compute from the fast copy.
Phase One: Load
In the load phase, each thread reads one element from global memory and stores it into a shared-memory tile its whole block can see.
tile[threadIdx.x] = in[globalIndex];A Cooperative Effort
Loading is a team job. Every thread fetches its slice, so together the block stages one full tile with a single coalesced pass.
Phase Two: Sync
Before anyone reads a neighbor s value, all threads must finish loading. __syncthreads is the barrier that guarantees the tile is ready.
__syncthreads();Why Sync Is Mandatory
Skip the barrier and a thread may read a tile slot that its neighbor has not written yet. That is a race and gives wrong results. 💥
Phase Three: Compute
Now every value lives on chip. In the compute phase threads read tile entries freely, since shared memory is orders faster than global.
Fast Reuse Pays Off
Because the tile sits in shared memory, a value loaded once is reused by many threads with almost no extra cost. That is the whole win.
Sometimes Sync Again
If the compute phase writes back into the same tile for a next step, add a second __syncthreads before reusing those slots.
All Threads or None
Every thread in the block must reach __syncthreads. If some skip it inside a branch, the kernel deadlocks or misbehaves.
A Reusable Skeleton
Load, sync, compute is a template you will reuse for convolutions, matrix multiply, and reductions throughout this category.
Mind the Tile Size
The shared tile must fit the block. Tile width usually equals blockDim, so each thread owns exactly one slot to load and reuse.
Quick Check
Why is __syncthreads needed between load and compute?
Recap
Tiling is load, sync, compute: stage a tile cooperatively, barrier so it is complete, then reuse it fast on chip. ✅
Häufig gestellte Fragen
Ist die Lektion „Das Load-Sync-Compute-Muster“ kostenlos?
Ja — der vollständige Text von „Das Load-Sync-Compute-Muster“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des CUDA Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der CUDA Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Das Load-Sync-Compute-Muster“?
Laden Sie Kacheln, bevor Sie sie verarbeiten. Du übst CUDA Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um CUDA Academy zu starten?
Keine Vorkenntnisse erforderlich. CUDA Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.
Wie lange dauert die Lektion „Das Load-Sync-Compute-Muster“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser CUDA Academy-Lektion Code schreiben und ausführen?
Ja. Jede CUDA Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Das Problem der Datenwiederverwendung
- Das Load-Sync-Compute-Muster
- Stencil und gleitende Fenster
- Randkacheln verarbeiten